Yolo training output

Hi, I just trained a yolov8 model on a PPE dataset and I got the above image as one of the training output files.

I need some help understanding what the top right graph and both bottom graphs mean.

Thanks in advance.

Hi Mahmoud!
Hope you are doing well. The top right graph is just the plot of your bounding boxes. It is the plot of all your bounding boxes that were predicted by YOLOv8 in your training dataset.

The below-left plot is a ‘x vs y’ scatter plot ( where the pair (x,y) is the centre coordinates of your bounding box).
The below-right plot is a ‘height vs width’ scatter plot(where the pair (width, height) refers to the width and height of those bounding boxes).
One point in the graphs maps to one predicted bounding box.
I assume that you know how YOLO works in general if not do refer the lecture and the papers.
Regards,
Nithin

1 Like

Hi Nithin,
I appreciate your valuable response. So, these bounding boxes are the predicted ones not the ground truth boxes of my data?

Hey @Mahmoud_Zidan,
Yes, I believe that the image depicts the predicted bounding boxes and the associated statistics for one of the images in your training dataset, since as you mentioned, you got this file while “training”.

Had the image been depicting both (ground truth boxes and the predicted ones), there would be some kind of “legend” mentioned in the figure. Since you have trained the model yourself, I believe you can go over the code for plotting once to understand in more depth what does this image depicts. Let us know if this resolves your query.

Cheers,
Elemento

1 Like

okay, I trained my model for further epochs and the generated labels.jpg file is still the same, so I think it is for my dataset ground truth bounding boxes.

Ultralytics code is open source…you really don’t have to guess what it is doing. Here is an excerpt from the function plot_labels() found in ultralytics/yolo/utils/plotting.py

# Plot dataset labels
LOGGER.info(f"Plotting labels to {save_dir / 'labels.jpg'}... ")

Followed by the code that generates the image components. In the fragment below, the boxes are given an image-relative common center coordinate, wh is converted to xy and the rectangles are drawn with class-correct color.

# Rectangles
boxes[:, 0:2] = 0.5  # center
boxes = xywh2xyxy(boxes) * 1000
img = Image.fromarray(np.ones((1000, 1000, 3), dtype=np.uint8) * 255)
for cls, box in zip(cls[:500], boxes[:500]):
    ImageDraw.Draw(img).rectangle(box, width=1, outline=colors(cls))  # plot
ax[1].imshow(img)

Need to know how you called the function, but looks like its intended to be for ground truth aka dataset to me

Hi @ai_curious !
I tried the open source implementation few days ago and yes it belongs to our dataset (ground truth boxes) and we need not explicitly call the function, it automatically saves it in our target folder (they call the function implicitly everytime when we call the train function).

You might want to revisit your post above since there seems to be consensus here that labels.jpg is made up of training inputs, Y, and not predicted , \hat{Y}, bounding boxes.

I’m sorry for that. I wasn’t sure at that point of time, but once Zidan felt that it was for ground truth boxes, I tried to implement it and confirmed it later that it is meant for ground truth boxes (Y).