Skip to content

Commit

Permalink
pre-commit on docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klemen1999 committed Oct 24, 2024
1 parent 64d2820 commit bea79e5
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 77 deletions.
10 changes: 6 additions & 4 deletions depthai_nodes/ml/parsers/base_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def out(self, node: dai.Node.Output) -> None:
def build(self, head_config: Dict[str, Any]) -> "BaseParser":
"""Configures the parser based on the specified head configuration.
@param head_config: A dictionary containing configuration details relevant to the parser, including parameters and settings required for output parsing.
@param head_config: A dictionary containing configuration details relevant to
the parser, including parameters and settings required for output parsing.
@type head_config: Dict[str, Any]
"""
pass
Expand All @@ -63,12 +64,13 @@ def build(self, head_config: Dict[str, Any]) -> "BaseParser":
def run(self):
"""Parses the output from the neural network head.
This method should be overridden by subclasses to implement the specific parsing logic.
It accepts arbitrary keyword arguments for flexibility.
This method should be overridden by subclasses to implement the specific parsing
logic. It accepts arbitrary keyword arguments for flexibility.
@param kwargs: Arbitrary keyword arguments for the parsing process.
@type kwargs: Any
@return message: The parsed output message, as defined by the logic in the subclass.
@return message: The parsed output message, as defined by the logic in the
subclass.
@rtype message: Any
"""
pass
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "ClassificationParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: ClassificationParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ def setMaxDetections(self, max_det: int) -> None:
self.max_det = max_det

def build(self, head_config) -> "DetectionParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: DetectionParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ def __init__(self) -> None:
self.output_layer_names = None

def build(self, head_config: Dict[str, Any]):
"""
Sets the head configuration for the parser.
"""Sets the head configuration for the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: EmbeddingsParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/fastsam.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,10 @@ def setProtosOutput(self, protos_output: str) -> None:
self.protos_output = protos_output

def build(self, head_config: Dict[str, Any]) -> "FastSAMParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: FastSAMParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/hrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "HRNetParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: HRNetParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/image_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "ImageOutputParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: ImageOutputParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "KeypointParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: KeypointParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/lane_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "LaneDetectionParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: LaneDetectionParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/map_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "MapOutputParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: MapOutputParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/mediapipe_palm_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "MPPalmDetectionParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: MPPalmDetectionParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/mlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "MLSDParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: MLSDParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/ppdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ def setMaskThreshold(self, mask_threshold: float = 0.25) -> None:
self.mask_threshold = mask_threshold

def build(self, head_config: Dict[str, Any]) -> "PPTextDetectionParser":
"""
Configures the parser.
"""Configures the parser.
@param config: The head configuration for the parser.
@type config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: PPTextDetectionParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "RegressionParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: RegressionParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/scrfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "SCRFDParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: SCRFDParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "SegmentationParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: SegmentationParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/superanimal_landmarker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "SuperAnimalParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: SuperAnimalParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/xfeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "XFeatBaseParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: XFeatBaseParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,10 @@ def build(
self,
head_config: Dict[str, Any],
):
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: YOLOExtendedParser
"""
Expand Down
4 changes: 1 addition & 3 deletions depthai_nodes/ml/parsers/yunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ def build(
self,
head_config: Dict[str, Any],
) -> "YuNetParser":
"""
Configures the parser.
"""Configures the parser.
@param head_config: The head configuration for the parser.
@type head_config: Dict[str, Any]
@return: The parser object with the head configuration set.
@rtype: YuNetParser
"""
Expand Down
8 changes: 3 additions & 5 deletions depthai_nodes/parser_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ def __init__(self):
super().__init__()

def build(self, nn_archive: dai.NNArchive, head_index: int = None) -> Dict:
"""
Instantiates parsers based on the provided model archive.
"""Instantiates parsers based on the provided model archive.
@param nn_archive: NN Archive of the model.
@type nn_archive: dai.NNArchive
@param head_index: Index of the head to be used for parsing. If not provided, each head will instantiate a separate parser.
@param head_index: Index of the head to be used for parsing. If not provided,
each head will instantiate a separate parser.
@type head_index: int
@return: A dictionary of instantiated parsers.
@rtype: Dict[int, BaseParser]
"""
Expand Down
22 changes: 11 additions & 11 deletions depthai_nodes/parsing_neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,36 @@ def __init__(self, *args, **kwargs) -> None:
@overload
def build(
self, input: dai.Node.Output, nn_source: dai.NNModelDescription, fps: int
) -> "ParsingNeuralNetwork": ...
) -> "ParsingNeuralNetwork":
...

@overload
def build(
self, input: dai.Node.Output, nn_source: dai.NNArchive, fps: int
) -> "ParsingNeuralNetwork": ...
) -> "ParsingNeuralNetwork":
...

def build(
self,
input: dai.Node.Output,
nn_source: Union[dai.NNModelDescription, dai.NNArchive],
fps: int = None,
) -> "ParsingNeuralNetwork":
"""
Builds the underlying NeuralNetwork node and creates parser nodes for each
"""Builds the underlying NeuralNetwork node and creates parser nodes for each
model head.
@param input: Node's input. It is a linking point to which the NeuralNetwork is linked. It accepts the output of a Camera node.
@param input: Node's input. It is a linking point to which the NeuralNetwork is
linked. It accepts the output of a Camera node.
@type input: Node.Input
@param nn_source: NNModelDescription object containing the HubAI model descriptors, or NNArchive object of the model.
@param nn_source: NNModelDescription object containing the HubAI model
descriptors, or NNArchive object of the model.
@type nn_source: Union[dai.NNModelDescription, dai.NNArchive]
@param fps: FPS limit for the model runtime.
@type fps: int
@return: Returns the ParsingNeuralNetwork object.
@rtype: ParsingNeuralNetwork
@raise ValueError: If the nn_source is not a NNModelDescription or NNArchive object.
@raise ValueError: If the nn_source is not a NNModelDescription or NNArchive
object.
"""

if isinstance(nn_source, dai.NNModelDescription):
Expand Down

0 comments on commit bea79e5

Please sign in to comment.