[Python] Testing yolo pretrained model on my hand annotated dataset

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataset of around 500 images with two classes which are both in COCO dataset, person and cell phone, I want to get a baseline to see how well the pretrained yolo works on that dataset but I can't get it to work. Cell phone is class 67 in the COCO dataset and person is class 0, in my dataset they are 0 and 1 since I was hand annotating. I tried many things but it either throws me an error, or tries to detect people and bycicles (since in the COCO dataset bycicle is 1), I've tried remapping my annotatons from 1 -> 67 but it still didn't work. These are my current dataset.yaml and testing script:

    path: /data/dataset_split

    train: train/images
    val: val/images

    nc: 2

    names: ['person','cell phone']


    from ultralytics import YOLO

    model = YOLO('yolov8m.pt')


    metrics = model.val(
    data='../data/dataset_split/dataset.yaml',
    imgsz=640,
    classes=[0, 67],
    )
    print(metrics.box)


    Any help is appreciated.

    Continue reading...

Compartilhe esta Página