This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
MobilenetV3_small_cityscapes_trainfine Tensorflow Lite (.tflite) conversion
Katsuya Hyodo edited this page Jan 21, 2020
·
31 revisions
[deeplab] Key aspp1_depthwise/BatchNorm/beta not found in checkpoint
https://spamgodisreal.blogspot.com/2019/12/re-tensorflowtensorflow-using_3.html
When you want to fine-tune DeepLab on other datasets, there are a few cases
# See feature_extractor.network_map for supported model variants.
# models/research/deeplab/core/feature_extractor.py
networks_map = {
'mobilenet_v2': _mobilenet_v2,
'mobilenet_v3_large_seg': mobilenet_v3_large_seg,
'mobilenet_v3_small_seg': mobilenet_v3_small_seg,
'resnet_v1_18': resnet_v1_beta.resnet_v1_18,
'resnet_v1_18_beta': resnet_v1_beta.resnet_v1_18_beta,
'resnet_v1_50': resnet_v1_beta.resnet_v1_50,
'resnet_v1_50_beta': resnet_v1_beta.resnet_v1_50_beta,
'resnet_v1_101': resnet_v1_beta.resnet_v1_101,
'resnet_v1_101_beta': resnet_v1_beta.resnet_v1_101_beta,
'xception_41': xception.xception_41,
'xception_65': xception.xception_65,
'xception_71': xception.xception_71,
'nas_pnasnet': nas_network.pnasnet,
'nas_hnasnet': nas_network.hnasnet,
}
python deeplab\export_model.py --checkpoint_path=C:\work\git\models\research\deeplab_mnv3_small_cityscapes_trainfine\model.ckpt --quantize_delay_step=0 --export_path=C:\work\git\models\research\deeplab_mnv3_small_cityscapes_trainfine\deeplab_mnv3_small_cityscapes_trainfine.pb --model_variant="mobilenet_v3_small_seg"
Not found: Key MobilenetV3/Conv/conv_quant/max not found in checkpoint
python deeplab/train.py \
--logtostderr \
--training_number_of_steps=30000 \
--train_split="train" \
--model_variant="mobilenet_v3_small_seg" \
--train_crop_size="513,513" \
--train_batch_size=8 \
--base_learning_rate=3e-5 \
--dataset="pascal_voc_seg" \
--initialize_last_layer \
--quantize_delay_step=0 \
--save_interval_secs=300 \
--save_summaries_secs=300 \
--tf_initial_checkpoint=${PATH_TO_TRAINED_FLOAT_MODEL} \
--train_logdir=${PATH_TO_TRAIN_DIR} \
--dataset_dir=${PATH_TO_DATASET}
$ cd tensorflow/tensorflow/lite/python
$ sudo bazel run tflite_convert -- \
--graph_def_file=${HOME}/Downloads/deeplab_mnv3_small_cityscapes_trainfine_2019_11_15/deeplab_mnv3_small_cityscapes_trainfine/frozen_inference_graph.pb \
--output_file=${HOME}/Downloads/deeplab_mnv3_small_cityscapes_trainfine_2019_11_15/deeplab_mnv3_small_cityscapes_trainfine/deeplab_mnv3_small_cityscapes_trainfine.tflite \
--input_arrays=ImageTensor \
--input_shape=1,1024,2048,3 \
--inference_type=FLOAT \
--inference_input_type=QUANTIZED_UINT8 \
--std_dev_values=127.5 \
--mean_values=127.5 \
--output_arrays=SemanticPredictions
$ cd tensorflow/tensorflow/lite/python
$ sudo bazel run \
tflite_convert -- \
--graph_def_file=${HOME}/Downloads/deeplab_mnv3_small_cityscapes_trainfine_2019_11_15/deeplab_mnv3_small_cityscapes_trainfine/frozen_inference_graph.pb \
--output_file=${HOME}/Downloads/deeplab_mnv3_small_cityscapes_trainfine_2019_11_15/deeplab_mnv3_small_cityscapes_trainfine/deeplab_mnv3_small_cityscapes_trainfine.tflite \
--input_arrays=ImageTensor \
--input_shape=1,1024,2048,3 \
--inference_type=FLOAT \
--inference_input_type=QUANTIZED_UINT8 \
--std_dev_values=127.5 \
--mean_values=127.5 \
--change_concat_input_ranges=true \
--output_arrays=SemanticPredictions
$ sudo bazel run \
-c opt \
tensorflow/lite/tools/benchmark:benchmark_model -- \
--graph=${HOME}/Downloads/deeplab_mnv3_small_cityscapes_trainfine_2019_11_15/deeplab_mnv3_small_cityscapes_trainfine/deeplab_mnv3_small_cityscapes_trainfine.tflite