About Yolo Configuration File (YAML)

I am using YOLO-8 for training rice disease detection. The configuration of yaml files are:

  train: /content/drive/MyDrive/ResearchWork/DataSet/YOLO dataset/Set-3/train/images
  val: /content/drive/MyDrive/ResearchWork/DataSet/YOLO dataset/Set-3/valid/images
  test: /content/drive/MyDrive/ResearchWork/DataSet/YOLO dataset/Set-3/test/images
  nc: 11
  names: ['Bacterial blight', 'Bacterial leaf', 'Brown spot', 'Cuterpillar', 'Drainage impact', 'Grashopper damage', 'Grassy stunt', 'Leaf folder', 'Sheath blight', 'Stem borer', 'Tungro']

Can I skip few class (like Tungro,Brown spot etc) during training testing & valdations without changing dataset or annonations.

Hello! :blush:

Yes, you can skip certain classes during training, validation, and testing without altering your dataset or annotations. You can achieve this by using the classes argument in your training script to specify which classes you want to include. Here’s a quick example:

from ultralytics import YOLO

# Load your model
model = YOLO('yolov8n.pt')

# Train the model, specifying the classes you want to include
model.train(data='your_data.yaml', classes=[0, 1, 3, 4, 5, 6, 7, 8, 9])  # Excludes 'Tungro' and 'Brown spot'

In this example, replace the indices in the classes list with those corresponding to the classes you want to include. The indices should match the order in your names list.

For more details, you can check out the Ultralytics documentation.

If you have any more questions, feel free to ask! :rocket:

1 Like

Thanks for the quick response.