ssd_mobilenet_v1 tflite 模型轉換問題 (使用coco dataset 300*300)

1. 看過此社群知道轉換過程要選擇 --add_postprocessing_op=false 與 --inference_type=FLOAT 轉成32-bit tflite model

python3 export_tflite_ssd_graph.py \

 --pipeline_config_path=pipeline.config \

 --trained_checkpoint_prefix=model.ckpt \

 --output_directory=tflite \

 --add_postprocessing_op=false

toco \

--graph_def_file=tflite/tflite_graph.pb \

--output_file=toco/ssd_mobilenetv1.tflite \

--input_shapes=1,300,300,3 \

--input_arrays=normalized_input_image_tensor \

--output_arrays='raw_outputs/class_predictions','raw_outputs/box_encodings' \

--inference_type=FLOAT


2. 使用Kneron python 轉換過程 km.evaluate() 會發生問題

(base) root@5d27e181090d:/data1/ssd_mobilenet_v1# python3 ssd_mobilenetv1_tflite_to_nef.py 

/workspace/miniconda/lib/python3.7/site-packages/numpy/__init__.py:156: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service

 from . import _distributor_init

Using TensorFlow backend.

(1) convert tflite model to onnx ====>

(2) setup ktc config ====>

(3) npu(only) performance simulation ====>

running compiler and ipEvaluator...

terminate called after throwing an instance of 'std::runtime_error'

 what(): CSim only support CPU node in the end of model and write data to output buffer.

./compilerIpevaluator_720.sh: line 32: 4928 Aborted         (core dumped) $LIBS_FOLDER/compiler/compile 720 $model $TMP_FOLDER/config_compiler.json warning compile.log

Traceback (most recent call last):

 File "ssd_mobilenetv1_tflite_to_nef.py", line 34, in <module>

  eval_result = km.evaluate()

 File "/workspace/miniconda/lib/python3.7/site-packages/ktc/toolchain.py", line 130, in evaluate

  subprocess.run(['./compilerIpevaluator_720.sh', input_model_path], check=True)

 File "/workspace/miniconda/lib/python3.7/subprocess.py", line 512, in run

  output=stdout, stderr=stderr)

subprocess.CalledProcessError: Command '['./compilerIpevaluator_720.sh', '/data1/input.onnx']' returned non-zero exit status 1.


3. 略過 km.evaluate() 不執行 可跑到 compile 步驟 才出問題:

(base) root@5d27e181090d:/data1/ssd_mobilenet_v1# python3 ssd_mobilenetv1_tflite_to_nef.py 

/workspace/miniconda/lib/python3.7/site-packages/numpy/__init__.py:156: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service

 from . import _distributor_init

Using TensorFlow backend.

(1) convert tflite model to onnx ====>

(2) setup ktc config ====>

(3) npu(only) performance simulation ====>

(4) onnx model check ====>

(5) fix point analysis ====>

(6) bie model check ====>

(7) compile ====>

[tool][info][batch_compile.cc:561][BatchCompile] compiling output.bie

terminate called after throwing an instance of 'std::runtime_error'

 what(): CSim only support CPU node in the end of model and write data to output buffer.

Traceback (most recent call last):

 File "ssd_mobilenetv1_tflite_to_nef.py", line 66, in <module>

  nef_model_path = ktc.compile([km])

 File "/workspace/miniconda/lib/python3.7/site-packages/ktc/toolchain.py", line 173, in compile

  return encrypt_compile(model_list, output_dir, dedicated_output_buffer, mode=None, weight_compress=weight_compress, hardware_cut_opt=hardware_cut_opt, flatbuffer=flatbuffer)

 File "/workspace/miniconda/lib/python3.7/site-packages/ktc/toolchain.py", line 272, in encrypt_compile

  subprocess.run(commands, check=True)

 File "/workspace/miniconda/lib/python3.7/subprocess.py", line 512, in run

  output=stdout, stderr=stderr)

subprocess.CalledProcessError: Command '['/workspace/libs/compiler/batch_compile', '-T', '720', '/data1/batch_compile/batch_compile_bconfig.json', '-s', '-t', 'kneron/toolchain:v0.17.2\n', '-o']' died with <Signals.SIGABRT: 6>.

(base) root@5d27e181090d:/data1/ssd_mobilenet_v1# 

請協助轉換, 是否ssd_mobilenetv1.tflite 需要去除nodes ?


thanks,

Giga

Comments

The discussion has been closed due to inactivity. To continue with the topic, please feel free to post a new discussion.