Skip to content

Commit

Permalink
Remove duplicated.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkeroo committed Oct 4, 2024
2 parents 6a44d79 + 8fc6ba2 commit e4befc4
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions examples/utils/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,10 @@ def setup_map_output_parser(parser: MapOutputParser, params: dict):
min_max_scaling = params["min_max_scaling"]
if min_max_scaling:
parser.setMinMaxScaling(True)
except Exception:
print(
"This NN archive does not have required metadata for MapOutputParser. Skipping setup..."
)


def setup_yolo_extended_parser(parser: YOLOExtendedParser, params: dict):
"""Setup the YOLO parser with the required metadata."""
try:
n_classes = params["n_classes"]
parser.setNumClasses(n_classes)
except Exception:
print(
"This NN archive does not have required metadata for YOLOExtendedParser. Skipping setup..."
)


def setup_palm_detection_parser(parser: MPPalmDetectionParser, params: dict):
"""Setup the Palm Detection parser with the required metadata."""
try:
scale = params["scale"]
parser.setScale(scale)
except Exception:
print(
"This NN archive does not have required metadata for MPPalmDetectionParser. Skipping setup..."
"This NN archive does not have required metadata for MapOutputParser. Skipping setup..."
)


Expand Down Expand Up @@ -155,6 +134,28 @@ def setup_multi_classification_parser(parser: MultiClassificationParser, params:
)


def setup_yolo_extended_parser(parser: YOLOExtendedParser, params: dict):
"""Setup the YOLO parser with the required metadata."""
try:
n_classes = params["n_classes"]
parser.setNumClasses(n_classes)
except Exception:
print(
"This NN archive does not have required metadata for YOLOExtendedParser. Skipping setup..."
)


def setup_palm_detection_parser(parser: MPPalmDetectionParser, params: dict):
"""Setup the Palm Detection parser with the required metadata."""
try:
scale = params["scale"]
parser.setScale(scale)
except Exception:
print(
"This NN archive does not have required metadata for MPPalmDetectionParser. Skipping setup..."
)


def setup_parser(parser: dai.ThreadedNode, nn_archive: dai.NNArchive, parser_name: str):
"""Setup the parser with the NN archive."""

Expand Down

0 comments on commit e4befc4

Please sign in to comment.