toniz / deeplab-on-ios

Tensorflow-lite Deeplab Real Time Segmentation on iOS with OpenCV
MIT License
23 stars 5 forks source link

deeplab detects badly on ios #3

Closed hakS07 closed 5 years ago

hakS07 commented 5 years ago

@toniz Hi, I have trained deep lab on my custom dataset(400*300,14000 images) for iris eyes object with 513 as crop size and during the test, it detects for crop with crop size 513 . i tested the pb model with code python it detects ok(not precise very much but it ok) now what I need i integrate my model on ios application, i was able to successfully convert the model to tflite .but it gives me a wrong and bad segmentation python train.py \ --logtostderr \ --train_split="trainval" \ --model_variant="mobilenet_v2" \ --output_stride=16 \ --train_crop_size="513,513" \ --train_batch_size=4 \ --training_number_of_steps=20000 \ --fine_tune_batch_norm=true \ --tf_initial_checkpoint="${INIT_FOLDER}/${CKPT_NAME}/model.ckpt-30000" \ --train_logdir="${TRAIN_LOGDIR}" \ --dataset_dir="${my_DATASET}"

convert to tflite

tflite_convert ----output_format=TFLITE --inference_type=QUANTIZED_UINT8 --inference_input_type=FlOAT --input_arrays=sub_2 --input_shapes=1,513,513,3 --output_arrays=ResizeBilinear_2 --output_file=/Users/hak/Downloads/deeplabv3_mnv2_pascal_trainvall/mobilenet1-20000.tflite --graph_def=/Users/hak/Downloads/deeplabv3_mnv2_pascal_trainvall/mobilenet-20000.pb --mean_values=128 --std_dev_values=127 --allow_custom_ops --post_training_quantize did you have any idea why mobilenet gives me such bad result is't the training steps no enough for 14000 images or what ??

`

toniz commented 5 years ago

follow this: https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/quantize.md

toniz commented 5 years ago

And your dataset is 400*300, using --train_crop_size="257,257" would get better performance.

hakS07 commented 5 years ago

@toniz thank you for your answer my data are something like this
cdghjsajiab and what i need to detect is the iris so i want to make sure if i use train crop size<<image original size will cut the iris part and mess up with images ??? because I m new on machine learning i don't know if the problem(bad segmentation)was because that the iteration number (32000) not enough for data(14000) or not ?? excuse my ignorance

toniz commented 5 years ago

i want to make sure if i use train crop size<<image original size will cut the iris part and mess up with images ???

I don't think so.
The VOC dataset only has 17128 images. and it has 21 classes. The image size is different( 375 500, 373 500, 500*375 etc).

because I m new on machine learning i don't know if the problem(bad segmentation)was because that the iteration number (32000) not enough for data(14000) or not ??

You need to learn how to use the tensorboard.

hakS07 commented 5 years ago

@toniz Thanks for the reply