8000 请问:测试的时候出现这种错误怎么办,还有所得到的result的构成是怎样的? · Issue #25 · wuzhihao7788/yolodet-pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
请问:测试的时候出现这种错误怎么办,还有所得到的result的构成是怎样的? #25
Open
@searchstorm

Description

@searchstorm

错误: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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development 2B8F

    No branches or pull requests

    Issue actions

      0