A collection of notebooks for training, preprocessing, and deploying YOLO object-detection models on visual inspection tasks, plus a Faster R-CNN benchmark.
This repository provides a notebook-based object-detection pipeline:
- Convert image annotations from CSV format to YOLO text labels.
- Train a YOLO model with mosaic, mixup, rotation, scaling, and HSV augmentation.
- Run inference on new images and produce a submission CSV.
- Benchmark a Faster R-CNN (ResNet-50 FPN) model against the YOLO run.
The current notebooks are configured with a crop-disease detection example. The same pipeline can be retargeted to rail-track or other infrastructure inspection by replacing the dataset and the class names in data.yaml.
- Data preparation:
Train.csvis split into train and validation sets, and bounding boxes are normalized to YOLO format. - Preprocessing:
Preprocessing_Enhancement_Module.ipynbsets up image and label directories and applies basic brightness enhancement. - Training:
Train_Rail_Fault_Detector.ipynbtrains a YOLO model using Ultralytics, with mixed precision and SGD optimization. - Inference:
Inference_Deploy.ipynbloads the trained model and writes predicted boxes and classes tosubmission.csv. - Benchmark:
Research_Experiment_FasterRCNN.ipynbtrains a Faster R-CNN detector on the same splits for comparison.
- Python 3
- Ultralytics YOLO
- PyTorch / torchvision
- OpenCV
- pandas, scikit-learn
- Google Colab or Jupyter
No final evaluation score is committed to the README. The training notebook prints validation metrics such as mAP@50, precision, and recall after each run, so results can be read directly from the notebook outputs. Scores will vary with the dataset and hyperparameters.
- Install dependencies:
pip install ultralytics opencv-python pandas numpy scikit-learn
- Prepare your dataset and update the file paths in the notebooks.
- Run
Preprocessing_Enhancement_Module.ipynbto build the YOLO directory structure. - Run
Train_Rail_Fault_Detector.ipynbto train the YOLO model. - Run
Inference_Deploy.ipynbto generate predictions on new images. - (Optional) Run
Research_Experiment_FasterRCNN.ipynbto compare with Faster R-CNN.
Notebook pipeline template; currently configured with a crop-disease example, retargetable to rail inspection or other visual-inspection tasks by replacing the dataset and data.yaml class names.
No license is specified in this repository.
Suggested descriptions (<=160 chars):
- YOLO object-detection training, inference, and Faster R-CNN benchmarking notebooks for visual inspection.
- Notebook-based YOLO pipeline for visual inspection, with a Faster R-CNN benchmark.
Suggested topic tags:
yolo, object-detection, ultralytics, pytorch, computer-vision