- [Description of Random Situation](#description-of-random-situation)
- [ModelZoo Homepage](#modelzoo-homepage)
# [YOLOv3-DarkNet53 Description](#contents)
You only look once (YOLO) is a state-of-the-art, real-time object detection system. YOLOv3 is extremely fast and accurate.
@ -33,13 +32,12 @@ YOLOv3 uses a few tricks to improve training and increase performance, including
[Paper](https://pjreddie.com/media/files/papers/YOLOv3.pdf): YOLOv3: An Incremental Improvement. Joseph Redmon, Ali Farhadi,
University of Washington
# [Model Architecture](#contents)
YOLOv3 use DarkNet53 for performing feature extraction, which is a hybrid approach between the network used in YOLOv2, Darknet-19, and that newfangled residual network stuff. DarkNet53 uses successive 3 × 3 and 1 × 1 convolutional layers and has some shortcut connections as well and is significantly larger. It has 53 convolutional layers.
# [Dataset](#contents)
Note that you can run the scripts based on the dataset mentioned in original paper or widely used in relevant domain/network architecture. In the following sections, we will introduce how to run the scripts using the related dataset below.
After installing MindSpore via the official website, you can start training and evaluation in as follows. If running on GPU, please add `--device_target=GPU` in the python command or use the "_gpu" shell script ("xxx_gpu.sh").
```
```network
# The darknet53_backbone.ckpt in the follow script is got from darknet53 training like paper.
# pretrained_backbone can use src/convert_weight.py, convert darknet53.conv.74 to mindspore ckpt, darknet53.conv.74 can get from `https://pjreddie.com/media/files/darknet53.conv.74` .
# The parameter of training_shape define image shape for network, default is "".
@ -78,7 +73,10 @@ python train.py \
--data_dir=./dataset/coco2014 \
--pretrained_backbone=darknet53_backbone.ckpt \
--is_distributed=0 \
--lr=0.1 \
--lr=0.001 \
--loss_scale=1024 \
--sens=1024 \
--weight_decay=0.016 \
--T_max=320 \
--max_epoch=320 \
--warmup_epochs=4 \
@ -104,12 +102,11 @@ python eval.py \
sh run_eval.sh dataset/coco2014/ checkpoint/0-319_102400.ckpt
```
# [Script Description](#contents)
## [Script and Sample Code](#contents)
```
```contents
.
└─yolov3_darknet53
├─README.md
@ -138,10 +135,9 @@ sh run_eval.sh dataset/coco2014/ checkpoint/0-319_102400.ckpt
└─train.py # train net
```
## [Script Parameters](#contents)
```
```parameters
Major parameters in train.py as follow.
optional arguments:
@ -179,6 +175,8 @@ optional arguments:
Whether to use label smooth in CE. Default:0
--label_smooth_factor LABEL_SMOOTH_FACTOR
Smooth strength of original one-hot. Default: 0.1
--sens SENS
Static sens. Default: 1024
--log_interval LOG_INTERVAL
Logging interval steps. Default: 100
--ckpt_path CKPT_PATH
@ -202,18 +200,19 @@ optional arguments:
Resize rate for multi-scale training. Default: None
```
## [Training Process](#contents)
### Training
```
```command
python train.py \
--data_dir=./dataset/coco2014 \
--pretrained_backbone=darknet53_backbone.ckpt \
--is_distributed=0 \
--lr=0.1 \
--lr=0.001 \
--loss_scale=1024 \
--sens=1024 \
--weight_decay=0.016 \
--T_max=320 \
--max_epoch=320 \
--warmup_epochs=4 \
@ -225,7 +224,7 @@ The python command above will run in the background, you can view the results th
After training, you'll get some checkpoint files under the outputs folder by default. The loss value will be achieved as follows:
@ -238,39 +237,41 @@ The model checkpoint will be saved in outputs directory.
### Distributed Training
For Ascend device, distributed training example(8p) by shell script
```
```command
sh run_distribute_train.sh dataset/coco2014 darknet53_backbone.ckpt rank_table_8p.json
```
For GPU device, distributed training example(8p) by shell script
```
```command
sh run_distribute_train_gpu.sh dataset/coco2014 darknet53_backbone.ckpt
```
The above shell script will run distribute training in the background. You can view the results through the file `train_parallel[X]/log.txt`. The loss value will be achieved as follows:
Before running the command below. If running on GPU, please add `--device_target=GPU` in the python command or use the "_gpu" shell script ("xxx_gpu.sh").
```
```command
python eval.py \
--data_dir=./dataset/coco2014 \
--pretrained=yolov3.ckpt \
@ -281,7 +282,7 @@ sh run_eval.sh dataset/coco2014/ checkpoint/0-319_102400.ckpt
The above python command will run in the background. You can view the results through the file "log.txt". The mAP of the test dataset will be as follows:
```
```eval log
# log.txt
=============coco eval reulst=========
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.311
@ -298,8 +299,8 @@ The above python command will run in the background. You can view the results th
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.551
```
# [Model Description](#contents)
## [Performance](#contents)
### Evaluation Performance
@ -322,7 +323,6 @@ The above python command will run in the background. You can view the results th
| Checkpoint for Fine tuning | 474M (.ckpt file) | 474M (.ckpt file) |