1 Star 0 Fork 0

djboy1021/YOLOv8-TensorRT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.py 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
triple-Mu 提交于 2023-02-09 17:20 . Refactor code for detection and segment
import argparse
from models import EngineBuilder
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--weights',
type=str,
required=True,
help='Weights file')
parser.add_argument('--iou-thres',
type=float,
default=0.65,
help='IOU threshoud for NMS plugin')
parser.add_argument('--conf-thres',
type=float,
default=0.25,
help='CONF threshoud for NMS plugin')
parser.add_argument('--topk',
type=int,
default=100,
help='Max number of detection bboxes')
parser.add_argument('--input-shape',
nargs='+',
type=int,
default=[1, 3, 640, 640],
help='Model input shape only for api builder')
parser.add_argument('--fp16',
action='store_true',
help='Build model with fp16 mode')
parser.add_argument('--device',
type=str,
default='cuda:0',
help='TensorRT builder device')
parser.add_argument('--seg',
action='store_true',
help='Build seg model by onnx')
args = parser.parse_args()
assert len(args.input_shape) == 4
return args
def main(args):
builder = EngineBuilder(args.weights, args.device)
builder.seg = args.seg
builder.build(fp16=args.fp16,
input_shape=args.input_shape,
iou_thres=args.iou_thres,
conf_thres=args.conf_thres,
topk=args.topk)
if __name__ == '__main__':
args = parse_args()
main(args)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/djboy1021/YOLOv8-TensorRT.git
git@gitee.com:djboy1021/YOLOv8-TensorRT.git
djboy1021
YOLOv8-TensorRT
YOLOv8-TensorRT
main

搜索帮助