Unusual behavior in the graphs resulting from model.train

Good morning, kind regards.
I am using YOLO for the classification of a class (fruits). I have made my own dataset with training (80 images), validation (15 images) and testing (10 images) data. When applying the attached code and reviewing the results returned by model.train (see attached image), I notice unusual behavior in these plots, such as sudden variations in the val/cls_loss, metrics/precision(B), metrics/recall(B), metrics/mAP50(B) or metrics/mAP50-95(B) plots. I have obtained similar results with YOLO versions 10 and 11 and tried to freeze the YOLO pre-trained weights with the COCO dataset.
I want to eliminate those large variations and have a properly exponential workout.
Thank you very much, I appreciate your knowledgeable input.

Translated with DeepL.com (free version)

from google.colab import drive
drive.mount('/content/drive')

import yaml

data={
    'path': '/content/drive/MyDrive/Proyecto_de_grado/data',
    'train': 'train',
    'val': 'val',
    'names': {
        0: 'fruta'
    }
}

with open('/content/drive/MyDrive/Proyecto_de_grado/data.yaml', 'w') as file:
    yaml.dump(data, file,default_flow_style=False,sort_keys=False)

!pip install ultralytics

from ultralytics import YOLO

model=YOLO('yolo11s.pt')
#CONGELAR CAPAS
Frez_layers=24 #Cantidad de capas a congelar máx 23. Capas backbone hasta la 9. Capas neck de la 10 a la 22.
freeze = [f"model.{x}." for x in range(0,Frez_layers)]  # capas "module" congeladas
print(freeze)
frozen_params={}
for k, v in model.named_parameters():
  #print(k)
  v.requires_grad = True  # train all layers
  frozen_params[k] = v.data.clone()
  #print(v.data.clone())
  #print(v.requires_grad)
  if any(x in k for x in freeze): #Si uno de los elementos en freeze es una subcadena del texto k, entra al bucle
   print(f"freezing {k}")
   v.requires_grad = False

result=model.train(data="/content/drive/MyDrive/Proyecto_de_grado/data.yaml",
                   epochs=100,patience=50,batch=16,plots=True,optimizer="auto",lr0=1e-4,seed=42,project="/content/drive/MyDrive/Proyecto_de_grado/runs/freeze_layers/todo_congelado_11s")

metrics = model.val(data='/content/drive/MyDrive/Proyecto_de_grado/data.yaml',
                    project='/content/drive/MyDrive/Proyecto_de_grado/runs/validation/todo_congelado_11s')
print(metrics)
print(metrics.box.map) #mAP50-95

Collect more data. 100 images is not sufficient

1 Like