feature / extended onnx inference#84
Conversation
|
Here's the code health analysis summary for commits Analysis Summary
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a more generic ONNX model loader that auto-detects the provider/framework based on model inputs/outputs and adds support for D-FINE object detection models. It refactors the ONNX loading, detection, and classification nodes into a provider-based architecture and updates the draw_bboxes function to be public with reordered drawing logic.
- Add
determine_provideranddetermine_input_shapeutilities to select between D-FINE, YOLO, and TIMM providers - Refactor
LoadOnnxNode,ObjectDetectionNode, andImageClassificationNodeto use the new provider pattern - Make
draw_bboxespublic and adjust its drawing order
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/catalog/src/image/annotate/draw_boxes.rs | Expose draw_bboxes, reorder drawing steps, simplify label handling |
| packages/catalog/src/ai/ml/onnx/load.rs | Remove old tensor detection helpers, add provider factory |
| packages/catalog/src/ai/ml/onnx/detect.rs | Introduce ObjectDetection trait and Dfine/Yolo impls |
| packages/catalog/src/ai/ml/onnx/classify.rs | Introduce Classification trait and Timm impl; rename Prediction to ClassPrediction |
| packages/catalog/src/ai/ml/onnx.rs | Add Provider enum and update SessionWithMeta |
Comments suppressed due to low confidence (3)
packages/catalog/src/image/annotate/draw_boxes.rs:47
- [nitpick] Change the parameter type from
&Vec<BoundingBox>to a slice (&[BoundingBox]) to accept any slice and avoid unnecessaryVecreferences.
bboxes: &Vec<BoundingBox>,
packages/catalog/src/image/annotate/draw_boxes.rs:61
- The previous implementation displayed
class_namewhen available; this change always uses the index. Restoring the conditional match onbbox.class_namewill preserve user-friendly labels.
let label = format!("class {} ({:.2})", bbox.class_idx, bbox.score);
packages/catalog/src/image/annotate/draw_boxes.rs:62
- Remove the debug
println!or replace it with a proper logging call to avoid flooding stdout in production.
println!("{}", &label);
| /// # Classification Prediction | ||
| #[derive(Default, Serialize, Deserialize, JsonSchema, Clone, Debug)] | ||
| pub struct Prediction { | ||
| pub struct ClassPrediction { |
There was a problem hiding this comment.
ClassPrediction lacks Serialize, Deserialize, and JsonSchema derives, which will break json!(predictions). Add the same derives as on the original Prediction struct.
Uh oh!
There was an error while loading. Please reload this page.