[Python] YOLOv8 Custom Model Fails to Detect Card Elements — What Am I Doing Wrong?

Discussão em 'Python' iniciado por Stack, Junho 17, 2025.

  1. Stack

    Stack Membro Participativo

    I’m working on a card verification system where the goal is to detect fixed visual elements on a card (e.g., logo, photo, chip, signature) using computer vision.

    Given a photo of a card, I want to detect whether certain key elements are present or not.

    To do this, I trained a custom YOLOv8 model using the following setup:

    from ultralytics import YOLO

    model = YOLO("yolov8m.yaml") # building a new model from scratch
    model.train(data='config.yaml', epochs=20, imgsz=512, batch=16)


    I prepared two types of datasets, both with 80 images:


    1. Uncropped card photos: full-frame card photos taken from a distance, annotated with labels for elements like logo, chip, photo, etc.


    2. Cropped card images: only the card area itself, annotated similarly.

    I used different lighting conditions and angles, and each image features a different card. However, I did not standardize the image sizes — I kept them in their original resolutions instead of resizing them to a fixed size. I also did not apply any data augmentation beyond the natural variety in the photos.

    All annotations were done using bounding boxes (YOLO format). Despite training, the results were very poor — the model rarely detected anything correctly.

    Any idea what I might be doing wrong? Am I using the wrong approach for detecting fixed elements on cards? Thanks in advance for any insights or suggestions!

    Continue reading...

Compartilhe esta Página