Skip to content

Commit 30273ad

Browse files
committed
Fix - NN Archive Validation (#123)
Fixed validation errors in NN Archive.
1 parent 3fb808b commit 30273ad

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

luxonis_ml/nn_archive/config_building_blocks/base_models/head.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class HeadYOLO(HeadObjectDetection, HeadSegmentation, ABC):
169169
description="A configuration specifying which output names from the `outputs` block of the archive are fed into the head."
170170
)
171171
subtype: ObjectDetectionSubtypeYOLO = Field(
172-
description="YOLO family decoding subtype (e.g. v5, v6, v7 etc.)."
172+
description="YOLO family decoding subtype (e.g. yolov5, yolov6, yolov7 etc.)."
173173
)
174174
postprocessor_path: Optional[str] = Field(
175175
None,
@@ -276,7 +276,13 @@ def validate_task_specific_fields(
276276

277277
# Validate Outputs
278278
outputs = values.get("outputs", {})
279-
defined_params = {k for k, v in outputs.dict().items() if v is not None}
279+
defined_params = {
280+
k
281+
for k, v in (
282+
outputs.model_dump() if isinstance(outputs, BaseModel) else outputs
283+
).items()
284+
if v is not None
285+
}
280286

281287
supported_output_params = {
282288
"instance_segmentation": ["yolo_outputs", "mask_outputs", "protos"],

luxonis_ml/nn_archive/config_building_blocks/base_models/head_outputs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ class OutputsYOLO(Outputs):
5151

5252
# Instance segmentation
5353
mask_outputs: Optional[List[str]] = Field(
54-
description="A list of output names for each mask output."
54+
None, description="A list of output names for each mask output."
5555
)
56-
protos: Optional[str] = Field(description="Output name for the protos.")
56+
protos: Optional[str] = Field(None, description="Output name for the protos.")
5757

5858
# Keypoint detection
59-
keypoints: Optional[str] = Field(description="Output name for the keypoints.")
59+
keypoints: Optional[str] = Field(None, description="Output name for the keypoints.")
6060

6161
# OBB detection
62-
angles: Optional[str] = Field(description="Output name for the angles.")
62+
angles: Optional[str] = Field(None, description="Output name for the angles.")
6363

6464

6565
class OutputsSSD(Outputs):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "luxonis-ml"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "MLOps tools for training models for Luxonis devices"
55
readme = "README.md"
66
requires-python = ">=3.8"

0 commit comments

Comments
 (0)