Dalia Mahdy
Dalia Mahdy

Reputation: 21

YOLO v5 inference on test images

I am training my custom dataset created on roboflow on YOLOv5. When the training is done and I run inference, I get black images with no labels. I am not sure what is the problem.

enter image description here

Upvotes: 0

Views: 2584

Answers (2)

ベスマ・ゲスミ
ベスマ・ゲスミ

Reputation: 326

First, try to decrease the confidence value (e.g conf 0.2) in the case you train the model with few epochs or few datasets then try to precise your image (try to use one image): --source /content/dataset/test/images/image_10_jpg.jpg

and see how it goes

Upvotes: 0

Anselme Atchogou
Anselme Atchogou

Reputation: 11

This command indicates the source of the images you want to test.

!python detect.py --weights runs/train/exp/weights/best.pt --img 416 --conf 0.1 **--source {dataset. Location}/test/images**

So you have to copy the images to test in {dataset. Location}/test/images or indicate another source.

Dataset test image directory

Then, at the end of the execution of this command, the last line indicates the directory in which the result is located.

Ex : Results saved to runs/detect/exp10

Finally, run this command to see the result.

import glob
from IPython.display import Image, display

for imageName in glob.glob('/content/yolov5/runs/detect/exp10/*.jpg'): #assuming JPG
    display(Image(filename=imageName))
    print("\n")

Enjoy

Upvotes: 1

Related Questions