|
根据demo的代码转换caffe模型 转换成功了 可是预测结果一直不对
求大佬看下问题
# Create RKNN object
rknn = RKNN()
# pre-process config
print('--> config model')
rknn.config(channel_mean_value='84.29 84.8 83.61 1', reorder_channel='2 1 0')
print('done')
# Load tensorflow model
print('--> Loading model')
ret = rknn.load_caffe(model='./model.prototxt',
proto='caffe',
blobs='./model.caffemodel')
if ret != 0:
print('Load mobilenet_v2 failed! Ret = {}'.format(ret))
exit(ret)
print('done')
# Build model
print('--> Building model')
ret = rknn.build(do_quantization=False)
if ret != 0:
print('Build mobilenet_v2 failed!')
exit(ret)
print('done')
# Export rknn model
print('--> Export RKNN model')
ret = rknn.export_rknn('./model.rknn')
if ret != 0:
print('Export mobilenet_v2.rknn failed!')
exit(ret)
print('done')
# Set inputs
img = cv2.imread('./000.jpg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
print('--> Init runtime environment')
ret = rknn.init_runtime()
if ret != 0:
print('Init runtime environment failed')
exit(ret)
print('done')
# Inference
print('--> Running model')
outputs = rknn.inference(inputs=[img])
show_outputs(outputs)
print('done')
|
|