'YOLOv5 Custom Dataset -- Where is Model?

So I collected images from the OpenImages (Google) dataset for 10 classes and ran the training locally for 100 epochs. Now trying to run the detect.py using one of my security cameras as the source (rtsp:// etc.). It finds that OK, but reports finding a "traffic light", although there is no traffic light in the stream or in the image data that I trained with, and that is not one of the named classes, so clearly its picking up spurious input from somewhere.

Here is my dataset.yaml file (sorry I don't know how to get this to format correctly):

    # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
# COCO128 dataset https://www.kaggle.com/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
# Example usage: python train.py --data coco128.yaml
# parent
# ├── yolov5
# └── datasets
#     └── coco128  ← downloads here


# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
#path: C:/YoloData  # dataset root dir
train: C:/YoloData/images  # train images (relative to 'path') 
val: C:/YoloData/images  # val images (relative to 'path') 128 images

# Classes
nc: 10  # number of classes
names: ['Cat','Dog','Person','Fox','Raven','Rabbit',
        'Deer','Raccoon','Skunk','Armadillo']  # class names

I've moved every other yaml file out of reach, and I'm kicking the detect script off with a bat file in Windows; this is the command:

python detectModified.py --weights yolov5m.pt --conf-thres 0.6 --name camera128 --nosave --save-txt --classes 0 1 2 3 4 5 6 7 8 9

The detect script has been modified to specify the location of the data; when executed, here is the response:

C:\YOLO>python detectModified.py --weights yolov5m.pt --conf-thres 0.6 --name camera128 --nosave --save-txt --classes 0 1 2 3 4 5 6 7 8 9 detectModified: weights=['yolov5m.pt'], source=rtsp://userid:[email protected]:554/ch0/main/av_stream, data=data\dataset.yaml, imgsz=[3072, 3072], conf_thres=0.6, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=True, save_conf=False, save_crop=False, nosave=True, classes=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=camera128, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False YOLOv5 2022-2-16 torch 1.7.0+cu110 CUDA:0

(Quadro P3000, 6144MiB)

Fusing layers...

Since it thinks it found a traffic light, clearly it's not looking where I'm expecting. Can anyone shed some light? I'd also be grateful for some decent documentation on these scripts (both train.py and detect.py) -- there are a lot of arguments but not much explanation.



Solution 1:[1]

When the training completes you will find the weights in this folder: runs/train/exp/weights/best.pt

There was a similar question before that I answered here https://stackoverflow.com/a/70255031/5183735

But I am not sure if you have the same question or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1