Skip to content

Commit

Permalink
minor change to typing for neural network
Browse files Browse the repository at this point in the history
  • Loading branch information
justincdavis committed Nov 17, 2023
1 parent c3a6848 commit f93b37a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/oakutils/_legacy_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,7 @@ def __init__(
if self._primary_mono_left
else dai.CameraBoardSocket.RIGHT
)
(
stereo,
left,
right,
) = create_stereo_depth(
(stereo, left, right,) = create_stereo_depth(
pipeline=self._pipeline,
resolution=self._mono_size[2],
fps=mono_fps,
Expand Down
12 changes: 6 additions & 6 deletions src/oakutils/nodes/neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
from __future__ import annotations

import logging
from pathlib import Path
from typing import Callable, Iterable
from typing import TYPE_CHECKING, Callable, Iterable

import cv2
import depthai as dai
import numpy as np

if TYPE_CHECKING:
from pathlib import Path

_log = logging.getLogger(__name__)


def create_neural_network(
pipeline: dai.Pipeline,
input_link: dai.Node.Output | Iterable[dai.Node.Output],
blob_path: str,
blob_path: Path,
input_names: str | Iterable[str] | None = None,
reuse_messages: bool | Iterable[bool | None] | None = None,
num_inference_threads: int = 2,
Expand Down Expand Up @@ -97,11 +99,9 @@ def create_neural_network(
"input_link and reuse_messages must be the same length if both are iterables"
)

bpath: Path = Path(blob_path)

# create the node and handle the always present parameters
nn = pipeline.create(dai.node.NeuralNetwork)
nn.setBlobPath(bpath)
nn.setBlobPath(blob_path)
nn.setNumInferenceThreads(num_inference_threads)

# handle the optional parameters
Expand Down

0 comments on commit f93b37a

Please sign in to comment.