toniz / deeplab-on-ios

Tensorflow-lite Deeplab Real Time Segmentation on iOS with OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

slow segmentation with deeplab

hakS07 opened this issue · comments

commented

@toniz
Hi, I have trained deep lab on my custom dataset(50*50,3400 images) for iris eyes object with 257 as crop size and during the test, it detects for crop with crop size 257 .
i tested the pb model with code python it detects ok
2019-07-25

now what I need is to integrate my model on ios application, i was able to successfully convert the model to tflite .but it gives me a slow segmentation
tflite_convert ----output_format=TFLITE --inference_type=FLOAT --inference_input_type=FlOAT --input_arrays=sub_2 --input_shapes=1,257,257,3 --output_arrays=ResizeBilinear_2 --output_file=/Users/hak/Downloads/deeplabv3_mnv2_pascal_trainvall/mobilenet.tflite --graph_def=/Users/hak/Downloads/deeplabv3_mnv2_pascal_trainvall/mobilenet.pb --mean_values=128 --std_dev_values=127 --allow_custom_ops --post_training_quantize
tflite file size=2,2mo
however the original deeplab tflite file works fine on the appliacation
i have changed fps to 60 and to 240 but nothing change
i use iphone6+

commented

Use this model From model zoo:

mobilenetv2_dm05_coco_voc_trainaug
https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md

Convert tflite like this:
convert2pb.sh:

xwj@master01:/data/xwj/segmentation/train$ cat convert2pb.sh
python ../../models/research/deeplab/export_model.py
--checkpoint_path=log_all/model.ckpt-100000
--depth_multiplier=0.5
--quantize_delay_step=0
--export_path=tflite_all/frozen_inference_graph.pb

conver2tflite.sh:

xwj@master01:/data/xwj/segmentation/train$ cat conver2tflite.sh
tflite_convert
--graph_def_file=tflite_all/frozen_inference_graph.pb
--output_file=tflite_all/frozen_inference_graph.tflite
--output_format=TFLITE
--input_shape=1,513,513,3
--input_arrays="MobilenetV2/MobilenetV2/input"
--change_concat_input_ranges=true
--output_arrays="ArgMax"