/darknet-for-SCUT

Yolo for pedestrian detection task.

Primary LanguageCOtherNOASSERTION

Darknet Logo

Darknet

Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.

For more information see the Darknet project website.

For questions or issues please use the Google Group.

For Pedestrian Detection task

Darknet is available for training and testing on VOC and COCO datasets, this repo modified it for SCUT datasets. Use the same step, it also can training on Caltech and KAIST dataset.

1. Download data

Go to the SCUT download videos, annotations.zip and annotaions_vbb.zip to data/scut dir. Unzip all files, make sure the directory structure like this.

data/scut/
- videos/
    - set00/
        - V000.seq
        - V001.seq
        - V002.seq
    - set01/
        ...
    ...
- annotations/
    - set00/
        - V000.txt
        - V001.txt
        - V002.txt
    - set01/
        ...
    ...
- annotations_vbb/
    - set00/
        - V000.vbb
        - V001.vbb
        - V002.vbb
    - set01/
        ...
    ...

2. Download toolbox

The dataset has two toolbox. datatool is a matlab toolbox based on caltech toolbox. pydatatool is a python package for convert caltech style annotation to other style.

cd data/scut
git clone https://github.com/xzhewei/datatool.git
mkdir data-scut
ln -s <project-root>/data/scut/annoations ./
git clone https://github.com/xzhewei/pydatatool.git

Make & install pydatatool

cd pydatatool
make install

3. Convert dataset

Now we need to generate the label files that Darknet uses.

python scripts/vbb2yolo.py

After a few minutes, this script will generate all of the requisite files.

In cfg/scut.data, there some parameters the specific path.

classes= 6
train  = <path-to-scut>/train.txt
valid  = <path-to-scut>/test.txt
names = data/scut.names
backup = backup
results = results

4. Training

Download the pretrain weigth file.

cd cfg
wget https://pjreddie.com/media/files/darknet53.conv.74
cd ..

Training Yolov3 on SCUT dataset.

./darknet detector train cfg/scut.data cfg/yolov3-scut.cfg cfg/darknet53.conv.74 -gpus 0

5. Testing

Change the batch=1 in cfg/yolov3-scut.cfg, like this:

[net]
# Testing
batch=1
subdivisions=1
# Training
# batch=64
# subdivisions=16

And testing on

./darknet detector valid cfg/scut.data cfg/yolov3-scut.cfg backup/yolov3-scut_final.weights -gpus 0

After testing, the results directory will generate 6 files which is every class detection results.

comp4_det_test_people.txt
comp4_det_test_people?.txt
comp4_det_test_person?.txt
comp4_det_test_ride_person.txt
comp4_det_test_squat_person.txt
comp4_det_test_walk_person.txt

Run scripts/comp2res.py to convert the results file to caltech toolbox style. After convert it will evaluate by toolbox.

python scripts/comp2res.py --result results

6. Performance

The log-average miss rate on FPPI range in $10.^(-4:.25:0)$.

Method Reasonable Near Medium Far No-occlusion Occlusion Overall
YOLOv2 47.96% 26.70% 68.06% 88.48% 44.01% 62.35% 69.44%
YOLOv3 32.54% 18.14% 51.28% 82.22% 27.11% 52.53% 58.09%