EngineOutput to normalize engine outputs#16
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
|
|
||
| @dataclass(frozen=True, slots=True) | ||
| class ONNXEngineOutput(EngineOutput): |
There was a problem hiding this comment.
I think it makes sense to define these classes in the respective engine files for better visibility (e.g. if I would go implement my own engine I would see right away some references for engine output classes)
There was a problem hiding this comment.
Good point, I moved the ONNXEngineOutput and DepthaiEngineOutput to their respective classes in e7bc102. Also a bit of a stylistic choice but in this same commit I also added a requirement that each engine should be assigned an EngineOutput as a class attribute a bit like how some LuxonisTrain heads can be assigned a parser, but this time it throws an error if it is not implemented.
There was a problem hiding this comment.
Generally I'd rename the parsers to match 1:1 to depthai-nodes parsers. This would also mean then that we wouldn'thave detection.py instance_seg.py and keypoint_detection.py. Instead there would only be yolo.py which would have YOLOExtendedParser class defined (and would use depthai-nodes YOLOExtendedParser.compute() internally)
There was a problem hiding this comment.
Good point, I renamed SemanticSegmentationParser to SegmentationParser and the three YOLO parsers are collapsed into a single YOLOExtendedParser in 52b82a1. One thing to note now though is that there is no more "task selection" through the parsers in luxonis-eval and this is done through the depthai-nodesYOLOcompute()which determines the task based on the output tensor names. I think this is fine since we want the flow to be as similar to the normaldepthai-nodes` flow, just something worth noting though.
Purpose
EngineOutput(parser-facing, now the parsers have no information regarding which backend is supplying them) andTensorSpec/ModelSpecfor resolved model I/O metadata.EngineOutputinstead of their raw data they were previously returning (raw tensors ordai.NNData) and new implemented engines have to adapt this.EngineOutput+ModelSpec: no longer dependent on engine-specific raw output typesluxonis-evalparsers call thecompute()function of parsers indepthai-nodesinstead of hand-written computation logicSet to draft: 1) depends on depthai-nodes PR and 2) I need to generate different models by training them with
LuxonisTrain, converting them to ONNX NNArchive and RVC4 NNArchive (FP16) and making sure the results are coherent betweenluxonis_train test ...andluxonis_eval eval .... Although this PR is supposed to only be architectural shouldn't change anything functionally, this is just to make sure since the computation now relies on the depthai-nodes parsers'compute. Then we can use these .ckpt/.onnx.tar.xz/.rvc4.tar.xz files later on for automatic E2E/regression testing.Specification
None / not applicable
Dependencies & Potential Impact
None / not applicable
Deployment Plan
None / not applicable
Testing & Validation
None / not applicable
AI Usage
Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]
Submitted code was reviewed by a human: YES/NO
The author is taking the responsibility for the contribution: YES/NO