Toybrick

标题: yolov4 模型转rknn模型,在rk3399prod推理一帧时间2.3s [打印本页]

作者: hhhjjjwww    时间: 2021-10-27 17:45
标题: yolov4 模型转rknn模型,在rk3399prod推理一帧时间2.3s
模型转换代码参考官方提供的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。大家遇到过这样的问题吗?







欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3