Technology

Technology

Artificial Intelligence (AI) offers innovative solutions that enhance our ability to monitor, predict, and mitigate environmental issues. One significant contribution of AI in environmental monitoring is its ability to process vast amounts of data from diverse sources, such as satellite imagery, remote sensors, and weather stations. Machine learning (ML) algorithms can analyze these datasets to detect patterns and anomalies, providing insights into environmental changes with high accuracy.

Conventional methods to collect data on beaches about types and number of microplastics involve manual sampling and laboratory analysis, which can be time-consuming and laborious. Also, the participation of unskilled volunteers may lead to inconsistency and unreliable data. Therefore, we aim to integrate AI technology for more efficient and accurate microplastic identification and quantitation.

In our study, we develop automated methods for routine microplastic detection by comparing and evaluating the performances of YOLOv8 and Mask R-CNN machine learning models for single-class and mixed-class microplastics detection. The ultimate goal is to develop an effective deep learning microplastic detection model that can be integrated into an automated robotic car for detection and quantification of microplastic particles in coastal environments. The integration of AI systems in microplastic detection allows continuous monitoring of water bodies using sensor networks and analyzes the collected data to predict pollution levels, sources, and impacts that were previously unattainable.

Mask-RCNN and YOLOv8

Mask-RCNN is an object detection algorithm developed by Facebook. This algorithm expands on the concept of Faster-RCNN, which only creates bounding boxes around detected objects with a class label. With Mask-RCNN, a third branch outputs the object mask. YOLOv8, short for You Only Look Once version 8, developed by Ultralytics—the creators of YOLOv5—is a state-of-the-art computer vision model designed to advance the capabilities of object detection, classification, and segmentation tasks.

Preliminary Test

Our preliminary test included intact and irregular polystyrene (PS) of 5 mm and intact acrylic of 5 mm placed on a glass slide. Each slide was photographed using a mobile phone. A total of 1,060 images of microplastics were obtained, categorized into four classes: 346 images of polystyrene, 319 images of irregular polystyrene, 302 images of acrylic, and 92 mixed images of all types of plastics. The images were annotated using the Roboflow annotation tool, whereas the dataset was split into a 7:2:1 ratio for training, validation, and testing, respectively. We trained Mask-RCNN using 1,000 warm-up iterations, followed by a maximum of 1,500 iterations, with step decay adjustments at iterations 1,000 and 1,400 to manage the learning rate effectively. For YOLOv8, a total of 45 epochs with an image size of 800 pixels was used. It is also worth mentioning that the use of data augmentation is present.

Results

Table 1. Performance metrics evaluated on Mask-RCNN and YOLOv8

Figure 1. Sample images from the test set detected with YOLOv8

Based on the provided model performance metrics (Table 1), it is clear that YOLOv8 outperforms the other models in terms of object detection accuracy. YOLOv8 achieves the highest mAP (mean Average Precision) at the 50%, 75%, and 50-95% thresholds, indicating its superior detection capabilities compared to Mask-RCNN. Notably, YOLOv8 not only has the highest mAP values but also has the lowest number of parameters among the three models. Detection results on tested images showed the confidence scores of microplastic detection by YOLOv8 ranged from 0.8 to 0.9, which was a high score and indicates more confidence (Figure 1). This suggests that YOLOv8 is a more efficient and lightweight model, which can be advantageous for deployment in resource-constrained environments or for applications that require fast inference times. Given the superior performance and lower parameter count, YOLOv8 emerges as the most suitable choice for the microplastic detection task.

Taking it a Step Further

After determining that YOLOv8 is superior, we created another dataset for enhancing model performance. During the summer holiday, we received valuable feedback from EDP regarding potential weaknesses of our model. Firstly, the number of microplastics per photo should be diversified to prevent overfitting and allow the model to perform well with different amounts of microplastics. Furthermore, we should introduce negatives for reducing false positives, thus improving precision. This also allows the model to better identify decisive features, such as textures and refractive properties. Having integrated the suggestions from EPD, our new dataset consisted of 3,640 images of fourteen categories. We then performed a new round of AI training.

