-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add yolo-v5 example #3224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add yolo-v5 example #3224
Conversation
sdabbour
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been diving into the code recently to investigate implementation of an example for Qwen 3 VL. These are just some things I noticed from a layout perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this model be better placed in the candle-transformers/src/models/ dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, yolov5 is quite old, it's ok to implement your own models for whoever needs it based on candle-examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is necessary to include, could maybe describe a bit how to get the model in the README.md file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably fine for a small stand-alone python script to be included, especially one that is somewhat obvious like this one.
if there's anything I'd change, is to maybe make it stand-alone executable with uv by including dependencies in the script itself: https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
then one can just uv run script.py without much thinking.
slckl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yolov5 is quite old by now, but still surprisingly popular. I've confirmed the present impl works.
Would like to see output logs + classes/confidences in output annotations, and this would be a fine addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably fine for a small stand-alone python script to be included, especially one that is somewhat obvious like this one.
if there's anything I'd change, is to maybe make it stand-alone executable with uv by including dependencies in the script itself: https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
then one can just uv run script.py without much thinking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, yolov5 is quite old, it's ok to implement your own models for whoever needs it based on candle-examples?
| ## Running an example | ||
|
|
||
| ```bash | ||
| $ cargo run --example yolo-v5 --release -- candle-examples/examples/yolo-v8/assets/bike.jpg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm this works and produces sane-looking output 😃
| ), | ||
| image::Rgba([255, 0, 0, 255]), | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please include class labels + confidence on the output image? similar to how yolo-v8 example does it?
I would also be grateful if you println logged the class names + bbox data similar to how yolo-v8 example does it? It's very useful to validate any numerical changes in the library etc:
println!(
"{}: {:?}",
candle_examples::coco_classes::NAMES[class_index],
b
);
Fix #1858