alanlukezic / csr-dcf

Discriminative Correlation Filter with Channel and Spatial Reliability
226 stars 73 forks source link

Performance tips #12

Open seovchinnikov opened 5 years ago

seovchinnikov commented 5 years ago

Hello! Thank you for your paper and code! I'm planning to read the paper in the next days, but now I've tested OpenCV implementation of the algorithm and I can say it works a way better than other algos for my videos. Can you please describe what params can I tune to increase fps rate but maybe sacrifice the precision. Also I have bg subtraction mask, maybe there is a way to utilize it inside the algorithm (with the code tweaks). OpenCV params are listed here: https://github.com/opencv/opencv_contrib/blob/6ef1983f0876fdf65083666d8e73abfecaf9d4f4/modules/tracking/src/trackerCSRT.cpp#L715

alanlukezic commented 5 years ago

Hi, nice to hear that the tracker works nice for you - btw, in what kind of an application do you use it? Speed can be boosted by reducing parameter template_size (from 200 to let's say 100), or by reducing admm_iterations (from 4 to 2). You can further boost the speed by not updating the filter in every frame (if the target you are tracking does not change much). You can do that by running the update part (trackerCSRT.cpp: lines 485-501) every few frames.

seovchinnikov commented 5 years ago

I'm using tracker for pedestrian tracking on some test videos with initial bbs generated by openpose. It works well. Thank you for the tips! I was able to reduce window size to 80 without visible lose of precision and it gives ~ 2x speed increase . I'll also try do some tweaks and call update part every nth frame. Thank you!

canozcivelek commented 4 years ago

Hi! I'm trying to achieve this as well. I'm using TrackerCSRT() as offered in OpenCV 4.1 which works great. So thank you for those who put much effort into developing the tracker. So I'm on an Nvidia Jetson Nano with Ubuntu 18.04 and have Python3.6 installed. I'm experimenting on object detection and tracking. The only issue is that the fps rates are the lowest on CSRT tracker. I tried to tweak the parameters as Alan suggested but couldn't get them to work. The way I'm doing is navigate to "opencv_contrib-4.1.0/modules/tracking/src/trackerCSRT.cpp" file, open it and tweak the parameters there. I suppose this won't work as the library was already installed and changes after that won't take effect? If so, what way should I make the changes so that it actually works? Thanks!

alanlukezic commented 4 years ago

After you make a modification in source (trackerCSRT.cpp) you have to re-compile the whole library (OpenCV+contrib). If you are using a pre-compiled version of OpenCV (e.g., the one installed using pip) the changes will not have an affect. Be sure that you enable Python support when compiling (see OpenCV documentation).

canozcivelek commented 4 years ago

Thank you very much for the quick response, means a lot! Also one last thing, do you think this tracker can be used with cuda to increase performance? Or it's not worth at all? Thanks again!

alanlukezic commented 4 years ago

I think that the current version of the algorithm would not benefit much of the GPU due to the handcrafted features (HoG and Colornames do not speed-up much on a graphic card).