diff --git a/depthai_nodes/ml/parsers/base_parser.py b/depthai_nodes/ml/parsers/base_parser.py index e068eeb..801fa3f 100644 --- a/depthai_nodes/ml/parsers/base_parser.py +++ b/depthai_nodes/ml/parsers/base_parser.py @@ -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 @@ -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 diff --git a/depthai_nodes/ml/parsers/classification.py b/depthai_nodes/ml/parsers/classification.py index 7c52ac7..a93937d 100644 --- a/depthai_nodes/ml/parsers/classification.py +++ b/depthai_nodes/ml/parsers/classification.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/detection.py b/depthai_nodes/ml/parsers/detection.py index d1d90e0..715d375 100644 --- a/depthai_nodes/ml/parsers/detection.py +++ b/depthai_nodes/ml/parsers/detection.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/embeddings.py b/depthai_nodes/ml/parsers/embeddings.py index 4482aa4..950a5cf 100644 --- a/depthai_nodes/ml/parsers/embeddings.py +++ b/depthai_nodes/ml/parsers/embeddings.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/fastsam.py b/depthai_nodes/ml/parsers/fastsam.py index 27b24fb..c7bbb36 100644 --- a/depthai_nodes/ml/parsers/fastsam.py +++ b/depthai_nodes/ml/parsers/fastsam.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/hrnet.py b/depthai_nodes/ml/parsers/hrnet.py index d800ebb..4be4de3 100644 --- a/depthai_nodes/ml/parsers/hrnet.py +++ b/depthai_nodes/ml/parsers/hrnet.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/image_output.py b/depthai_nodes/ml/parsers/image_output.py index 96d84e1..2cd1f54 100644 --- a/depthai_nodes/ml/parsers/image_output.py +++ b/depthai_nodes/ml/parsers/image_output.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/keypoints.py b/depthai_nodes/ml/parsers/keypoints.py index 418aa9c..ea6df54 100644 --- a/depthai_nodes/ml/parsers/keypoints.py +++ b/depthai_nodes/ml/parsers/keypoints.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/lane_detection.py b/depthai_nodes/ml/parsers/lane_detection.py index 5969332..dadfe5b 100644 --- a/depthai_nodes/ml/parsers/lane_detection.py +++ b/depthai_nodes/ml/parsers/lane_detection.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/map_output.py b/depthai_nodes/ml/parsers/map_output.py index 19f0ce7..e9e39c1 100644 --- a/depthai_nodes/ml/parsers/map_output.py +++ b/depthai_nodes/ml/parsers/map_output.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/mediapipe_palm_detection.py b/depthai_nodes/ml/parsers/mediapipe_palm_detection.py index 3394cb7..382d3f7 100644 --- a/depthai_nodes/ml/parsers/mediapipe_palm_detection.py +++ b/depthai_nodes/ml/parsers/mediapipe_palm_detection.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/mlsd.py b/depthai_nodes/ml/parsers/mlsd.py index 4518906..96dec0e 100644 --- a/depthai_nodes/ml/parsers/mlsd.py +++ b/depthai_nodes/ml/parsers/mlsd.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/ppdet.py b/depthai_nodes/ml/parsers/ppdet.py index f7c85c7..b64ea76 100644 --- a/depthai_nodes/ml/parsers/ppdet.py +++ b/depthai_nodes/ml/parsers/ppdet.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/regression.py b/depthai_nodes/ml/parsers/regression.py index 5738697..c7be585 100644 --- a/depthai_nodes/ml/parsers/regression.py +++ b/depthai_nodes/ml/parsers/regression.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/scrfd.py b/depthai_nodes/ml/parsers/scrfd.py index c53842f..042a5f7 100644 --- a/depthai_nodes/ml/parsers/scrfd.py +++ b/depthai_nodes/ml/parsers/scrfd.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/segmentation.py b/depthai_nodes/ml/parsers/segmentation.py index ec5136a..0369ea5 100644 --- a/depthai_nodes/ml/parsers/segmentation.py +++ b/depthai_nodes/ml/parsers/segmentation.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/superanimal_landmarker.py b/depthai_nodes/ml/parsers/superanimal_landmarker.py index 5be5e35..071891a 100644 --- a/depthai_nodes/ml/parsers/superanimal_landmarker.py +++ b/depthai_nodes/ml/parsers/superanimal_landmarker.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/xfeat.py b/depthai_nodes/ml/parsers/xfeat.py index 73a9105..d11a8e5 100644 --- a/depthai_nodes/ml/parsers/xfeat.py +++ b/depthai_nodes/ml/parsers/xfeat.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/yolo.py b/depthai_nodes/ml/parsers/yolo.py index cc7bd0d..9917947 100644 --- a/depthai_nodes/ml/parsers/yolo.py +++ b/depthai_nodes/ml/parsers/yolo.py @@ -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 """ diff --git a/depthai_nodes/ml/parsers/yunet.py b/depthai_nodes/ml/parsers/yunet.py index 1b306a9..9cb61c0 100644 --- a/depthai_nodes/ml/parsers/yunet.py +++ b/depthai_nodes/ml/parsers/yunet.py @@ -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 """ diff --git a/depthai_nodes/parser_generator.py b/depthai_nodes/parser_generator.py index c8e87ae..441e949 100644 --- a/depthai_nodes/parser_generator.py +++ b/depthai_nodes/parser_generator.py @@ -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] """ diff --git a/depthai_nodes/parsing_neural_network.py b/depthai_nodes/parsing_neural_network.py index 9d0ab2c..1b414d3 100644 --- a/depthai_nodes/parsing_neural_network.py +++ b/depthai_nodes/parsing_neural_network.py @@ -42,12 +42,14 @@ 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, @@ -55,23 +57,21 @@ def build( 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):