15-494/694 Cognitive Robotics: Segmenter Training

  1. We're going to use the YOLO26 segmenter from Ultralytics. You should have already installed the ultralytics package back in Lab 7, but if necessary, you can install it now by activating your virtual environment and then doing "pip install untralytics".

  2. YOLO26 comes in five sizes, denoted by a one-letter code: (n)ano, (s)mall, (m)edium, (l)arge, and e(x)tra large. It also comes in several variants for detection, segmentation, etc. We're going to use the small segmentation model, named yolo26s-segment.

  3. Download train_segmenter.py into your lab8 folder.

  4. Run the program to train your segmenter.

  5. cd to the lab8/runs/segment folder and you will see folders named "train", "train2", etc., depending on how many times you've run the training script. cd to the latest one.

  6. Examine the images in this folder to see the results of training.

  7. cd back to your lab8/data folder.

  8. Download test_segmenter.py into your lab8 folder.

  9. If you have done more than one training run, edit test_segmenter.py to set the WEIGHTS_VERSION variable to the correct folder.

  10. Run the program and type a space in the cv2 window to move through the test images.

  11. If you're not satisfied with the results, consider either training for more epochs or expanding your dataset.


Dave Touretzky