https://github.com/vinay0410/pedestrian_detection
Detects Pedestrians in images using HOG as a feature extractor and SVM for classification
https://github.com/vinay0410/pedestrian_detection
computer-vision detects-pedestrians hog-features human-detection human-detection-algorithm pedestrian-detection person-detection svm
Last synced: 24 days ago
JSON representation
Detects Pedestrians in images using HOG as a feature extractor and SVM for classification
- Host: GitHub
- URL: https://github.com/vinay0410/pedestrian_detection
- Owner: vinay0410
- License: gpl-3.0
- Created: 2017-08-28T14:30:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T13:59:28.000Z (over 2 years ago)
- Last Synced: 2025-03-26T22:51:18.371Z (about 1 month ago)
- Topics: computer-vision, detects-pedestrians, hog-features, human-detection, human-detection-algorithm, pedestrian-detection, person-detection, svm
- Language: Python
- Homepage:
- Size: 2.61 MB
- Stars: 74
- Watchers: 5
- Forks: 25
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pedestrian Detection
**Note:** The code provided may not be compatible with python3. A migration to python3 is in the pipeline.
## Dependencies
* OpenCV
* scikit-image ```pip install scikit-image==0.14.1```
* scikkit-learn ```pip install scikit-learn==0.20.2```## Running Detection
To test on images, simply run, `python detectmulti.py -i `
For example, `python detectmulti.py -i sample_images/pedestrian.jpg`
For more options run, `python detectmulti.py -h`
Following are some examples,


## Training
This code is meant for Training a Pedestrian Detector using [INRIA Person Dataset](http://pascal.inrialpes.fr/data/human/).
**Note:** If the above link doesn't work, then the above dataset can be downloaded from [here](https://drive.google.com/file/d/14GD_pBpBsprPiZlkmtXN_y5K72To16if/view?usp=sharing).Download, Uncompress and place it in the root of this repository.
Then just run:
```
sudo sh fixpng.sh # To fix the broken png files in this dataset.
```
**Note:** *The above step is necessary to fix the broken pngs in the dataset, without running this the classifer won't be correctly trained.*To train just run:
```
python train.py --pos --neg
```
For INRIA dataset, this would be probably,
```
python train.py --pos INRIAPerson/train_64x128_H96/pos --neg INRIAPerson/train_64x128_H96/neg
```After training, two new files would be created, namely, `person.pkl` and `person_final.pkl`. The former is the pre eliminary detector and the latter is the improved (hard negatively mined) detector.
### Note on Training:
Training can use high amounts of memory, so be sure to have a swap space in case of RAM overflows. Also, memory consumption can be reduced by decreasing the maximum number of hard negative windows to be mined. This is defined by the `MAX_HARD_NEGATIVES` global variable in `train.py`.## Testing
After successful training just run:
```
python test.py --pos --neg
```
For INRIA dataset, this would be probably,
```
python test.py --pos INRIAPerson/test_64x128_H96/pos --neg INRIAPerson/test_64x128_H96/neg
```This would print `True Positives`, `True Negatives`, `False Positives`, `False Negatives`, `Precision`, `Recall` and `F1 Score`.