-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of CSR-DCF tracker #1552
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
Could you add some simple test (to check that this code doesn't crash and return non-empty result)?
modules/tracking/samples/csrt.cpp
Outdated
@@ -0,0 +1,187 @@ | |||
/*M/////////////////////////////////////////////////////////////////////////////////////// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In OpenCV we usually don't add license header to sample code.
modules/tracking/samples/csrt.cpp
Outdated
using namespace std; | ||
using namespace cv; | ||
|
||
#include <chrono> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chrono
is C++11 header.
Consider using cv::getTickCount()
call or TickMeter
.
modules/tracking/src/trackerCSRT.cpp
Outdated
|
||
#include <math.h> | ||
|
||
#include "opencv2/highgui.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it really required?
modules/tracking/src/trackerCSRT.cpp
Outdated
@@ -0,0 +1,779 @@ | |||
/*/////////////////////////////////////////////////////////////////////////////////////// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use short OpenCV license header.
#ifndef OPENCV_TRACKER_CSRT_SCALE_ESTIMATION | ||
#define OPENCV_TRACKER_CSRT_SCALE_ESTIMATION | ||
|
||
#include "precomp.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
precomp.hpp
:
- must be included from module's cpp files only (remove it from .hpp files)
- must be the first include in module's .cpp files (please add it there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, though there seem to be trackers/files, already included in tracking module, that include precomp.hpp in their header file. (e.g. modules/tracking/src/tldDetector.hpp). Is there a reason for this?
Histogram hist_target, Histogram hist_background, int numBinsPerChannel) | ||
{ | ||
//preprocess and normalize all data | ||
assert(imgChannels.size() > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using CV_Assert()
instead.
myfile.close(); | ||
} | ||
|
||
#define pvar(obj) std::cout << "; " << #obj << " > " << obj << "\t call@: " << __func__ << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid using of 'tab' symbols in code.
modules/tracking/src/trackerCSRT.cpp
Outdated
Mat TrackerCSRTImpl::calculate_response(const Mat &image, const std::vector<Mat> filter) | ||
{ | ||
Mat patch = get_subwindow(image, object_center, floor(current_scale_factor * template_size.width), | ||
floor(current_scale_factor * template_size.height)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using OpenCV calls:
- floor() -> cvFloor()
- ceil() -> cvCeil()
- round() -> cvRound()
Thanks for the comments! I think I've fixed most of the problems you've pointed out. Except for the simple test part. Do you want me to add this tracker to 'test_trackers.cpp' or do you want me to send you a few or the tracking sequences, that I use for testing, together with a make file to build and test this? |
Thank you! I believe it is enough to add this tracker to 'test_trackers.cpp'. Adding new datasets (tracking sequences) into OpenCV repositories requires testdata approval (license), so it is better to reuse existing testdata (anyway you could add an external link on your dataset into Pull request description or documentation). |
Looks better, Please take a look on current build issues on Windows/Android builders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
Looks good to me 👍
@amuhic I know this pull request got merged a long time ago, but would it be possible to follow this up with more documentation and comments? The tracker has a lot of parameters and (at least to me) it is not obvious what they do or how to tune them, even after reading the paper. |
I created a draft pull request (#3300). Could someone help me improve it? |
This pullrequest implements CSR-DCF tracker based on:
http://prints.vicos.si/publications/355
http://prints.vicos.si/publications/files/355
I also have one question. In modules/tracking/src/trackerCSRTUtils.cpp, I've copied function:
void computeHOG32D(const Mat &imageM, Mat &featM, const int sbin, const int pad_x, const int pad_y)
from modules/dpm/src/dpm_feature.cpp (with some minor changes). This was mostly used for testing purposes, to see whether this implementation of FHOG could be used in this tracker. I'm asking for your advice on how to go on about this. I'm assuming that a dependency for dpm module should be added to tracking module and then use that function directly.