object-detector-master
所属分类:图形图像处理
开发工具:Python
文件大小:225KB
下载次数:12
上传日期:2018-10-24 16:03:45
上 传 者:
misology
说明: 传统的目标检测算法使用python实现,包括训练和测试部分
(The traditional target detection algorithm is implemented by python.)
文件列表:
LICENSE (1090, 2015-07-23)
bin (0, 2015-07-23)
bin\test-object-detector (1056, 2015-07-23)
data (0, 2015-07-23)
data\config (0, 2015-07-23)
data\config\config.cfg (281, 2015-07-23)
data\images (0, 2015-07-23)
data\images\test-im-1-nms.png (26068, 2015-07-23)
data\images\test-im-1.png (23631, 2015-07-23)
data\images\test-im-2-nms.png (25332, 2015-07-23)
data\images\test-im-2.png (23078, 2015-07-23)
data\images\test-im-3-nms.png (13504, 2015-07-23)
data\images\test-im-3.png (12919, 2015-07-23)
data\images\test-im-4-nms.png (39354, 2015-07-23)
data\images\test-im-4.png (37420, 2015-07-23)
data\models (0, 2015-07-23)
data\models\svm.model (605, 2015-07-23)
data\models\svm.model_01.npy (96, 2015-07-23)
data\models\svm.model_02.npy (19520, 2015-07-23)
data\models\svm.model_03.npy (88, 2015-07-23)
object-detector (0, 2015-07-23)
object-detector\__init__.py (136, 2015-07-23)
object-detector\config.py (735, 2015-07-23)
object-detector\extract-features.py (2205, 2015-07-23)
object-detector\nms.py (3119, 2015-07-23)
object-detector\test-classifier.py (4480, 2015-07-23)
object-detector\train-classifier.py (1655, 2015-07-23)
# object-detector
Object Detector using HOG as descriptor and Linear SVM as classifier. | [Video](https://www.youtube.com/watch?v=SPXocFBjr70)
## Run the code
I have created a single python script that can be used to test the code. To test the code, run the lines below in your terminal.
```shell
git clone https://github.com/bikz05/object-detector.git
cd object-detector/bin
test-object-detector
```
_The `test-object-detector` will download the [UIUC Image Database for Car Detection](https://cogcomp.cs.illinois.edu/Data/Car/) and train a classifier to detect cars in an image. The SVM model files will be stored in `data/models`, so that they can be resused later on._
### Configuration File
All the configurations are in the `data/config/config.cfg` configuration files. You can change it as per your need. Here is what the default configuration file looks like (which I have set for Car Detector)-
```bash
[hog]
min_wdw_sz: [100, 40]
step_size: [10, 10]
orientations: 9
pixels_per_cell: [8, 8]
cells_per_block: [3, 3]
visualize: False
normalize: True
[nms]
threshold: .3
[paths]
pos_feat_ph: ../data/features/pos
neg_feat_ph: ../data/features/neg
model_path: ../data/models/svm.model
```
### About the modules
* `extract-features.py` -- This module is used to extract HOG features of the training images.
* `train-classifier.py` -- This module is used to train the classifier.
* `nms.py` -- This module performs Non Maxima Suppression.
* `test-classifier.py` -- This module is used to test the classifier using a test image.
* `config.py` -- Imports the configuration variables from `config.cfg`.
## Some of the results
#### Test Image 1
_Detections before NMS_
![Image 1](data/images/test-im-1.png)
_Detections after NMS_
![](data/images/test-im-1-nms.png)
#### Test Image 2
_Detections before NMS_
![](data/images/test-im-2.png)
_Detections after NMS_
![](data/images/test-im-2-nms.png)
#### Test Image 3
_Detections before NMS_
![](data/images/test-im-3.png)
_Detections after NMS_
![](data/images/test-im-3-nms.png)
#### Test Image 4
_Detections before NMS_
![](data/images/test-im-4.png)
_Detections after NMS_
![](data/images/test-im-4-nms.png)
## TODO
Here is list of tasks that I am planning to implement in the future -
* Optimize code to use more `numpy` vectorized codes.
* Faster NMS code.
* Add bootstrapping (Hard Negative Mining) code.
## Useful tutorials
1. [Histogram of Oriented Gradients and Object Detection](http://www.pyimagesearch.com/2014/11/10/histogram-oriented-gradients-object-detection/)
2. [Image Pyramids with Python and OpenCV](http://www.pyimagesearch.com/2015/03/16/image-pyramids-with-python-and-opencv/)
3. [Sliding Windows for Object Detection with Python and OpenCV](http://www.pyimagesearch.com/2015/03/23/sliding-windows-for-object-detection-with-python-and-opencv/)
4. [Non-Maximum Suppression for Object Detection in Python](http://www.pyimagesearch.com/2014/11/17/non-maximum-suppression-object-detection-python/)
5. [(Faster) Non-Maximum Suppression in Python](http://www.pyimagesearch.com/2015/02/16/faster-non-maximum-suppression-python/)
6. [Texture Matching using Local Binary Patterns (LBP), OpenCV, scikit-learn and Python](http://hanzratech.in/2015/05/30/local-binary-patterns.html)
7. [Deteccin de objetos Course by Coursera](https://www.coursera.org/course/deteccionobjetos)
近期下载者:
相关文件:
收藏者: