Image on the left side was an input to detector.
On the right side is result with boxes indicating detected people.
For detection I used pretrained YOLOv3 model. It has been trained on COCO dataset with 80 possible classes. In my case, after detecting an object I check if label matches person class as I need only this one.
More information about YOLOv3 can be found here.
Image width and height are scaled to fit dimensions of model input. Then image is transformed to BLOB1.
As a dataset I chose Penn-Fudan Database for Pedestrian Detection and Segmentation.
"This is an image database containing images that are used for pedestrian detection [...]. The images are taken from scenes around campus and urban street. [...] Each image will have at least one pedestrian in it. [...] All labeled pedestrians are straight up."
You can detect people on some choosen images or all in selected directory.
- Prepare data directory with images (only .png and .jpg extensions are supported).
Default directory is calleddata
and is in the same level assrc
directory. - Prepare config for YOLOv3 model (configuration file, model weights and classes to be detected).
Default directory is calledconfig
and is underyolo
directory. - Go to
detector
directory and runpython main.py
(there are 4 possible arguments to set: data path, results path, model config path and which files should be pass to detector).
If you need any help, run python main.py --help
-
Detector can draw boxes for more than one person on image. Person can stay in shadow or even be turned. For an example input-output you can look at images at the beginning of this README.
-
Sometimes detector marks two people as one detected object.
Input on the left, output on the right side.
1 BLOB - Binary Large OBject - "A Blob is a group of connected pixels in an image that share some common property."