2013年12月28日 星期六

Hog Pca Svm Slider Nms in C++

Refer to: http://fatalfeel.blogspot.com/2013/12/opencv-and-dlib-training.html

1. Preinstall:
opencv 3.4.16
https://opencv.org/releases
dlib 2022-03-22 21:32:14 sha1: 5cb036564c986fcc45eb16dd0174b1602ceb4f7f
https://github.com/davisking/dlib.git 

both make install to /opt

2. eclipse (option)
sudo apt install openjdk-8-jdk 
Luna Service Release 2 + cdt
https://www.eclipse.org/downloads/packages/release/luna/sr2

run it as root

3.
git clone --recursive https://github.com/fatalfeel/hog_pca_svm_slider_nms_cpp
cd hog_pca_svm_slider_nms_cpp
make 
./hog_pca_svm_train

4.
you can adjust follows
(a) s_thread_num depend on you cpu
(b) all u+=4 is fhog_features step, normally the planar_hog size is 31 float matrix
for(uint32_t u=0; u<planar_hog.size(); u+=4) //we don't need all size() 31 features so k+=4
{
    cv::Mat cMat = toMat(planar_hog[u]);
    gradient_lst.push_back(cMat.clone());
}
(c) int nEigens = train_gradients[0].rows * train_gradients[0].cols / 4;
      downsample devide by 4,  related to u+=4 nEigens can be smaller.
(d) thres_hold
(e) svm->setGamma(0.55); //lower more boxes
(f)  svm->setC(1.5); //lower more boxes


////////////////////////////////////paper////////////////////////////////////
https://www.researchgate.net/publication/262987479_Efficient_eye_detection_using_HOG-PCA_descriptor
https://zkxb.jsu.edu.cn/CN/10.13438/j.cnki.jdzk.2018.05.006

////////////////////////////////////basic theory/////////////////////////////////////
~~~linear equation use inverse matrix to solve~~~
https://www.youtube.com/watch?v=VQtGRXCg95k
linear svm
http://debussy.im.nuu.edu.tw/sjchen/Project_Courses/ML/SVM.pdf
https://www.youtube.com/watch?v=5RAbftC5CN0
https://blog.dominodatalab.com/fitting-support-vector-machines-quadratic-programming
kkt formula
https://ccjou.wordpress.com/2017/02/07/karush-kuhn-tucker-kkt-%E6%A2%9D%E4%BB%B6
smo solver
The sequential minimal optimization by John C. Platt is the fasted algorithm to solve such a problem. It does not optimize all Lagrange multipliers at once. In a loop it runs through all samples and picks just 2 multipliers at a time.
http://www.mosismath.com/AI/SMO.html
https://www.researchgate.net/publication/305259797_Tutorial_on_Support_Vector_Machine
https://blog.csdn.net/v_july_v/article/details/7624837
https://www.math.pku.edu.cn/teachers/ganr/course/pr2010/Ref/platt_smoTR.pdf
https://cs229.stanford.edu/materials/smo.pdf
https://chubakbidpaa.com/svm/2020/12/27/smo-algorithm-simplifed-copy.html
example code
https://www.mediafire.com/file/a5ggqgk6tu4anyy/qp_solver.tar.xz
https://www.mediafire.com/file/01eha5ey6yvvv3p/girl_boy_svm.py
https://www.mediafire.com/file/408s6cu57r8nroq/svm_rbf.tar.gz
https://github.com/LasseRegin/SVM-w-SMO/tree/master
~~~pca~~~
https://www.youtube.com/watch?v=iwh5o_M4BNU
~~~hog pca svm slider car detection python~~~
https://github.com/fatalfeel/hog_pca_svm_detection

沒有留言:

張貼留言