加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
trans-yolofastest.py 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
Your Name 提交于 2024-03-05 22:11 . dd
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
modelConfiguration = "Yolo-Fastest-voc/yolov3-tiny.cfg"
modelWeights = "Yolo-Fastest-voc/yolov3-tiny.weights"
# modelConfiguration = "Yolo-Fastest-voc/yolo-fastest-xl.cfg"
# modelWeights = "Yolo-Fastest-voc/yolo-fastest-xl.weights"
# modelConfiguration = "Yolo-Fastest-coco/yolo-fastest-xl.cfg"
# modelWeights = "Yolo-Fastest-coco/yolo-fastest-xl.weights"
# modelConfiguration = "backup/yolo-fastest.cfg"
# modelWeights = "backup/yolo-fastest_best.weights"
if __name__ == '__main__':
rknn=RKNN()
rknn.config(mean_values=[0,0,0],std_values=[255,255,255],target_platform='rk3566')
print('load model...')
ret = rknn.load_darknet(model=modelConfiguration, weight=modelWeights)
print("ret")
print(ret)
if ret != 0:
print('load err...')
exit(ret)
print('done')
print('building...')
ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
if ret != 0:
print('build fail!')
exit(ret)
print('done')
ret = rknn.export_rknn('./yolov3-tiny_3566.rknn')
if ret != 0:
print('export fail!')
exit(ret)
exit(0)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化