Closed benjamingb closed 3 weeks ago
I have two guesses: 1) OpenCV version (you have 4.6.0 based on error message). https://github.com/ultralytics/ultralytics/issues/1836 I think that version 4.7.0 should do the trick. 2) OpSet for ONNX. It should be 12. https://github.com/ultralytics/ultralytics/issues/1097
Hi
I updated to version opencv 4.8.0 but now I get another error
Can't process detection, error: OpenCVError(Error { code: "StsAssert, -215", message: "OpenCV(4.8.0) /home/benjamin/dist/opencv-4.8.0/modules/dnn/src/layers/reshape_layer.cpp:109: error: (-215:Assertion failed) total(srcShape, srcRange.start, srcRange.end) == maskTotal in function 'computeShapeByReshapeMask'\n" })
[ERROR:0@10.825] global net_impl.cpp:1166 getLayerShapesRecursively OPENCV/DNN: [Reshape]:(onnx_node!/model.22/dfl/Reshape): getMemoryShapes() throws exception. inputs=1 outputs=1/1 blobs=0
[ERROR:0@10.825] global net_impl.cpp:1172 getLayerShapesRecursively input[0] = [ 1 64 3549 ]
[ERROR:0@10.825] global net_impl.cpp:1176 getLayerShapesRecursively output[0] = [ ]
[ERROR:0@10.825] global net_impl.cpp:1182 getLayerShapesRecursively Exception message: OpenCV(4.8.0) /home/benjamin/dist/opencv-4.8.0/modules/dnn/src/layers/reshape_layer.cpp:109: error: (-215:Assertion failed) total(srcShape, srcRange.start, srcRange.end) == maskTotal in function 'computeShapeByReshapeMask'
Does it only work with the darknet?
May you provide link to a model and image you trying to run through the detection function?
I think that something could be wrong with the shape of the model (I guess the model is custom?): input[0] = [ 1 64 3549 ]
. https://github.com/ultralytics/ultralytics/issues/1050
The problem was that I had the dimensions of the network wrong, I had it at 416, I changed it to 640 and it worked.
let net_width = 640;
let net_height = 640;
Thank you for your help and for the great work in developing the lib.
Are you planning to update the opencv-rust version to 0.9.x in your library soon?
Glad to hear that it works! Yes, I'm planning to update Cargo.toml to include 0.9 version of OpenCV bindings, but it will happen in a couple of weeks after my vacation and checks that my other projects depending on this package won't be broken
Question I converted a Yolov8m model to Onnx, the model works fine, but when I put a video to detect the objects, the video goes very slow, if I use darknet the video goes at normal speed, only when I load the .onnx model the video gets super slow, the video has 29 FPS, do you know why that happens ?
I believe it should be investigated in details in both Rust and Python OpenCV's bindings then if any of three clauses above does not take place.
Using cargo run
(in case of cargo build
it should be faster), RTX 3060 (CUDA is enabled)
TLDR
:
real 0m0,5s
user 0m0,3s
sys 0m0,2s
real 0m0,6s
user 0m0,4s
sys 0m0,3s
real 0m0,7s
user 0m0,4s
sys 0m0,2s
real 0m0,5s
user 0m0,4s
sys 0m0,2s
Seems like, that M-model just takes more resources on computing. But should it affect FPS so much in your case?
Full logs:
Three runs on Traditional Darknet v7:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v7`
Class: motorbike
Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 }
Confidences: 0.36123458
Class: truck
Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 }
Confidences: 0.9325973
Class: bicycle
Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 }
Confidences: 0.9681798
Class: dog
Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 }
Confidences: 0.9735598
real 0m0,527s
user 0m0,295s
sys 0m0,236s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v7`
Class: motorbike
Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 }
Confidences: 0.36123458
Class: truck
Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 }
Confidences: 0.9325973
Class: bicycle
Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 }
Confidences: 0.9681798
Class: dog
Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 }
Confidences: 0.9735598
real 0m0,537s
user 0m0,297s
sys 0m0,243s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v7`
Class: motorbike
Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 }
Confidences: 0.36123458
Class: truck
Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 }
Confidences: 0.9325973
Class: bicycle
Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 }
Confidences: 0.9681798
Class: dog
Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 }
Confidences: 0.9735598
real 0m0,521s
user 0m0,289s
sys 0m0,236s
Three runs on Ultralytics v8m:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_m.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_m`
Class: truck
Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 }
Confidences: 0.86243707
Class: bicycle
Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 }
Confidences: 0.9651602
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 }
Confidences: 0.94658756
real 0m0,662s
user 0m0,432s
sys 0m0,230s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_m.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_m`
Class: truck
Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 }
Confidences: 0.86243707
Class: bicycle
Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 }
Confidences: 0.9651602
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 }
Confidences: 0.94658756
real 0m0,667s
user 0m0,439s
sys 0m0,228s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_m.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_m`
Class: truck
Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 }
Confidences: 0.86243707
Class: bicycle
Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 }
Confidences: 0.9651602
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 }
Confidences: 0.94658756
real 0m0,659s
user 0m0,433s
sys 0m0,226s
Three runs on Ultralytics v8s:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_s.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_s`
Class: truck
Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 }
Confidences: 0.86541396
Class: bicycle
Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 }
Confidences: 0.90190446
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 }
Confidences: 0.9244803
real 0m0,574s
user 0m0,379s
sys 0m0,195s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_s.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_s`
Class: truck
Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 }
Confidences: 0.86541396
Class: bicycle
Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 }
Confidences: 0.90190446
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 }
Confidences: 0.9244803
real 0m0,564s
user 0m0,384s
sys 0m0,181s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v8_s.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v8_s`
Class: truck
Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 }
Confidences: 0.86541396
Class: bicycle
Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 }
Confidences: 0.90190446
Class: dog
Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 }
Confidences: 0.9244803
real 0m0,557s
user 0m0,371s
sys 0m0,187s
Three runs on Traditional Darknet v4:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v4.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v4`
Class: truck
Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 }
Confidences: 0.9920712
Class: bicycle
Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 }
Confidences: 0.9883387
Class: dog
Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 }
Confidences: 0.99280965
real 0m0,678s
user 0m0,350s
sys 0m0,331s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v4.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v4`
Class: truck
Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 }
Confidences: 0.9920712
Class: bicycle
Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 }
Confidences: 0.9883387
Class: dog
Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 }
Confidences: 0.99280965
real 0m0,663s
user 0m0,325s
sys 0m0,340s
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4
warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
warning: unused variable: `class_filters`
--> examples/yolo_v4.rs:22:9
|
22 | let class_filters: Vec<usize> = vec![];
| ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters`
|
= note: `#[warn(unused_variables)]` on by default
warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/examples/yolo_v4`
Class: truck
Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 }
Confidences: 0.9920712
Class: bicycle
Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 }
Confidences: 0.9883387
Class: dog
Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 }
Confidences: 0.99280965
real 0m0,660s
user 0m0,359s
sys 0m0,304s
Glad to hear that it works! Yes, I'm planning to update Cargo.toml to include 0.9 version of OpenCV bindings, but it will happen in a couple of weeks after my vacation and checks that my other projects depending on this package won't be broken
Just bumped to 0.91.3 version
Usando (en caso de que sea más rápido), RTX 3060 (CUDA está habilitado) :
cargo run``cargo build``TLDR
- v7 darknet. Promedio:
real 0m0,5s user 0m0,3s sys 0m0,2s
- v4 darknet. Promedio:
real 0m0,6s user 0m0,4s sys 0m0,3s
- V8M Onnx. Promedio:
real 0m0,7s user 0m0,4s sys 0m0,2s
- V8S Onnx. Promedio:
real 0m0,5s user 0m0,4s sys 0m0,2s
Parece que el modelo M solo requiere más recursos en computación. Pero, ¿debería afectar tanto a los FPS en tu caso?
Registros completos:
Tres ejecuciones en Traditional Darknet v7:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v7` Class: motorbike Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 } Confidences: 0.36123458 Class: truck Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 } Confidences: 0.9325973 Class: bicycle Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 } Confidences: 0.9681798 Class: dog Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 } Confidences: 0.9735598 real 0m0,527s user 0m0,295s sys 0m0,236s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v7` Class: motorbike Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 } Confidences: 0.36123458 Class: truck Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 } Confidences: 0.9325973 Class: bicycle Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 } Confidences: 0.9681798 Class: dog Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 } Confidences: 0.9735598 real 0m0,537s user 0m0,297s sys 0m0,243s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v7 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v7` Class: motorbike Bounding box: Rect_ { x: 56, y: 72, width: 53, height: 54 } Confidences: 0.36123458 Class: truck Bounding box: Rect_ { x: 468, y: 74, width: 225, height: 95 } Confidences: 0.9325973 Class: bicycle Bounding box: Rect_ { x: 126, y: 128, width: 440, height: 289 } Confidences: 0.9681798 Class: dog Bounding box: Rect_ { x: 130, y: 220, width: 180, height: 321 } Confidences: 0.9735598 real 0m0,521s user 0m0,289s sys 0m0,236s
Three runs on Ultralytics v8m:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_m.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_m` Class: truck Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 } Confidences: 0.86243707 Class: bicycle Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 } Confidences: 0.9651602 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 } Confidences: 0.94658756 real 0m0,662s user 0m0,432s sys 0m0,230s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_m.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_m` Class: truck Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 } Confidences: 0.86243707 Class: bicycle Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 } Confidences: 0.9651602 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 } Confidences: 0.94658756 real 0m0,667s user 0m0,439s sys 0m0,228s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_m warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_m.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_m") generated 1 warning (run `cargo fix --example "yolo_v8_m"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_m` Class: truck Bounding box: Rect_ { x: 465, y: 75, width: 226, height: 97 } Confidences: 0.86243707 Class: bicycle Bounding box: Rect_ { x: 125, y: 135, width: 442, height: 285 } Confidences: 0.9651602 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 319 } Confidences: 0.94658756 real 0m0,659s user 0m0,433s sys 0m0,226s
Tres ejecuciones en Ultralytics v8:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_s.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_s` Class: truck Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 } Confidences: 0.86541396 Class: bicycle Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 } Confidences: 0.90190446 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 } Confidences: 0.9244803 real 0m0,574s user 0m0,379s sys 0m0,195s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_s.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_s` Class: truck Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 } Confidences: 0.86541396 Class: bicycle Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 } Confidences: 0.90190446 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 } Confidences: 0.9244803 real 0m0,564s user 0m0,384s sys 0m0,181s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v8_s warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v8_s.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v8_s") generated 1 warning (run `cargo fix --example "yolo_v8_s"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v8_s` Class: truck Bounding box: Rect_ { x: 468, y: 75, width: 226, height: 97 } Confidences: 0.86541396 Class: bicycle Bounding box: Rect_ { x: 126, y: 134, width: 445, height: 286 } Confidences: 0.90190446 Class: dog Bounding box: Rect_ { x: 132, y: 223, width: 179, height: 317 } Confidences: 0.9244803 real 0m0,557s user 0m0,371s sys 0m0,187s
Tres ejecuciones en Traditional Darknet v4:
dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v4.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v4` Class: truck Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 } Confidences: 0.9920712 Class: bicycle Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 } Confidences: 0.9883387 Class: dog Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 } Confidences: 0.99280965 real 0m0,678s user 0m0,350s sys 0m0,331s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v4.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v4` Class: truck Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 } Confidences: 0.9920712 Class: bicycle Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 } Confidences: 0.9883387 Class: dog Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 } Confidences: 0.99280965 real 0m0,663s user 0m0,325s sys 0m0,340s dimitrii@dimitrii-pc:~/rust_work/object-detection-opencv-rust$ time cargo run --package od_opencv --example yolo_v4 warning: Patch `cc v1.0.79 (https://github.com/rust-lang/cc-rs.git?tag=1.0.79#e5bbdfa1)` was not used in the crate graph. Check that the patched package version and available features are compatible with the dependency requirements. If the patch has a different version from what is locked in the Cargo.lock file, run `cargo update` to use the new version. This may also occur with an optional dependency that is not enabled. warning: unused variable: `class_filters` --> examples/yolo_v4.rs:22:9 | 22 | let class_filters: Vec<usize> = vec![]; | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_class_filters` | = note: `#[warn(unused_variables)]` on by default warning: `od_opencv` (example "yolo_v4") generated 1 warning (run `cargo fix --example "yolo_v4"` to apply 1 suggestion) Finished dev [unoptimized + debuginfo] target(s) in 0.01s Running `target/debug/examples/yolo_v4` Class: truck Bounding box: Rect_ { x: 463, y: 74, width: 229, height: 96 } Confidences: 0.9920712 Class: bicycle Bounding box: Rect_ { x: 128, y: 132, width: 438, height: 290 } Confidences: 0.9883387 Class: dog Bounding box: Rect_ { x: 132, y: 231, width: 177, height: 305 } Confidences: 0.99280965 real 0m0,660s user 0m0,359s sys 0m0,304s
I will have to test, I compile Opencv with CUDA but neither c++ nor rust detects it, only python detects it.
I think I'll close issue due inactivity and actually working ONNX reader :D
I'm trying the example of loading a YOLOv8 model in ONNX format and I'm getting this error, am I doing something wrong?