|
模型转换代码参考官方提供的yolov3_demo,转换代码如下
from PIL import Image
import numpy as np
#from matplotlib import pyplot as plt
import re
import math
import random
from rknn.api import RKNN
if __name__ == '__main__':
# Create RKNN object
rknn = RKNN()
# Load tensorflow model
print('--> Loading model')
rknn.load_darknet(model='./yolov4-custom.cfg', weight="./yolov4-custom_best.weights")
print('done')
rknn.config(channel_mean_value='0 0 0 255', reorder_channel='0 1 2', batch_size=1)
# Build model
print('--> Building model')
rknn.build(do_quantization=True, dataset='./dataset_608x608.txt', pre_compile=True)
print('done')
rknn.export_rknn('./yolov4_person_hand_1_608x608.rknn')
exit(0)
转换后在板子上推理时间竟然要2.3s,yolov4原模型是250M,用darknet训练,转换后是63M。大家遇到过这样的问题吗?
|
|