Closed Tom-Teamo closed 4 months ago
由于我想调试代码以便更好地了解一下YOLO的具体流程,但是我在python Jupyter使用如下代码:
python Jupyter
engine_path = '/home/TensorRT-YOLO/demo/detect/models/yolov8s.engine' model = TRTYOLO(engine_path) image_path = '/home/TensorRT-YOLO/demo/detect/images' batcher = ImageBatcher(input_path=image_path, batch_size=model.batch_size, imgsz=model.imgsz, dtype=model.dtype, dynamic=model.dynamic) model.warmup() for batch, images, batch_shape in batcher: detections = model.infer(batch, batch_shape)
会在post_process中出现KeyError: 'num_dets',在post_process函数中,outputs.keys()如下,所以会出现KeyError
post_process
outputs.keys()
KeyError
dict_keys(['num_detections', 'detection_boxes', 'detection_scores', 'detection_classes'])
但是在python CLI中:trtyolo infer -e models/yolov8s.engine -i images -o output -l labels.txt 并没有报错
trtyolo infer -e models/yolov8s.engine -i images -o output -l labels.txt
两者的源代码版本是一致的,请问这是为什么?
重新导出模型即可。
新版本导出的模型对节点名称做了修改,参考https://github.com/laugh12321/TensorRT-YOLO/commit/2d3d630625430e91bd896c2cf5abd26aa7a9b041
你使用了老版本导出的模型,但是用新版本代码进行推理。
由于我想调试代码以便更好地了解一下YOLO的具体流程,但是我在
python Jupyter
使用如下代码:会在
post_process
中出现KeyError: 'num_dets',在post_process
函数中,outputs.keys()
如下,所以会出现KeyError
但是在python CLI中:
trtyolo infer -e models/yolov8s.engine -i images -o output -l labels.txt
并没有报错两者的源代码版本是一致的,请问这是为什么?