Skip to content

Commit 41052ea

Browse files
zihaomuSajjad Ali
authored andcommitted
Merge pull request opencv#22808 from zihaomu:nanotrack
[teset data in opencv_extra](opencv/opencv_extra#1016) NanoTrack is an extremely lightweight and fast object-tracking model. The total size is **1.1 MB**. And the FPS on M1 chip is **150**, on Raspberry Pi 4 is about **30**. (Float32 CPU only) With this model, many users can run object tracking on the edge device. The author of NanoTrack is @HonglinChu. The original repo is https://github.com/HonglinChu/NanoTrack. ### 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 - [ ] 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
1 parent ea7624b commit 41052ea

File tree

6 files changed

+655
-43
lines changed

6 files changed

+655
-43
lines changed

modules/video/include/opencv2/video/tracking.hpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,43 @@ class CV_EXPORTS_W TrackerDaSiamRPN : public Tracker
849849
//bool update(InputArray image, CV_OUT Rect& boundingBox) CV_OVERRIDE;
850850
};
851851

852+
/** @brief the Nano tracker is a super lightweight dnn-based general object tracking.
853+
*
854+
* Nano tracker is much faster and extremely lightweight due to special model structure, the whole model size is about 1.1 MB.
855+
* Nano tracker needs two models: one for feature extraction (backbone) and the another for localization (neckhead).
856+
* Please download these two onnx models at:https://github.com/HonglinChu/SiamTrackers/tree/master/NanoTrack/models/onnx.
857+
* Original repo is here: https://github.com/HonglinChu/NanoTrack
858+
* Author:HongLinChu, [email protected]
859+
*/
860+
class CV_EXPORTS_W TrackerNano : public Tracker
861+
{
862+
protected:
863+
TrackerNano(); // use ::create()
864+
public:
865+
virtual ~TrackerNano() CV_OVERRIDE;
866+
867+
struct CV_EXPORTS_W_SIMPLE Params
868+
{
869+
CV_WRAP Params();
870+
CV_PROP_RW std::string backbone;
871+
CV_PROP_RW std::string neckhead;
872+
CV_PROP_RW int backend;
873+
CV_PROP_RW int target;
874+
};
875+
876+
/** @brief Constructor
877+
@param parameters NanoTrack parameters TrackerNano::Params
878+
*/
879+
static CV_WRAP
880+
Ptr<TrackerNano> create(const TrackerNano::Params& parameters = TrackerNano::Params());
881+
882+
/** @brief Return tracking score
883+
*/
884+
CV_WRAP virtual float getTrackingScore() = 0;
885+
886+
//void init(InputArray image, const Rect& boundingBox) CV_OVERRIDE;
887+
//bool update(InputArray image, CV_OUT Rect& boundingBox) CV_OVERRIDE;
888+
};
852889

853890
//! @} video_track
854891

modules/video/misc/python/pyopencv_video.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
typedef TrackerMIL::Params TrackerMIL_Params;
33
typedef TrackerGOTURN::Params TrackerGOTURN_Params;
44
typedef TrackerDaSiamRPN::Params TrackerDaSiamRPN_Params;
5+
typedef TrackerNano::Params TrackerNano_Params;
56
#endif

0 commit comments

Comments
 (0)