|
我在跑mtcnn demo的时候,这一句会报错:pnet_rknn_list[0].eval_perf(inputs=[img_matlab],is_print=True)
E Collect Performance Result Error!E Collect Performance Result Error!
E Performance information is empty, some mistakes may happened.
eval_perf 这个函数报错,没法给出评估结果。但不影响整个代码的正确运行,代码会继续运行下去给出结果。
我应该如何测试pnet, rnet, onet正向推理一次所需的理论时间分别是多少呢?
pnet_rknn_list[0] 是其中的一个pnet网络。
在调用 eval_perf() 之前已经执行过 init_runtime().
我也试过测试rnet和onet是同一的error.
相关函数如下:
def init_pnet():
i=0
list = []
for i in range(7):
rknn_name = "PNet_%d_%d_fix8.rknn" %(PNET_PYRAMID[0],PNET_PYRAMID[1]);
pnet_rknn = RKNN() #verbose=True,verbose_file='./mobilenet_build.log'
pnet_rknn.load_rknn(rknn_name)
ret = pnet_rknn.init_runtime()
if ret != 0:
print('Init pnet runtime environment failed')
exit(ret)
i+=1
list.append(pnet_rknn)
return list
def main():
imglistfile = "filelist.txt"
minsize = 12
threshold = [0.6, 0.7, 0.7]
factor = 0.709
pnet_rknn_list=init_pnet()
rnet_rknn = RKNN()
onet_rknn = RKNN()
rnet_rknn.load_rknn('./RNet_fix8.rknn')
onet_rknn.load_rknn('./ONet_fix8.rknn')
ret = rnet_rknn.init_runtime()
if ret != 0:
print('Init rnet runtime environment failed')
exit(ret)
ret = onet_rknn.init_runtime()
if ret != 0:
print('Init onet runtime environment failed')
exit(ret)
f = open(imglistfile, 'r')
for imgpath in f.readlines():
imgpath = imgpath.split('\n')[0]
print('------------------------------------------------------------')
print(imgpath)
img = cv2.imread(imgpath)
img_matlab = img.copy()
img_matlab = cv2.cvtColor(img_matlab, cv2.COLOR_BGR2RGB)
pnet_rknn_list[0].eval_perf(inputs=[img_matlab],is_print=True) #报错的地方在这里!!!!!!!!
# check rgb position
#tic()
print("1111111111 detect_face")
boundingboxes, points = detect_face(img_matlab, minsize, pnet_rknn_list, rnet_rknn, onet_rknn, threshold, False, factor)
print("2222222222 drawBoxes")
img = drawBoxes(img, boundingboxes)
print("3333333333 save_img")
savePath = 'face_result/fix8_'+imgpath.split('/')[1]
cv2.imwrite(savePath,img)
#cv2.imshow('img', img)
#ch = cv2.waitKey(10000) & 0xFF
print("break now")
f.close()
for i in range(7):
pnet_rknn_list.release()
rnet_rknn.release()
onet_rknn.release()
|
|