This project is aimed at detecting oil spills using a YOLOv8s model for my graduate work in magistracy.
It includes scripts for splitting the dataset, training the model, and making predictions on images.
This project is based on Ultralytics.
- Create and activate virtual environment with virtualenv
virtualenv <virtual_environment_name>
source ./<virtual_environment_name>/bin/activate- Install Ultralytics and other dependencies
pip install utlralytics/
pip install requirements.txtNow you can train the model or predict if you have one trained already.
- Train the model Rename config.yaml.example to <your_desired_name>.yaml file and use it. Edit this config if you need.
python train.py --config <path_to_configuration.yaml>- Predict
python predict.py <path_to_model.pt> <path_to_folder_with_images> --conf <desired_confidence_level> --saveDataset should be structured like:
dataset/
├── images/
│ ├── image1.jpg
│ ├── image2.jpg
│ └── ...
├── labels/
│ ├── image1.txt
│ ├── image2.txt
│ └── ...
Class names should be specified in <configuration_name>.yaml that you would pass to the train.py script