Toybrick
标题:
facenet 转rknn 怎么设定为推理模式
[打印本页]
作者:
liuwenhua
时间:
2019-11-18 16:00
标题:
facenet 转rknn 怎么设定为推理模式
本帖最后由 liuwenhua 于 2019-11-18 16:01 编辑
import numpy as np
import cv2
from PIL import Image
from rknn.api import RKNN
from timeit import default_timer as timer
#rknn = RKNN()
rknn = RKNN(verbose=True, verbose_file='./1.log')
#rknn.config(channel_mean_value='0 0 0 1', reorder_channel='0 1 2')
#load tensorflow model
print('--> Loading model')
rknn.load_tensorflow(tf_pb='./20191115-074450.pb',inputs=['input'],outputs=['InceptionResnetV1/Bottleneck/BatchNorm/Reshape_1'],
input_size_list=[[160, 160, 3]])
#print("aa",aa)
print('done')
# Build Model
print('--> Building model')
#rknn.build(do_quantization=True, dataset='./datasets.txt')
#rknn.build(do_quantization=True,dataset='./datasets.txt',pre_compile=False)
rknn.build(do_quantization=False)
print('done')
# Export RKNN Model
rknn.export_rknn('./20191115-074450.rknn')
rknn.release()
最终推理结果与原始模型推理相差比较大,根本无法识别
作者:
jefferyzhang
时间:
2019-11-18 17:59
推理模式你得生成pb时候就freeze掉,而不是rknn转。rknn只是转换一个pb格式的计算图到rknn格式的计算图而已。
作者:
liuwenhua
时间:
2019-11-19 09:26
我的是多输入,而在转rknn设置多输入时就报错
欢迎光临 Toybrick (https://t.rock-chips.com/)
Powered by Discuz! X3.3