]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Added check in complexmat to prevent double freeing data on same pointer. Also added...
authorShanigen <vkaraf@gmail.com>
Thu, 19 Apr 2018 15:18:47 +0000 (17:18 +0200)
committerShanigen <vkaraf@gmail.com>
Thu, 19 Apr 2018 15:18:47 +0000 (17:18 +0200)
dimensions for future use in cuda implementation.

src/complexmat.cu
src/complexmat.cuh
src/kcf.cpp
src/kcf.h

index 3b72c847109f9c6451b81c229acb5bfae696abbb..f3a3e5be476d0af5614b0d5852a74055495ef0e7 100644 (file)
@@ -264,6 +264,7 @@ void ComplexMat::operator=(ComplexMat & rhs)
     rows = rhs.rows;
     n_channels = rhs.n_channels;
     n_scales = rhs.n_scales;
+    foreign_data = true;
     
     p_data = rhs.p_data;
 }
index f59bb7c29cfad009d4ae353fc9eab69f888a7084..aa3dfe885b84f4a73e3402c7e8ff22a918e67ac3 100644 (file)
@@ -15,6 +15,7 @@ public:
     int rows;
     int n_channels;
     int n_scales = 1;
+    bool foreign_data = false;
     
     ComplexMat() : cols(0), rows(0), n_channels(0) {}
     ComplexMat(int _rows, int _cols, int _n_channels) : cols(_cols), rows(_rows), n_channels(_n_channels)
@@ -40,7 +41,7 @@ public:
     
     ~ComplexMat()
     {
-        if(p_data != nullptr){
+        if(p_data != nullptr && !foreign_data){
           CudaSafeCall(cudaFree(p_data));
           p_data = nullptr;
         }
index 1a3e1508bf4ad9bfbd8b2ae6b05c924f9a86bd21..29bd62db80e8f6b4c001201ace22819394961361 100644 (file)
@@ -136,6 +136,8 @@ void KCF_Tracker::init(cv::Mat &img, const cv::Rect & bbox)
     num_of_feats = 31;
     if(m_use_color) num_of_feats += 3;
     if(m_use_cnfeat) num_of_feats += 10;
+    poi_width = p_windows_size[0]/p_cell_size;
+    poi_height = p_windows_size[1]/p_cell_size;
     fft.init(p_windows_size[0]/p_cell_size, p_windows_size[1]/p_cell_size, num_of_feats, p_scales.size(), m_use_big_batch);
     p_yf = fft.forward(gaussian_shaped_labels(p_output_sigma, p_windows_size[0]/p_cell_size, p_windows_size[1]/p_cell_size));
     fft.set_window(cosine_window_function(p_windows_size[0]/p_cell_size, p_windows_size[1]/p_cell_size));
index 3ac7f669f3bff8d4c64467c9c0847b192af0d8e5..a95512ce1c7e468721cc60ede7da7e42687b98a0 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -108,6 +108,7 @@ private:
 
     //for big batch
     int num_of_feats;
+    int poi_height, poi_width;
     float *xf_sqr_norm = nullptr, *yf_sqr_norm = nullptr;
 #ifdef CUFFT
     float *xf_sqr_norm_d = nullptr, *yf_sqr_norm_d = nullptr;