I have implemented a digit detector that applies yolo-v2 to svhn dataset.
- python 3.5
- anaconda 4.4.0
- tensorflow 1.2.1
- keras 2.1.1
- opencv 3.3.0
- imgaug
- Etc.
I recommend that you create and use an anaconda env that is independent of your project. You can create anaconda env for this project by following these simple steps. This process has been verified on Windows 10 and ubuntu 16.04.
$ conda create -n yolo python=3.5 anaconda=4.4.0
$ activate yolo # in linux "source activate yolo"
(yolo) $ pip install tensorflow==1.2.1
(yolo) $ pip install keras==2.1.1
(yolo) $ pip install opencv-python
(yolo) $ pip install imgaug
(yolo) $ pip install pytest-cov
(yolo) $ pip install codecov
(yolo) $ pip install -e .
In this project, the pretrained weight file is stored in weights.h5.
- Example code for predicting a digit region in a natural image is described in detection_example.ipynb.
- Training set evaluation (1000-images) is as follows:
- fscore / precision / recall: 0.799, 0.791, 0.807
This project provides a way to train digit detector from scratch. If you follow the command below, you can build a digit detector with just two images.
- First, train all layers through the following command.
project/root> python train.py -c configs/from_scratch.json
- Next, fine tune only the last layer through the following command.
project/root> python train.py -c configs/from_scratch2.json
- Finally, evaluate trained digit detector.
project/root> python evaluate.py -c configs/from_scratch.json -w svhn/weights.h5
- The evaluation results are output in the following manner.
{'fscore': 1.0, 'precision': 1.0, 'recall': 1.0}
- The prediction result images are saved in the
project/detected
directory.
Now you can add more images to train a digit detector with good generalization performance.
In this project, I use pascal voc format as annotation information to train object detector. An annotation file of this format can be downloaded from svhn-voc-annotation-format.
1. Raccoon dataset : https://github.com/experiencor/raccoon_dataset
- pretrained weight file is stored at raccoon
- training set evaluation (160-images)
- fscore / precision / recall: 0.937, 0.963, 0.913
- test set evaluation (40-images)
- fscore / precision / recall: 0.631, 0.75, 0.545
- See LICENSE for details.
- This project started at basic-yolo-keras. I refactored the source code structure of basic-yolo-keras and added the CI test. I also applied the SVHN dataset to implement the digit detector. Thanks to the Huynh Ngoc Anh for providing a good project as open source.