Fix normalization parameters in YOLO example to support multi-channel mean and scale factors#26614
Fix normalization parameters in YOLO example to support multi-channel mean and scale factors#26614asmorkalov merged 1 commit intoopencv:4.xfrom KangJialiang:fix-multi-channel-mean-scale-sample-dnn-yolo
Conversation
… mean and scale factors This branch and commit address an issue in the YOLO example (samples/dnn/yolo_detector.cpp) where the mean and scale parameters only affected the first channel (B) due to single-value input. The modification updates these parameters to accept multi-channel values, ensuring consistent preprocessing across all image channels.
Thank you for the quick response and the helpful insights! As a newbee here, I really appreciate your guidance and welcome any corrections. I understand that 4.x remains a primary version in use, and while the issue is resolved in 5.x, I believe it’s important to address it in 4.x as well. Regarding #26315, I partially disagree with the claim that applying different scales to each channel is rare. At least in ImageNet classification, it’s standard practice to normalize each channel using its respective mean and std. That said, I agree that ensuring consistency between the sample code and |
This branch and commit address an issue in the YOLO example (samples/dnn/yolo_detector.cpp) where the mean and scale parameters only affected the first channel (Blue) due to single-value input. The modification updates these parameters to accept multi-channel values, ensuring consistent preprocessing across all image channels.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.