|
开发板系统:fedora 28
Toolkit版本: 1.0.0
Tensorflow版本:1.10.1
1. 根据tensorflow官方教程生成了pb文件
2. 运行了官方的demo
/home/toybrick/RKNN/rknn-toolbrick/pexample/ssd_mobilenet_V2/step1.py
只是替换了模型的文件
import numpy as np
import cv2
from rknn.api import RKNN
if __name__ == '__main__':
# Create RKNN object
rknn = RKNN(verbose = True, verbose_file = './Error.log')
# pre-process config
print('--> config model')
rknn.config(channel_mean_value='127.5 127.5 127.5 128', reorder_channel='0 1 2', quantized_dtype='asymmetric_quantized-u8')
print('done')
# Load tflite model
print('--> Loading model')
#模型更改的路径
ret = rknn.load_tensorflow(tf_pb='./tensorflow.pb',
inputs=['FeatureExtractor/MobilenetV2/MobilenetV2/input'],
outputs=['concat_1', 'concat'],
input_size_list=[[300,300,3]],
predef_file=None)
if ret != 0:
print('Load model failed!')
exit(ret)
print('done')
if ret != 0:
print('Load model failed!')
exit(ret)
print('done')
# Build model
print('--> hybrid_quantization_step1')
ret = rknn.hybrid_quantization_step1(dataset='./dataset.txt')
if ret != 0:
print('hybrid_quantization_step1 failed!')
exit(ret)
print('done')
# Tips
print('Please modify ssd_mobilenet_v2.quantization.cfg!')
print('==================================================================================================')
print('Modify method:')
print('1. delete @FeatureExtractor/MobilenetV2/expanded_conv/depthwise/depthwise_227:weight and its value')
print('2. delete @FeatureExtractor/MobilenetV2/expanded_conv/depthwise/depthwise_227:bias and its value')
print('3. delete @FeatureExtractor/MobilenetV2/Conv/Relu6_228ut0 and its value')
print('==================================================================================================')
print('Original quantization profile and modified quantization profile diff shows in file quantization_profile.diff')
rknn.release()
3. 报错的日志:
D import clients finished
E Catch exception when loading tensorflow model: ./tensorflow.pb!
T Traceback (most recent call last):
T File "rknn/api/rknn_base.py", line 136, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T File "rknn/base/RKNNlib/converter/convert_tf.py", line 102, in rknn.base.RKNNlib.converter.convert_tf.convert_tf.__init__
T File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 44, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T File "rknn/base/RKNNlib/converter/tensorflowloader.py", line 46, in rknn.base.RKNNlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/message.py", line 187, in ParseFromString
T return self.MergeFromString(serialized)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/python_message.py", line 1124, in MergeFromString
T if self._InternalParse(serialized, 0, length) != length:
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/python_message.py", line 1189, in InternalParse
T pos = field_decoder(buffer, new_pos, end, self, field_dict)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 723, in DecodeField
T if value._InternalParse(buffer, pos, new_pos) != new_pos:
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/python_message.py", line 1189, in InternalParse
T pos = field_decoder(buffer, new_pos, end, self, field_dict)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 702, in DecodeRepeatedField
T if value.add()._InternalParse(buffer, pos, new_pos) != new_pos:
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/python_message.py", line 1189, in InternalParse
T pos = field_decoder(buffer, new_pos, end, self, field_dict)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 847, in DecodeMap
T if submsg._InternalParse(buffer, pos, new_pos) != new_pos:
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/python_message.py", line 1176, in InternalParse
T buffer, new_pos, wire_type) # pylint: disable=protected-access
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 948, in _DecodeUnknownField
T (data, pos) = _DecodeUnknownFieldSet(buffer, pos)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 927, in _DecodeUnknownFieldSet
T (data, pos) = _DecodeUnknownField(buffer, pos, wire_type)
T File "/usr/local/lib/python3.6/site-packages/google/protobuf/internal/decoder.py", line 952, in _DecodeUnknownField
T raise _DecodeError('Wrong wire type in tag.')
T google.protobuf.message.DecodeError: Wrong wire type in tag.
|
|