README.md 2.8 KB
Newer Older
1
# DeeplabV3 Example
U
modify  
unknown 已提交
2

U
unknown 已提交
3
## Description
4
This is an example of training DeepLabV3 with PASCAL VOC 2012 dataset in MindSpore. 
U
modify  
unknown 已提交
5

U
unknown 已提交
6 7
## Requirements
- Install [MindSpore](https://www.mindspore.cn/install/en).
8
- Download the VOC 2012 dataset for training. 
9 10 11 12
  ``` bash
  python remove_gt_colormap.py --original_gt_folder GT_FOLDER --output_dir OUTPUT_DIR

  ```
U
modify  
unknown 已提交
13

U
unknown 已提交
14 15
> Notes: 
  If you are running a fine-tuning or evaluation task, prepare the corresponding checkpoint file.
U
modify  
unknown 已提交
16 17


U
unknown 已提交
18 19 20 21 22
## Running the Example
### Training
- Set options in config.py.
- Run `run_standalone_train.sh` for non-distributed training.
	``` bash 
U
unknown 已提交
23
	sh scripts/run_standalone_train.sh DEVICE_ID DATA_PATH
U
unknown 已提交
24 25 26
	```
- Run `run_distribute_train.sh` for distributed training.
	``` bash
U
unknown 已提交
27
	sh scripts/run_distribute_train.sh MINDSPORE_HCCL_CONFIG_PATH DATA_PATH
U
unknown 已提交
28 29
	```
### Evaluation
U
modify  
unknown 已提交
30
Set options in evaluation_config.py. Make sure the 'data_file' and 'finetune_ckpt' are set to your own path.
U
unknown 已提交
31 32
- Run run_eval.sh for evaluation.
	``` bash
U
unknown 已提交
33
	sh scripts/run_eval.sh DEVICE_ID DATA_PATH PRETRAINED_CKPT_PATH
U
unknown 已提交
34
	```
U
modify  
unknown 已提交
35

U
unknown 已提交
36
## Options and Parameters
37
It contains of parameters of DeeplabV3 model and options for training, which is set in file config.py.
U
modify  
unknown 已提交
38

U
unknown 已提交
39 40
### Options:
```
U
modify  
unknown 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
config.py:
    learning_rate                   Learning rate, default is 0.0014.
    weight_decay                	Weight decay, default is 5e-5.
    momentum                    	Momentum, default is 0.97.
    crop_size                       Image crop size [height, width] during training, default is 513.
    eval_scales                     The scales to resize images for evaluation, default is [0.5, 0.75, 1.0, 1.25, 1.5, 1.75].
	output_stride					The ratio of input to output spatial resolution, default is 16.
	ignore_label					Ignore label value,	default is 255.
	seg_num_classes					Number of semantic classes, including the background class (if exists). 
									foreground classes + 1 background class in the PASCAL VOC 2012 dataset, default is 21.
	fine_tune_batch_norm			Fine tune the batch norm parameters or not, default is False.
	atrous_rates					Atrous rates for atrous spatial pyramid pooling, default is None.
	decoder_output_stride			The ratio of input to output spatial resolution when employing decoder
									to refine segmentation results, default is None.
	image_pyramid					Input scales for multi-scale feature extraction, default is None.
U
unknown 已提交
56 57 58 59 60
	epoch_size						Epoch size, default is 6.
    batch_size                      batch size of input dataset: N, default is 2.
	enable_save_ckpt				Enable save checkpoint, default is true.
	save_checkpoint_steps			Save checkpoint steps, default is 1000.
	save_checkpoint_num				Save checkpoint numbers, default is 1.
U
unknown 已提交
61
```	
U
modify  
unknown 已提交
62 63


U
unknown 已提交
64 65
### Parameters:
```
U
modify  
unknown 已提交
66 67 68 69
Parameters for dataset and network:
    distribute						Run distribute, default is false.
	data_url						Train/Evaluation data url, required.
	checkpoint_url					Checkpoint path, default is None.
U
unknown 已提交
70
```