Open
Description
错误:show_result(img, result, model.CLASSES)
File "yolodet-pytorch/yolodet/apis/inference.py", line 168, in show_result
label = rslt['label']
IndexError: too many indices for tensor of dimension 3
代码:
from yolodet.apis.inference import inference_detector,init_detector,show_result
import os
config_file ='cfg/yolov4_gpu.py'
checkpoint_file ='work_dirs/yolov4/latest.pth'
build the model from a config file and a checkpoint file
model = init_detector(config_file, checkpoint_file, device='cuda:0')
test a single image and show the results
img ='test.jpg' # or img = mmcv.imread(img), which will only load it once
result,t = inference_detector(model, img)
print('%s Done , object num : %s .time:(%.3fs)' % (img,len(result), t))
visualize the results in a new window
show_result(img, result, model.CLASSES)
Metadata
Metadata
Assignees
Labels
No labels