English | 简体中文
This tutorial fine-tunes a tiny dataset by pretrained detection model for users to get a model and learn PaddleDetection quickly. The model can be trained in around 20min with good performance.
- Note: before started, need to set PYTHONPATH and specifiy the GPU device as follows in Linux platform. For Windows users, also need to set PYTHONPATH correctly.
export PYTHONPATH=$PYTHONPATH:.
export CUDA_VISIBLE_DEVICES=0
Dataset refers to Kaggle, which contains 240 images in train dataset and 60 images in test dataset. Data categories are apple, orange and banana. Download here and uncompress the dataset after download, script for data preparation is located at download_fruit.py. Command is as follows:
python dataset/fruit/download_fruit.py
Training:
python -u tools/train.py -c configs/yolov3_mobilenet_v1_fruit.yml \
--use_tb=True \
--tb_log_dir=tb_fruit_dir/scalar \
--eval
Use yolov3_mobilenet_v1
to fine-tune the model from COCO dataset. Meanwhile, loss and mAP can be observed on tensorboard.
tensorboard --logdir tb_fruit_dir/scalar/ --host <host_IP> --port <port_num>
Result on tensorboard is shown below:
Model can be downloaded here
Evaluation:
python -u tools/eval.py -c configs/yolov3_mobilenet_v1_fruit.yml
Inference:
python -u tools/infer.py -c configs/yolov3_mobilenet_v1_fruit.yml \
-o weights=https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar \
--infer_img=demo/orange_71.jpg
Inference images are shown below:
For detailed infomation of training and evalution, please refer to GETTING_STARTED.md.