tensorflow / models

Models and examples built with TensorFlow
Other
77.16k stars 45.77k forks source link

[Deeplab v3 +] When I train in my own dataset, the result_segmentation is not exact. What 's happen #4284

Closed urgonguyen closed 6 years ago

urgonguyen commented 6 years ago

My data is Food17:18 class(17 object + 1 background)

+train.py `flags.DEFINE_boolean('initialize_last_layer', False, 'Initialize the last layer.')

`def create_food_label_colormap(): """Creates a label colormap used in PASCAL VOC segmentation benchmark.

Returns: A Colormap for visualizing segmentation results. """ colormap = np.zeros((_DATASET_MAX_ENTRIES[_FOOD], 3), dtype=int) ind = np.arange(_DATASET_MAX_ENTRIES[_FOOD], dtype=int)

for shift in reversed(range(8)): for channel in range(3): colormap[:, channel] |= bit_get(ind, channel) << shift ind >>= 3

return colormap`

And the result is: https://drive.google.com/file/d/1ePj4I_FeoLzlVosFJ7RKiIbZkzMbtxu2/view?usp=sharing

Help me!

tensorflowbutler commented 6 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

kushagraagrawal commented 6 years ago

Hi, what were the training parameters that you used? and the mIoU achieved?

urgonguyen commented 6 years ago

I use all of parameter from pascal voc 2012 in project. And I need to train again in my own data. I run train.py but have problem with path so I copy one file from local_test.sh and deleted all of lines under this: NUM_ITERATIONS=10 python "${WORK_DIR}"/train.py \ --logtostderr \ --train_split="trainval" \ --model_variant="xception_65" \ --atrous_rates=6 \ --atrous_rates=12 \ --atrous_rates=18 \ --output_stride=16 \ --decoder_output_stride=4 \ --train_crop_size=513 \ --train_crop_size=513 \ --train_batch_size=4 \ --training_number_of_steps="${NUM_ITERATIONS}" \ --fine_tune_batch_norm=true \ --tf_initial_checkpoint="${INIT_FOLDER}/deeplabv3_pascal_train_aug/model.ckpt" \ --train_logdir="${TRAIN_LOGDIR}" \ --dataset_dir="${PASCAL_DATASET}" I change NUM_ITERATIONS=30000 , --train_batch_size=1, --train_split="train" and train on my dataset. But the result is not good( like the picture in my issue)

kushagraagrawal commented 6 years ago

It probably happened because of the batch size.

urgonguyen commented 6 years ago

Thank you and sorry I reply late, You mean I should increase train_batch_size.

kushagraagrawal commented 6 years ago

Yeah, you could keep a large batch size, which might help.

kayvonkhosrowpour commented 5 years ago

@urgonguyen Did you end up getting this to work? I'm trying to use my own custom dataset as you are, but I am having issues with a custom number of classes. Could you provide how you train the network and visualize inferences? Edit: Resolved issue: https://github.com/tensorflow/models/issues/6559#issuecomment-482671438