8.1 KiB
Contents
- ICNet Description
- Model Architecture
- Dataset
- Environmental Requirements
- Script Description
- Model Description
- Description of Random Situation
- ModelZoo Homepage
ICNet Description
ICNet(Image Cascade Network) propose a full convolution network which incorporates multi-resolution branches under proper label guidance to address the challenge of real-time semantic segmentation.
paperECCV2018
Model Architecture
ICNet takes cascade image inputs (i.e., low-, medium- and high resolution images), adopts cascade feature fusion unit and is trained with cascade label guidance.The input image with full resolution (e.g., 1024×2048 in Cityscapes) is downsampled by factors of 2 and 4, forming cascade input to medium- and high-resolution branches.
Dataset
used Dataset :Cityscape Dataset Website
It contains 5,000 finely annotated images split into training, validation and testing sets with 2,975, 500, and 1,525 images respectively.
Environmental requirements
- Hardware :(Ascend)
- Prepare ascend processor to build hardware environment
- frame:
- For details, please refer to the following resources:
Scription Description
Script and Sample Code
.
└─ICNet
├── ascend310_infer
│ ├── build.sh
│ ├── CMakeLists.txt
│ ├── inc
│ │ └── utils.h
│ └── src
│ ├── main.cc
│ └── utils.cc
├── eval.py # validation
├── export.py # export mindir
├── postprocess.py # 310 infer calculate accuracy
├── README.md # descriptions about ICNet
├── scripts
│ ├── run_distribute_train8p.sh # multi cards distributed training in ascend
│ ├── run_eval.sh # validation script
│ └── run_infer_310.sh # 310 infer script
├── src
│ ├── cityscapes_mindrecord.py # create mindrecord dataset
│ ├── __init__.py
│ ├── logger.py # logger
│ ├── losses.py # used losses
│ ├── loss.py # loss
│ ├── lr_scheduler.py # lr
│ ├── metric.py # metric
│ ├── models
│ │ ├── icnet_1p.py # net single card
│ │ ├── icnet_dc.py # net multi cards
│ │ ├── icnet.py # validation card
│ │ └── resnet50_v1.py # backbone
│ ├── model_utils
│ │ └── icnet.yaml # config
│ └── visualize.py # inference visualization
└── train.py # train
Script Parameters
Set script parameters in src/model_utils/icnet.yaml .
Model
name: "icnet"
backbone: "resnet50"
base_size: 1024 # during augmentation, shorter size will be resized between [base_size*0.5, base_size*2.0]
crop_size: 960 # end of augmentation, crop to training
Optimizer
init_lr: 0.02
momentum: 0.9
weight_decay: 0.0001
Training
train_batch_size_percard: 4
valid_batch_size: 1
cityscapes_root: "/data/cityscapes/" # set dataset path
epochs: 160
val_epoch: 1
ckpt_dir: "./ckpt/" # ckpt and training log will be saved here
mindrecord_dir: '' # set mindrecord path
pretrained_model_path: '/root/ResNet50V1B-150_625.ckpt' # set the pretrained model path correctly
save_checkpoint_epochs: 5
keep_checkpoint_max: 10
Training Process
Prepare Datast
- Convert dataset to Mindrecord
python cityscapes_mindrecord.py [DATASET_PATH] [MINDRECORD_PATH]
- Note:
[MINDRCORD_PATH] in script should be consistent with 'mindrecord_dir' in config file.
Distributed Training
- Run distributed train in ascend processor environment
bash scripts/run_distribute_train.sh [RANK_TABLE_FILE] [PROJECT_PATH]
- Notes:
The hccl.json file specified by [RANK_TABLE_FILE] is used when running distributed tasks. You can use hccl_tools to generate this file.
Training Result
The training results will be saved in the example path, The folder name starts with "ICNet-".You can find the checkpoint file and similar results below in LOG(0-7)/log.txt.
# distributed training result(8p)
epoch: 1 step: 93, loss is 0.5659234
epoch time: 672111.671 ms, per step time: 7227.007 ms
epoch: 2 step: 93, loss is 1.0220546
epoch time: 66850.354 ms, per step time: 718.821 ms
epoch: 3 step: 93, loss is 0.49694514
epoch time: 70490.510 ms, per step time: 757.962 ms
epoch: 4 step: 93, loss is 0.74727297
epoch time: 73657.396 ms, per step time: 792.015 ms
epoch: 5 step: 93, loss is 0.45953503
epoch time: 97117.785 ms, per step time: 1044.277 ms
Evaluation Process
Evaluation
Check the checkpoint path used for evaluation before running the following command.
bash run_eval.sh [DATASET_PATH] [CHECKPOINT_PATH] [PROJECT_PATH]
Evaluation Result
The results at eval/log were as follows:
Found 500 images in the folder /data/cityscapes/leftImg8bit/val
pretrained....
2021-06-01 19:03:54,570 semantic_segmentation INFO: Start validation, Total sample: 500
avgmiou 0.69962835
avg_pixacc 0.94285786
avgtime 0.19648232793807982
310 infer
bash run_infer_310.sh [The path of the MINDIR for 310 infer] [The path of the dataset for 310 infer] 0
Note:: Before executing 310 infer, create the MINDIR/AIR model using "python export.py --ckpt-file [The path of the CKPT for exporting]".
Model Description
Performance
Training Performance
Parameter | MaskRCNN |
---|---|
resources | Ascend 910;CPU 2.60GHz, 192core;memory:755G |
Upload date | 2021.6.1 |
mindspore version | mindspore1.2.0 |
training parameter | epoch=160,batch_size=32 |
optimizer | SGD optimizer,momentum=0.9,weight_decay=0.0001 |
loss function | SoftmaxCrossEntropyLoss |
training speed | epoch time:285693.557 ms per step time :42.961 ms |
total time | about 5 hours |
Script URL | |
Random number seed | set_seed = 1234 |
Description of Random Situation
The seed in the create_icnet_dataset
function is set in cityscapes_mindrecord.py
, and the random seed in train.py
is also used for weight initialization.
ModelZoo Homepage
Please visit the official website homepage.