Object detection from images is an ongoing challenge in computer vision. One of the most accurate and fast models is YOLOv7, which can also perform image segmentation.


The task was to provide a script to perform card detection and segmentation using a dataset comprising 1500 cards with front and back images for each card segmented with a 4 points polygon.


We first offered a Python script to prepare the dataset in the correct format (see Then we trained the model on the custom dataset, achieving a precision of 0.989, a recall of 0.995, and a mAP of 0.994. Finally, we provide a Python class taking a list of numpy arrays and returning one array by card to easily incorporate the detection into an analysis pipeline.