models icon indicating copy to clipboard operation
models copied to clipboard

[deeplab]why deeplab v3+ have no decoder and ASSP when use mobilenet-v2 models

Open shijh1975 opened this issue 8 years ago • 27 comments

If It is no good effects when add decoder and ASSP? Can I add this coder to try?

shijh1975 avatar May 21 '18 06:05 shijh1975

Adding decoder and ASPP to MobileNet-v2 still improves the performance in our experiments. We do not include them in the released checkpoint since the released MobileNet-v2 checkpoint targets at fast inference speed instead of high accuracy.

aquariusjay avatar May 21 '18 16:05 aquariusjay

Hi, if we wanted to try adding decoder to MobileNet-v2, how can we go about it. Do we simply add DECODER_END_POINTS?

kushagraagrawal avatar May 22 '18 05:05 kushagraagrawal

I add --decoder_output_stride=4 \ parameter It Seem can train, But eval Imou is very low only about 0.03. How can I do?

shijh1975 avatar May 22 '18 08:05 shijh1975

@kushagraagrawal Please try setting in feature_extractor.py, for mobilenet_v2: DECODER_END_POINTS: [ 'layer_4/depthwise_output', ],

@shijh1975 It seems that your model converges to whole background. Make sure you have every flag properly set and try to use batch size as large as possible (fine-tune batch norm as well).

aquariusjay avatar May 22 '18 13:05 aquariusjay

okay, I will. And should I use ImageNet pre-trained mobilenet v2 to initialise this?

kushagraagrawal avatar May 22 '18 13:05 kushagraagrawal

You could try using ImageNet-pretrained checkpoint or provided pretrained checkpoints. Either should be fine.

aquariusjay avatar May 22 '18 13:05 aquariusjay

@aquariusjay I add DECODER_END_POINTS: [ 'layer_4/depthwise_output', ], in feature_extractor.py, the error is: File "/home-ex/shijh/models/research/deeplab/model.py", line 548, in refine_by _decoder end_points[feature_name], KeyError: 'MobilenetV2/layer_4/depthwise_output', It seem the 'layer4/depthwise_output' is not correct.

shijh1975 avatar May 23 '18 02:05 shijh1975

@shijh1975 I had the same issue. in model.py, function - refine_by_decoder set feature_name = name.

kushagraagrawal avatar May 23 '18 03:05 kushagraagrawal

@aquariusjay can you help me? @kushagraagrawal Did you have resolved this issue?

shijh1975 avatar May 28 '18 06:05 shijh1975

@shijh1975 Just repalce the code in 544 "feature_name= '{}/{}......" with feature_name = name. What's more, delete the code 346 "flags.mark_flag_as_required("tf_initial_checkpoint'), and do not include --tf_initial_checkpoint in your training command. It works for me.

Shenghsin avatar May 29 '18 12:05 Shenghsin

Without the "tf_initial_checkpoint" the training is not convergence, however, with "tf_initial_checkpoint", Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.InvalidArgumentError'>, Assign requires shapes of both tensors to match. lhs shape= [1,1,1280,256] rhs shape= [1,1,512,256] [[Node: save/Assign_423 = Assign[T=DT_FLOAT, _class=["loc:@concat_projection/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](concat_projection/weights/Momentum, save/RestoreV2:423)]] is reported, anybody knows how to fix this issue???

Shenghsin avatar May 30 '18 01:05 Shenghsin

@Shenghsin thank you very much, I also found the trainning is not convergence with tf_initial_checkpoint=false. however I set the batch size =12, it seem still not convergence.

shijh1975 avatar May 30 '18 01:05 shijh1975

To use decoder for MobileNet model variants, we need to change one more line: In this line, set feature_name = name. We will provide an update for this soon.

aquariusjay avatar May 30 '18 21:05 aquariusjay

@aquariusjay thank you, I have correct this issue, but now it seems not covergence when trainning use tf_initial_checkpoint=false, batch size =12 parameter and pascal datasets.

shijh1975 avatar Jun 01 '18 02:06 shijh1975

tf_initial_checkpoint=false means you are not using any pretrained checkpoint (not even ImageNet pretrained checkpoint), which makes it very hard to train. You should at least use the ImageNet pretrained checkpoint provided by MobileNetv2.

aquariusjay avatar Jun 01 '18 04:06 aquariusjay

@Shenghsin I got the same "Assign requires shapes of both tensors to match" error. Were you able to fix it?

derinozturk avatar Jun 07 '18 13:06 derinozturk

@aquariusjay I amke a mistake,not tf_initial_checkpoint=false, just initialize_last_layer=false, it seems can not covergence, But I change the aspp_with_batch_norm=True to false, I seems can covergence, But the Miou is not very good,only about 0.5.

shijh1975 avatar Jun 08 '18 06:06 shijh1975

A few suggestions:

  1. The performance will be better if you set aspp_with_batch_norm=fine_tune_batch_norm=True and use batch size as large as possible.
  2. I assume you are training on PASCAL VOC 2012. On that dataset, you also need to exploit the extra annotations. See Q3 in FAQ. You should download the dataset and merge it with original PASCAL VOC 2012 dataset.

aquariusjay avatar Jun 08 '18 16:06 aquariusjay

@derinozturk set initialize_last_layer=false will fix this error.

Shenghsin avatar Jun 11 '18 14:06 Shenghsin

@aquariusjay I have download the pascal AUG datasets and merge with Pascal VOC 2012 datasets, I use aspp_with_batch_norm=fine_tune_batch_norm=True, tf_initial_checkpoint=true, initialize_last_layer=false batch_size =13 to train the mobilenetv2+aspp+decoder model. But after 30000 steps, It seems the Loss covergence to about 0.5,And mIou about 0.66. Which hyperparameters can I to modify to raise the performance?

shijh1975 avatar Jun 15 '18 05:06 shijh1975