Dataset Preparation

A large, diverse dataset encompassing various types, colors, and shapes of microplastics can effectively improve the accuracy and reliability of deep learning models for microplastic detection. To generate sample datasets for model training, the microplastics, including intact and irregular polystyrene (PS) and intact acrylic, were placed on a petri dish and photographed using a mobile phone. A total of 3,639 images of microplastics were obtained and categorized into fourteen classes, as shown in the table. To form a representative set of all categories with a high enough frequency, the number of microplastics, both intact and irregular, were divided into three groups ranging from low (1-20), medium (21-40), and high (41-60). Besides, items other than microplastics, such as leaves and branches, were included in the dataset to ensure the trained models were able to avoid false positives from other environmental contaminants and can accurately identify and quantify microplastics only.

Table 2. Categories and number of microplastics in dataset construction

Adapting YOLOv11

Although our initial comparison concluded the superior performance of YOLOv8 compared with Mask-RCNN, the improvements in YOLOv11—such as a stronger backbone and more refined architecture—make it a compelling option. In fact, Ultralytics verified that YOLOv11 consistently outperformed YOLOv8 at similar model sizes. To utilize the most advanced technologies for our project, we eventually decided to train YOLOv11 on our dataset, aiming for the most precise outcomes.

Our training, validation, and testing dataset regarding the latest dataset were split into a 0.73:0.18:0.09 ratio, resulting in 2,663 images for training, 652 images for validating, and 324 images for testing. A total of 100 epochs with a batch size and image size of 640 pixels was used.

Baseline results

Table 3. Performance metrics evaluated on YOLOv11

mAP refers to the Mean Average Precision of an AI model. For mAP50, the Mean Average Precision is calculated at an Intersection over Union (IoU) threshold of 0.50. For mAP50_95, it is calculated through varying IoU thresholds, providing a comprehensive view of the AI model’s performance across different difficulties.Our AI model demonstrates satisfactory performance; it can detect most foams and beams from our datasets, supported by high mAP values (0.982 in mAP50 Boxes and Masks). Additionally, we have two distinct types of mAP values. The Box value represents the bounding box created by the AI model on our dataset's images, while Masks are pixelated outlines traced by the AI model on an object.Different mAP values allow for a quick overview of our trained AI models, making future adjustments to our datasets easier.

Figure 2. Sample images from the test set detected with YOLOv11

Detection results on tested images showed that the confidence scores of microplastic detection by YOLOv8 ranged from 0.82 to 0.92, indicating a high level of confidence (Figure 3). Additionally, the trained AI model accurately excluded leaves and branches, which served as negative controls in the dataset to reduce false positives (Figure 3).

From the mAP statistics and images detected by YOLOv11, it can be concluded that our AI model demonstrates satisfactory performance. By training YOLOv11 on a robust real-life microplastic dataset, we can further enhance the model's ability to generalize and perform accurate detection in real-world conditions.

Reference: [1]YOLO11 vs YOLOv8: Detailed Comparison - Ultralytics YOLO Docs\

[2]Performance Metrics Deep Dive

Robotic Car

Collecting microplastics on the beach is slow, labour-intensive, and results can vary between people. That's why we built this autonomous vehicle — powered entirely by a Raspberry Pi 5.

Two DC motors drive it to position, while an encoder motor precisely controls the scoop — digging, collecting, and releasing samples.

The water pump delivers a specific amount of water into the scoop.

Then, the scoop moves back and forth, letting lighter microplastics rise to the surface.

Afterwards, it gently pours the water through a fine sieve, where the microplastics remain.

It then rotates 360 degrees backward to return the sand to the beach, resetting for the next sample collection.

A camera captures the sample, and the image is analysed using our YOLOv11 AI model to detect and quantify the particles.

This system brings robotics, computer vision, and AI together — for smarter, sustainable environmental research.