相关函数如下:
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)