Plastic pollution has become a pressing environmental issue, significantly impacting marine ecosystems worldwide. Identifying, classifying, and detecting plastic waste, both on the water's surface and underwater, is critical for understanding pollution patterns and implementing effective mitigation strategies. Leveraging advanced machine learning models, this project aims to detect, classify, and analyze plastic waste in aquatic environments, combining datasets from diverse sources and cutting-edge algorithms like YOLO and CLIP.
Our work encompasses three primary objectives:
By employing these techniques, this project addresses key challenges in marine conservation, offering insights into plastic pollution patterns and aiding in its mitigation.
For each dataset, we created a quick analysis.ipynb
to examine the annotated instance distribution, their spatial distribution, and other related aspects.
Trash
.Data YAML Structure:
train: ../train/images val: ../valid/images test: ../test/images nc: 1 names: ['Trash']
In this section, we will demonstrate how to detect and manage duplicate images in the dataset. This can be useful for cleaning up redundant data, improving training efficiency, and ensuring that your dataset contains unique images for model training. The method leverages cosine similarity to compare image embeddings, identifying duplicates based on a similarity threshold.
Goal
The goal of this script is to identify similar or duplicate images in the dataset by calculating the cosine similarity between the embeddings of the images. If the similarity score between two images exceeds a specified threshold, they are considered duplicates.
Key Steps
OpenCLIP
and transformed into embeddings.Parameters to Change
images_path
: This list defines the directories containing the images you want to check for duplicates.output_path
: Specify the path where the resulting JSON file containing the duplicates will be.threshold
: This parameter defines the cosine similarity threshold above which two images will be considered duplicates. The default value is 0.95, meaning that two images must be at least 95% similar to be flagged as duplicates. You can adjust this value based on your requirements.Run
python final_dataset\removeDuplicate.py
Check Output: After the script runs, the duplicate.json file will contain a list of duplicate images and their similarity scores, formatted like this:
[ { "duplicate": "path_to_image_1.jpg", "equal_to": "path_to_image_2.jpg", "similarity": 98.25 }, ]
Improvement
While the image duplication detection method presented here is effective, we ultimately decided not to use it on our dataset for the following reasons:
In this section, we describe the model used for detecting plastic pollution in ocean environments. The model is based on Ultralytics YOLOv11, a popular and efficient object detection algorithm known for its high speed and accuracy. We specifically use a pre-trained YOLO model (yolo11n.pt
) for detecting various types of plastic waste in underwater scenes.
Look notebook yolo_run.ipynb
.
Parameters :
epochs
: 23batch
: 16lr0
: 0.01dropout
: 0.15imgsz
: 64Note : We trained the model using a Google Colab notebook with the free T4 GPU, leveraging the cloud-based resources to accelerate the training process.
For evaluating the performance of our YOLO model in detecting plastic waste, we utilized the Intersection over Union (IoU) metric to compare predicted bounding boxes with ground truth labels. IoU is a commonly used metric in object detection tasks, which measures the overlap between the predicted and actual bounding boxes.
IoU Threshold: We fixed the IoU threshold at 70%. This means:
Performance Metrics:
Results on the Test Dataset:
Missed | Background | Duplicates | Bad Localization | Mean IoU | Total Detections |
---|---|---|---|---|---|
226 | 332 | 911 | 456 | 0.692268 | 1699 |
To address these issues, we could:
In this section, we utilized OpenAI's CLIP model (clip-vit-large-patch14
) to classify images as representing either the surface of the water or under the water. This approach leverages CLIP's ability to compute similarity between textual and visual representations, making it a powerful tool for semantic image classification.
The classification of images into "surface of the water" or "under the water" serves several important purposes:
Improved Object Detection: Images from underwater scenes often exhibit different visual characteristics, such as altered lighting and contrast, compared to surface images. Classifying these images enables better preprocessing and more effective fine-tuning of object detection models.
Environmental Analysis: Differentiating between surface and underwater images allows researchers to focus on specific environmental issues, such as tracking floating plastic debris on the water's surface or examining marine life and pollution below the water.
Data Organization: Sorting images into distinct categories ensures a well-organized dataset, which simplifies further analysis and machine learning workflows.
The CLIP model was used to assign each image to one of two predefined categories: "surface of the water" or "under the water." For each image:
To assess the model's performance, a subset of the test images was manually annotated. This allowed us to compare the model's predictions against ground truth labels, providing insight into its classification accuracy.
By leveraging CLIP's capability to understand image-text relationships, this workflow demonstrated an efficient and versatile method for classifying marine images into surface and underwater categories.
There are no models linked
There are no models linked