uchidama / MNIST-TrainDataForYOLO

Make MNIST train data for YOLO.
MIT License
20 stars 9 forks source link

# MNIST-Train Data For YOLO

https://gyazo.com/d9895f31d70a2819e6322e4704c5adb0

This software generats MNIST-Train Data For YOLO.

Installation

Install Keras

This software using Keras.

If you want to run without to think keras and backend deeplearning frameworks, enter this command.

pip install tensorflow
pip install keras

Install Darknet YOLO

git clone https://github.com/pjreddie/darknet
cd darknet
make

How to use

Generate MNIST Train Data

  1. generat MNIST images and labels.
python mnist_to_jpg_and_label.py
  1. generate train.txt and test.txt
    python generate_train_txt_and_test_txt.py

Training YOLO on MNIST

  1. Copy files to darknet

    cp cfg/tiny-yolo-mnist.cfg <darknet_dir>/cfg
    cp cfg/voc-mnist.data <darknet_dir>/cfg
    cp data/voc-mnist.names <darknet_dir>/data
  2. Modify train and test data path. Edit /cfg/voc-mnist.data

    train  = <path-to-mnist-train>/train.txt
    valid  = <path-to-mnist-test>/test.txt
  3. Download Pretrained Convolutional Weights

    cd <darknet_dir>
    wget https://pjreddie.com/media/files/darknet19_448.conv.23
  4. Make directory to save trained model.

    mkdir backup
  5. Train The Model

    ./darknet detector train cfg/voc-mnist.data cfg/tiny-yolo-mnist.cfg darknet19_448.conv.23

    Predict MNIST test data

https://gyazo.com/3649c293e3e718aa11af32e59d4897a4

./darknet detector test <data file> <cfg file> <weights> <predict image>  

ex. command.

./darknet detector test cfg/voc-mnist.data cfg/tiny-yolo-mnist.cfg weights/tiny-yolo-mnist_500000.weights ~/MNIST-TrainDataForYOLO/JPEGImages/60015.jpg

MNIST Trained Weights

weights/tiny-yolo-mnist_500000.weights

License

MIT

Link

YOLO: Real-Time Object Detection