WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.98k stars 524 forks source link

NameError: name 'Ensemble' is not defined #79

Open VYRION-Ai opened 2 years ago

VYRION-Ai commented 2 years ago

i try to detecting on local pc , put i got this error

File "detect.py", line 197, in detect() File "detect.py", line 45, in detect model = attempt_load(weights, map_location=device) # load FP32 model File "E:\Python\yolor-main\yolor-main\utils\google_utils.py", line 40, in attempt_load model = Ensemble() NameError: name 'Ensemble' is not defined

WongKinYiu commented 2 years ago

https://github.com/WongKinYiu/yolor/blob/main/detect.py#L45

hmm... i think line 45 won't be run. do u modify the code?

VYRION-Ai commented 2 years ago

https://github.com/WongKinYiu/yolor/blob/main/detect.py#L45

hmm... i think line 45 won't be run. do u modify the code?

yes i comment line 43 and 44 and remove comment from 45 ,

#model = Darknet(cfg, imgsz).cuda()
#model.load_state_dict(torch.load(weights[0], map_location=device)['model'])
model = attempt_load(weights, map_location=device)  # load FP32 model
WongKinYiu commented 2 years ago

attemp_load is used for loading weights in paper branch.

VYRION-Ai commented 2 years ago

attemp_load is used for loading weights in paper branch.

What I am doing, is i want to run the detect.py file on my laptop ( which don't have GPU) ,with my best.pt file , so i want to run it on CPU , that is why I do what I done