opencv/samples/python
lpylpy0514 70d7e83dca
Merge pull request #24201 from lpylpy0514:4.x
VIT track(gsoc realtime object tracking model) #24201

Vit tracker(vision transformer tracker) is a much better model for real-time object tracking. Vit tracker can achieve speeds exceeding nanotrack by 20% in single-threaded mode with ARM chip, and the advantage becomes even more pronounced in multi-threaded mode. In addition, on the dataset, vit tracker demonstrates better performance compared to nanotrack. Moreover, vit trackerprovides confidence values during the tracking process, which can be used to determine if the tracking is currently lost.
opencv_zoo: https://github.com/opencv/opencv_zoo/pull/194
opencv_extra: [https://github.com/opencv/opencv_extra/pull/1088](https://github.com/opencv/opencv_extra/pull/1088)

# Performance comparison is as follows:
NOTE: The speed below is tested by **onnxruntime** because opencv has poor support for the transformer architecture for now.

ONNX speed test on ARM platform(apple M2)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| nanotrack| 5.25| 4.86| 4.72| 4.49|
| vit tracker| 4.18| 2.41| 1.97| **1.46 (3X)**|

ONNX speed test on x86 platform(intel i3 10105)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| nanotrack|3.20|2.75|2.46|2.55|
| vit tracker|3.84|2.37|2.10|2.01|

opencv speed test on x86 platform(intel i3 10105)(ms):
| thread nums | 1| 2| 3| 4|
|--------|--------|--------|--------|--------|
| vit tracker|31.3|31.4|31.4|31.4|

preformance test on lasot dataset(AUC is the most important data. Higher AUC means better tracker):

|LASOT | AUC| P| Pnorm|
|--------|--------|--------|--------|
| nanotrack| 46.8| 45.0| 43.3|
| vit tracker| 48.6| 44.8| 54.7|

[https://youtu.be/MJiPnu1ZQRI](https://youtu.be/MJiPnu1ZQRI)
 In target tracking tasks, the score is an important indicator that can indicate whether the current target is lost. In the video, vit tracker can track the target and display the current score in the upper left corner of the video. When the target is lost, the score drops significantly. While nanotrack will only return 0.9 score in any situation, so that we cannot determine whether the target is lost.

### 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
- [ ] 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2023-09-19 15:36:38 +03:00
..
tutorial_code Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-12-11 15:18:57 +00:00
_coverage.py python: 'cv2.' -> 'cv.' via 'import cv2 as cv' 2017-12-11 13:46:55 +03:00
_doc.py Define execfile, file, long, raw_input, xrange for Python 3 2018-05-03 09:19:05 +02:00
_run_winpack_demo.cmd samples: update Python launcher (winpack) 2018-11-15 23:36:26 +00:00
.gitignore rename samples/{python2 -> python} 2015-12-18 11:00:32 +03:00
aruco_detect_board_charuco.py Update aruco_detect_board_charuco.py 2023-05-05 13:23:09 -04:00
asift.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
audio_spectrogram.py Merge pull request #20934 from SinM9:spectrogram_samples 2021-12-14 17:33:26 +00:00
browse.py fix pylint warnings 2019-10-16 18:49:33 +03:00
calibrate.py Reworked calibrate.py 2023-06-23 22:19:08 +03:00
camera_calibration_show_extrinsics.py Update python samples 2022-01-24 11:13:56 +03:00
camshift.py Fixed Typo Closes #15148 2019-08-19 22:52:00 +05:30
CMakeLists.txt rename samples/{python2 -> python} 2015-12-18 11:00:32 +03:00
coherence.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
color_histogram.py fix pylint warnings 2019-10-16 18:49:33 +03:00
common.py Update python samples 2022-01-24 11:13:56 +03:00
contours.py Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2019-03-22 19:31:31 +03:00
deconvolution.py Fix spelling typos 2019-12-27 12:46:53 +00:00
demo.py build: updates for winpack dldt 2020-03-31 22:18:21 +00:00
dft.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
digits_adjust.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
digits_video.py Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-01-31 12:53:45 +00:00
digits.py Update python samples 2022-01-24 11:13:56 +03:00
dis_opt_flow.py pylint: eliminate warnings 2019-11-01 18:59:35 +03:00
distrans.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
drawing.py Merge pull request #14107 from adityak2920:aditya 2020-02-20 15:41:55 +03:00
edge.py fix pylint warnings 2019-10-16 18:49:33 +03:00
essential_mat_reconstr.py Merge pull request #17683 from ivashmak:homography 2020-08-14 22:42:26 +00:00
facedetect.py Update python samples 2022-01-24 11:13:56 +03:00
feature_homography.py python: 'cv2.' -> 'cv.' via 'import cv2 as cv' 2017-12-11 13:46:55 +03:00
find_obj.py prevent index error in find_obj sample 2021-12-23 11:29:27 +03:00
fitline.py fix pylint warnings 2019-10-16 18:49:33 +03:00
floodfill.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
gabor_threads.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
gaussian_mix.py fix samples 2021-07-01 18:26:17 +03:00
grabcut.py Minor update in grabcut.py 2020-02-20 16:19:24 +03:00
hist.py fix samples 2021-07-01 18:26:17 +03:00
houghcircles.py Update python samples 2021-02-21 23:02:16 +03:00
houghlines.py fix pylint warnings 2019-10-16 18:49:33 +03:00
inpaint.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
kalman.py Merge pull request #20564 from AleksandrPanov:update_kalman_sample 2021-08-20 10:57:05 +00:00
kmeans.py fix pylint warnings 2019-10-16 18:49:33 +03:00
laplace.py Merge pull request #14107 from adityak2920:aditya 2020-02-20 15:41:55 +03:00
lappyr.py fix pylint warnings 2019-10-16 18:49:33 +03:00
letter_recog.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
lk_homography.py fix samples 3.4 2021-06-30 12:50:21 +03:00
lk_track.py fix samples 3.4 2021-06-30 12:50:21 +03:00
logpolar.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
morphology.py fix samples 2021-07-01 18:26:17 +03:00
mosse.py python: 'cv2.' -> 'cv.' via 'import cv2 as cv' 2017-12-11 13:46:55 +03:00
mouse_and_match.py Merge pull request #23108 from crackwitz:issue-23107 2023-01-09 09:55:31 +00:00
mser.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
opencv_version.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
opt_flow.py fix pylint warnings 2019-10-16 18:49:33 +03:00
peopledetect.py fix pylint warnings 2019-10-16 18:49:33 +03:00
plane_ar.py Misc. ./samples typos 2018-02-08 05:52:08 -05:00
plane_tracker.py python: 'cv2.' -> 'cv.' via 'import cv2 as cv' 2017-12-11 13:46:55 +03:00
qrcode.py Added Aruco-based QR code detection method to python sample. 2023-06-13 15:38:26 +03:00
squares.py Update samples 2019-09-20 18:03:26 +03:00
stereo_match.py fix pylint warnings 2019-10-16 18:49:33 +03:00
stitching_detailed.py add GraphCutSeamFinder 2023-01-03 22:45:49 +01:00
stitching.py pylint: eliminate warnings 2019-11-01 18:59:35 +03:00
text_skewness_correction.py Update python samples 2022-01-24 11:13:56 +03:00
texture_flow.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
tracker.py Merge pull request #24201 from lpylpy0514:4.x 2023-09-19 15:36:38 +03:00
tst_scene_render.py Merge pull request #24116 from chaebkimm/update-samples-python-tst_scene_render 2023-08-09 13:46:25 +03:00
turing.py fix pylint warnings 2019-10-16 18:49:33 +03:00
video_threaded.py fix pylint warnings 2019-10-16 18:49:33 +03:00
video_v4l2.py fix samples 3.4 2021-06-30 12:50:21 +03:00
video.py Removed deprecated 'clock' import. 2019-12-30 13:00:29 +00:00
videocapture_obsensor.py Merge pull request #23531 from kaingwade:orbbec_python_sample 2023-04-24 12:12:01 +03:00
watershed.py samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00