AAlexander Smorkalovvideo: fix the input scaling factor of TrackerVit
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Merge branch 4.x | 8 个月前 | |
Merge pull request #18838 from alalek:video_tracking_api Tracking API: move to video/tracking.hpp * video(tracking): moved code from opencv_contrib/tracking module - Tracker API - MIL, GOTURN trackers - applied clang-format * video(tracking): cleanup unused code * samples: add tracker.py sample * video(tracking): avoid div by zero * static analyzer | 5 年前 | |
Merge pull request #28637 from abhishek-gola:old_dnn_tickets_cleanup Added Output Tensor Names support in new DNN engine #28637 closes: https://github.com/opencv/opencv/issues/26201 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake | 7 个月前 | |
Merge pull request #18838 from alalek:video_tracking_api Tracking API: move to video/tracking.hpp * video(tracking): moved code from opencv_contrib/tracking module - Tracker API - MIL, GOTURN trackers - applied clang-format * video(tracking): cleanup unused code * samples: add tracker.py sample * video(tracking): avoid div by zero * static analyzer | 5 年前 | |
Merge pull request #30353 from kvrban:5.x video(TrackerNano): fix target scale and penalty calculation - #30353 This PR fixes an algorithmic bug and two precision issues in `cv::TrackerNanoImpl::update`: Resolves #27190 ### 1. Fix scale penalty calculation (`targetPos` -> `targetSz`) In the Siamese tracking scale penalty calculation: ```cpp // BEFORE (Bug): Mat sc = sizeCal(predX2 - predX1, predY2 - predY1)/sizeCal(targetPos[0], targetPos[1]); // AFTER (Fix): Mat sc = sizeCal(predX2 - predX1, predY2 - predY1)/sizeCal(targetSz[0], targetSz[1]); ``` `sizeCal` takes `(width, height)`, but `targetPos` holds the target's center pixel coordinates `(x, y)` in the full frame. Passing `targetPos` normalizes candidate scale by screen position rather than object size, breaking translation invariance and heavily dampening candidate scores as the target translates across the frame. Furthermore, `targetSz` is explicitly multiplied by `scale_z` before this calculation (line 252) and divided back afterwards (line 323). The only reason `targetSz` was brought into the search patch coordinate frame was for this exact line. Passing `targetPos` was apparently a typo. ### 2. Fix integer division in search crop scaling ```cpp // BEFORE: instanceSize (255) and exemplarSize (127) are const int float sx = sz * (instanceSize / exemplarSize); // Evaluates to sz * 2 instead of 2.007874f // AFTER: float sx = sz * (float(instanceSize) / exemplarSize); ``` ### 3. Preserve subpixel floating-point precision in `targetSzSum` Removed the `(int)` truncation from `targetSzSum` in `update()`: ```cpp // BEFORE: int targetSzSum = (int)(targetSz[0] + targetSz[1]); // AFTER: float targetSzSum = targetSz[0] + targetSz[1]; ``` --- ### Verification and Test Results Tested on a sequence where an object expands from 60x60 to 138x138 across 40 frames while translating across the frame: * **Before Fix (`targetPos`):** * Final Tracked Size: `133x131` * Final Area Ratio (Tracked / Ground Truth): **0.915** (persistent size lag) | 14 天前 | |
video: fix the input scaling factor of TrackerVit The tracker normalizes the images it feeds to the network with Image2BlobParams, whose per-channel factor has to be 1/(255*std). It was computed as `(1.0 / stdvalue) * (1 / 255.0)`, but `double / Scalar` is Scalar's quaternion inverse, not an elementwise division, and `Scalar / Scalar` is defined through that same inverse. The last three elements were therefore conjugated and the whole result divided by their sum of squares, so with the default std = (0.229, 0.224, 0.225) the green and red planes reached the network negated and all three were about a third of the intended magnitude. Build the factor channel by channel in both create() overloads, and cover it with a test that compares the response of the network the tracker feeds against an identical network fed the documented normalization of the same template crop. | 14 天前 |