DOTA_YOLOv2 provides the data convertion code, parameter files while training DOTA using YOLOv2, and the trained model is also provided. So it's convenient for you to use them.
Our code is tested on official darknet@(commit f6d8617) with cuda-8.0 and cudnn-6.0 on Ubuntu 16.04.1 LTS.
- install darknet
See Installing Darknet for instructions. - development kit
The Development kit provides the following functions. You can easily install it following the instructions.
- Load and visulize the data.
- Evaluate the result.
- Split and merge the picture and label.
-
Get the DOTA Dataset
-
Convert the Label Format
In DOTA, the annotation format is:x1 y1 x2 y2 x3 y3 x4 y4 category difficult
While Darknet wants a .txt file for each image with a line for each ground truth object in the image that looks like:
category-id x y width height
Where x, y, width, and height are relative to the image's width and height. Here, you can refer to data_transform/YOLO_Transform.py to convert the format.
Note that this code is for the image of size 1024*1024. If not, you should modify it accroding to your image size. For DOTA, you can refer to DOTA_devkit/ImgSplit.py to split the images and labels.
-
Train the Model
wget https://pjreddie.com/media/files/darknet19_448.conv.23 sh train-dota.sh
-
Evaluate the Results
You can download the pre-trained model on DOTA from Baidu Drive or Google Drive, and use it to test all the test images.sh valid-dota.sh
Then you will obtain 15 files stored in the
results/
subdirectory, and each file contains all the results for a specific category.Each file is in the following format:imgname score xmin ymin xmax ymax
If you have split the images before, please first use DOTA_devkit/ResultMerge.py to merge the results.
For DOTA, You can submit your results on the Evaluation Server for evaluation. See the official website of DOTA for details.