-
-
Notifications
You must be signed in to change notification settings - Fork 70
Is inconsistent predictions for some versions of Yolov5 intentional? #254
-
Experiment setup:
I install yolov5 with pip install yolov5 in python3.11 on Ubuntu22.
I load yolo with the following command but change the version to either yolov5s, yolov5l, yolov5x, yolov5s6, yolov5l6, yolov5x6: model: = yolov5.load('yolov5s.pt')
I have the following images from coco val2017 saved to my local:
img1 = ["000000195842.jpg"]
imgs = ["000000195842.jpg", "000000289594.jpg", "000000581615.jpg", "000000581781.jpg"]
I then run inference and check the results with:
results1 = model(img1)
print("results1: ", results1)
and
all_results = model(imgs)
print("all_results: ", all_results)
Results
For yolov5s6, yolov5l6, yolov5x6 I get the expected result, i.e., that the predictions for img1 is the same as the first image in imgs. However, for yolov5s, yolov5l, yolov5x The prediction for img1 is different when compared to the prediction of the first image of imgs which does not seem right to me. In all cases the difference is the same:
.../yolov5/models/common.py:709: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.
with amp.autocast(autocast):
results1: image 1/1: 480x640 2 persons, 1 cup, 1 bowl, 1 chair, 2 couchs, 1 bed, 1 dining table, 1 tv, 1 laptop, 4 remotes, 1 book, 1 clock
Speed: 6.9ms pre-process, 752.7ms inference, 1.4ms NMS per image at shape (1, 3, 480, 640)
.../yolov5/models/common.py:709: FutureWarning: `torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.
with amp.autocast(autocast):
all_results: image 1/4: 480x640 1 person, 1 cup, 1 chair, 2 couchs, 1 bed, 1 dining table, 1 tv, 1 laptop, 4 remotes, 1 clock
image 2/4: 640x519 1 person, 2 cars
image 3/4: 640x478 1 toilet
image 4/4: 478x640 17 bananas, 1 orange
Speed: 4.4ms pre-process, 1028.5ms inference, 0.7ms NMS per image at shape (4, 3, 640, 640)
Can anyone tell me why this is happening and if it is intended behavior? It seems strange to me that batch size changes the models output at inference time...
Beta Was this translation helpful? Give feedback.