How ahsan47-hq/weed-detection-project works
This repository is a weed-image preparation and instance-segmentation workflow, not the full-stack application mentioned in the README. Its principal path prepares datasets, generates SAM2 masks and YOLO polygon labels, cleans the training set, then trains and evaluates YOLOv8-Seg. It also contains DeepWeeds augmentation/dataset support and a separate CWFID resize-and-split utility. The main pipeline stages are documented in the README; source-level evidence is available for the SAM conversion, training, and augmentation components, but not every utility or the evaluation script.
Main entry points: train_yolov8_seg.py YOLOv8-Seg training · sam_masks_to_yolo.py SAM2 mask generation · split_deepweeds.py DeepWeeds split · create_annotations_yolo.py YOLO dataset creation
Components 17
Dataset preparation
- Raw weed images
- DeepWeeds split
src/utils/split_deepweeds.py - YOLO dataset creation
src/utils/create_annotations_yolo.py - CWFID resize and split
src/utils/resize_split_cwfid.py - Training-set cleanup
src/utils/preparing_for_yoloseg_training.py - Dataset configuration
src/utils/create_data_yaml.py
Mask annotation
- SAM2 mask generation
src/utils/sam_masks_to_yolo.py - SAM2 predictor
- Mask filtering and refinement
src/utils/sam_masks_to_yolo.py - YOLO polygon labels
src/utils/sam_masks_to_yolo.py
Model training and evaluation
- YOLOv8-Seg training
src/utils/train_yolov8_seg.py - Ultralytics YOLO
- Segmentation prediction
src/utils/test_yolov8_seg.py - Training and test results
results
Training support
- DeepWeeds augmentations
src/utils/deepweeds_augmentation.py - YOLO dataset adapter
src/utils/deepweeds_yolo_dataset.py
Other components
- Dataset operator
Connections 16
- Dataset operator → Raw weed images: provides images
README.md - Raw weed images → DeepWeeds split: splits labels
src/utils/split_deepweeds.py - DeepWeeds split → YOLO dataset creation: supplies splits
src/utils/create_annotations_yolo.py - Raw weed images → CWFID resize and split: resizes and splits
src/utils/resize_split_cwfid.py - YOLO dataset creation → SAM2 mask generation: prepares images
README.md - SAM2 mask generation → SAM2 predictor: requests masks
src/utils/sam_masks_to_yolo.py - SAM2 mask generation → Mask filtering and refinement: filters masks
src/utils/sam_masks_to_yolo.py - Mask filtering and refinement → YOLO polygon labels: writes polygons
src/utils/sam_masks_to_yolo.py - YOLO polygon labels → Training-set cleanup: selects images
src/utils/preparing_for_yoloseg_training.py - Training-set cleanup → YOLOv8-Seg training: prepares training data
README.md - Dataset configuration → YOLOv8-Seg training: configures dataset
README.md - YOLOv8-Seg training → Ultralytics YOLO: trains model
src/utils/train_yolov8_seg.py - YOLOv8-Seg training → Segmentation prediction: predicts with best model
src/utils/train_yolov8_seg.py - Ultralytics YOLO → Training and test results: writes run artifacts
- Segmentation prediction → Training and test results: saves predictions
README.md - YOLO dataset adapter → DeepWeeds augmentations: applies during training
src/utils/deepweeds_yolo_dataset.py