We have trained a simple fcn-xs model, the hyper-parameters are below:
model | lr (fixed) | epoch |
---|---|---|
fcn-32s | 1e-10 | 31 |
fcn-16s | 1e-12 | 27 |
fcn-8s | 1e-14 | 19 |
(when using the newest mxnet, you'd better using larger learning rate, such as 1e-4, 1e-5, 1e-6 instead, because the newest mxnet will do gradient normalization in SoftmaxOutput
)
The training dataset size is only 2027, and the validation dataset size is 462.
Pillow
(required by image_segment.py
).[sudo] pip install Pillow
~/train_fcn_xs
, and MXNet is built as ~/mxnet
. Now, copy example scripts into working directory.cp ~/mxnet/example/fcn-xs/* .
VGG_FC_ILSVRC_16_layers-symbol.json
and VGG_FC_ILSVRC_16_layers-0074.params
baidu yun, dropbox.VOC2012.rar
robots.ox.ac.uk, and extract it. the file/folder will be like:JPEGImages folder
, SegmentationClass folder
, train.lst
, val.lst
, test.lst
fcn_xs.py
.# ctx = mx.cpu(0) ctx = mx.gpu(0)
./run_fcnxs.sh
, the script in it is:python -u fcn_xs.py --model=fcn32s --prefix=VGG_FC_ILSVRC_16_layers --epoch=74 --init-type=vgg16
root_dir
, flist_name
, ``fcnxs_model_prefix``` for your own data.run_fcnxs.sh
corresponding, such as when train fcn-16s, comment out the fcn32s script, then it will like this:python -u fcn_xs.py --model=fcn16s --prefix=FCN32s_VGG16 --epoch=31 --init-type=fcnxs
INFO:root:Start training with gpu(3) INFO:root:Epoch[0] Batch [50] Speed: 1.16 samples/sec Train-accuracy=0.894318 INFO:root:Epoch[0] Batch [100] Speed: 1.11 samples/sec Train-accuracy=0.904681 INFO:root:Epoch[0] Batch [150] Speed: 1.13 samples/sec Train-accuracy=0.908053 INFO:root:Epoch[0] Batch [200] Speed: 1.12 samples/sec Train-accuracy=0.912219 INFO:root:Epoch[0] Batch [250] Speed: 1.13 samples/sec Train-accuracy=0.914238 INFO:root:Epoch[0] Batch [300] Speed: 1.13 samples/sec Train-accuracy=0.912170 INFO:root:Epoch[0] Batch [350] Speed: 1.12 samples/sec Train-accuracy=0.912080
FCN8s_VGG16-symbol.json
, FCN8s_VGG16-0019.params
img = YOUR_IMAGE_NAME
in image_segmentaion.py
image_segmentaion.py
to segmentation one image by running in shell python image_segmentaion.py
, then you will get the segmentation image like the sample results above.cut_off_size
to a small value when you construct your FileIter, like this:train_dataiter = FileIter( root_dir = "./VOC2012", flist_name = "train.lst", cut_off_size = 400, rgb_mean = (123.68, 116.779, 103.939), )