pytorch-YOLOv4 icon indicating copy to clipboard operation
pytorch-YOLOv4 copied to clipboard

do_detect() takes from 4 to 5 positional arguments but 6 were given

Open rmutalik opened this issue 3 years ago • 5 comments

In pytorch-YOLOv4/evaluate_on_coco.py, line 176, it shows:

do_detect(model, throwaway_image, 0.5, 80, 0.4, use_cuda)

But in the do_detect definition, in file pytorch-YOLOv4/tool/torch_utils.py, line 76, the function definition only shows 5 positional arguments.

def do_detect(model, img, conf_thresh, nms_thresh, use_cuda=1)

The '80' should be removed from evaluate_on_coco.py.

rmutalik avatar Apr 16 '21 02:04 rmutalik

Agreed, 2 occurences of do_detect() need to be fixed in this evaluate_on_coco.py file.

BruceDai003 avatar Apr 19 '21 03:04 BruceDai003

remove that 0.4 ( confidence ) and it will work but you will get another error regarding unknown image type

MohamedElsaeidy avatar Apr 19 '21 19:04 MohamedElsaeidy

remove that 0.4 ( confidence ) and it will work but you will get another error regarding unknown image type

I don't think you should remove the conf_thresh, instead you should remove the 80, which probably is an argument like max_num_pred, because if you check the definition of do_detect, you will see that there is conf_thresh and nms_thresh, but no argument like max_num_pred. Regarding the datatype error, I think it should be replaced with cv2.imread, I have fixed this. Maybe I will do a PR later.

BruceDai003 avatar Apr 20 '21 14:04 BruceDai003

I don't think you should remove the conf_thresh, instead you should remove the 80, which probably is an argument like max_num_pred, because if you check the definition of do_detect, you will see that there is conf_thresh and nms_thresh, but no argument like max_num_pred.

I think the '80' refers to the default number of classes.

rmutalik avatar Apr 28 '21 14:04 rmutalik

remove that 0.4 ( confidence ) and it will work but you will get another error regarding unknown image type

I don't think you should remove the conf_thresh, instead you should remove the 80, which probably is an argument like max_num_pred, because if you check the definition of do_detect, you will see that there is conf_thresh and nms_thresh, but no argument like max_num_pred. Regarding the datatype error, I think it should be replaced with cv2.imread, I have fixed this. Maybe I will do a PR later.

Hi sir, can you tell replace cv2.imread with what?

MheadHero avatar May 24 '22 14:05 MheadHero