Open Access Article
Lance W. Miller†
,
Navaj Nune†,
Thomas B. LeFevre
,
Clare N. Hermanson
,
Joseph D. Daddona,
Anita Valdez,
Ashwin Kannan,
Wilaiwan Chouyyok,
George T. Bonheyo
,
Raymond S. Addleman and
Curtis J. Larimer
*
Pacific Northwest National Laboratory, 902 Battelle Blvd, Richland, WA, USA. E-mail: curtis.larimer@pnnl.gov
First published on 22nd January 2026
Quantification of biofouling is a complex task that often involves counting both isolated and tightly packed groups of organisms on a test surface. Mussel larvae, which settle as both individuals and as clumps, are an important fouling organism because adult mussel colonies form via the settlement of larvae, making the settlement or repellence of mussel larvae a good indicator of a surface's antifouling performance. Manual quantification methods are time-consuming, and existing automatic machine learning-based methods are poorly suited for use by coding non-experts and often lack the ability to detect both isolated and grouped organisms in one workflow. The objective of this work was to develop a machine learning-based application that is user-friendly and well-suited to the quantification of biofouling. We developed M-Count, an application that combines a neural network object detection model for individual organism detection and a color thresholding algorithm for grouped organism detection. M-Count was demonstrated on the quantification of mussel larvae on sample surface images obtained from a previously developed mussel larvae fouling assay. This study revealed three important characteristics of M-Count: speed, consistency, and accuracy. The primary benefit of M-Count is its speed, being 60× faster than manual counting. The secondary benefit of M-Count is consistency, as it performs the same task repeatedly without bias. Finally, these benefits are obtained while maintaining good accuracy, with the normalized average maximum residual being 0.220 for M-Count and 0.209 for manual counting.
Traditional (non-machine learning) algorithms and manual counting can be valid options for quantifying biofouling. For smaller sample sets, individual organisms can be quantified by manual counting, which is simple, accurate, and effective. But manual counting is subject to human bias and error and is laborious for large data sets. Manually operated digital methods, such as histogram-based thresholding, can be effective for groups or films of organisms when the background and lighting are amenable to such analysis. However, thresholding alone is not effective when there is insufficient contrast between the fouling layer and the background surface. Traditional algorithms that do not use machine learning also provide varying ranges of functionality for thresholding, blob detection, and particle tracking,16–19 but lack the ability to quantify individual objects of a specific appearance.
Automatic deep learning methods have become popular for many tasks and are valuable tools for consistent and accurate analysis of large data sets.20,21 In particular, machine learning object detection algorithms can be trained to detect specific objects and patterns in images22 and thus can rapidly quantify biofouling,23 but their implementation requires extensive coding and configuration that are a hurdle for non-experts. Standalone applications for custom training and object detection have been developed, but they often lack the two-component detection stream necessary to detect both individual organisms and amorphous groups of organisms; are not open source; or have not been tailored to provide quantitative results.24,25 Lacking these functionalities is an obstacle for use by coding non-experts. For more widespread adoption of deep learning tools to occur, there is a need for machine learning applications that can be easily installed and operated using a graphical user interface (GUI) to perform model training and object detection. A user-friendly machine learning application should be able to process large sets of images in one workflow, present the results in an organized fashion, and be readily updated with new training models as the machine learning field rapidly progresses.
In a previous work,26 a settlement of larvae assay using mussels (SLAM) assay for the evaluation of antifouling surfaces was developed. Mussels are a common fouling species in both saltwater and freshwater, and on a wide variety of infrastructure and equipment, such as dams, nets, and boats. Furthermore, mussel larvae are convenient model organisms because small (2.5 cm–7.5 cm on each side) experimental antifouling samples can be exposed to a high density of mussel larvae – hundreds per cm2 – inside a benchtop aquarium. This test can assess antifouling capability relatively quickly, as larval settling occurs within seven days. In a natural environment, the formation of adult mussel colonies begins with the settlement of mussels at the larval stage; thus, the prevention of larval settling on a given surface indicates that the surface may be effective at preventing adult mussel colonies. Field testing remains the gold standard for determining the efficacy of antifouling surfaces, but field tests typically require months to allow potential biofouling to occur. Field testing is also subject to a high degree of environmental variability and therefore lacks the controlled, repeatable conditions necessary to make precise comparisons between multiple experiments.
Mussel larvae are just large enough (250 µm–300 µm) that they can be imaged using a standard digital camera with an appropriate macro lens. Like many other forms of biofouling, mussel larvae settle as well-defined individuals and as amorphous groups. For the purposes of this work, these two categories of larvae are described as non-clumped and clumped larvae, respectively. Quantifying mussel larvae settlement in these experiments is challenging because manual counting is time consuming, while automatic methods are effective but difficult to use due to multiple workflows, complex and error-prone machine learning configuration, and script-based execution. Without an easy-to-execute analysis workflow, the previously developed SLAM antifouling assay is difficult to quantify and less likely to be adopted.
Here we present M-Count, an accessible and easy-to-use application that incorporates a machine learning object detection workflow to identify non-clumped individuals and a color thresholding process to identify amorphous clumps of individuals. M-Count was motivated by the need to efficiently quantify mussel larvae – both clumped and non-clumped – on experimental antifouling surfaces. M-Count uses two parallel processes to quantify biofouling in an image: a You Only Look Once (YOLO) machine learning model22 that can be trained by the user to detect individual objects of any kind; and (2) an automatic color thresholding process that isolates the amorphous clumps based on their color and quantifies their area. M-Count can be installed like any application, requires no coding knowledge, and features an easy-to-use GUI that allows the user to train their own machine learning model. We demonstrated the efficacy of M-Count on images that were acquired from the larvae settlement assay and compared the speed and efficacy of M-Count with manual counting. M-Count is an open-source, user-friendly application that has been designed specifically for quantification of marine fouling and rapidly quantifies mussel larvae with high accuracy.
The prepared test coupons were placed in a 76 L aquarium with 58 L of artificial seawater. Larvae from a commonly grown commercial shellfish species, Mytilus galloprovincialis, were mixed into the seawater at a concentration of 259 larvae per cm2 (relative to the horizontal area of the tank bottom). The tank was kept at 18 °C ± 0.1 °C, exposed to broad spectrum artificial light on a 12 hour on/12 hour off cycle, and fed with phytoplankton every other day. After 10 days, the coupons were removed and immediately photographed using a Sony NEX-C3 camera with included 18–55 mm lens using the manual focus option. The mussel larvae were approximately 250 µm–300 µm across and were clearly visible in the photographs (Fig. 1). The image analysis process from photographing the images to obtaining an organized spreadsheet containing the biofouling quantification data has been outlined in a block diagram in Fig. 2.
![]() | ||
| Fig. 2 Block diagram summarizing the entire M-Count workflow from acquiring sample images to obtaining finished results. | ||
![]() | ||
| Fig. 3 Automatic process flow for the object detection and quantification of non-clumped mussel larvae using YOLOv8 detection in M-Count. | ||
To determine the repeatability of manual counting, twenty white coupons were manually analyzed by five different members of the research team trained in manual mussel counting. The average inter-day difference,
for each user was determined by having the user manually count the same coupons on two different days (days 1 and 2), calculating the inter-day difference for each coupon according to di = |h1,i − h2,i| and then taking the arithmetic mean of the differences to find the average inter-day difference for that user across all 20 coupons, according to 
This average manual count was used as the ground truth that each individual user and M-Count were compared against. For each of the 20 coupons, the maximum manual count residual was determined by first finding the largest difference between any manual count and the average manual count,
These maximum manual residuals were averaged across the 20 coupons to determine the average maximum manual residual,
The M-Count average residual was calculated by the same two-step method: finding the difference between the M-Count result and the average manual count for each coupon by
and then taking the arithmetic mean of these twenty residual values,
The average maximum residuals were then normalized by the average human count, according to
After the M-Count analysis is complete, the user can view the analysis results in two ways – either via the M-Count GUI, or by directly accessing the saved Excel data files through a file browser. To find saved results using a file browser, the user navigates to the ‘Detections’ subfolder within the ‘M-Count (dist)’ folder. Each analysis will have its own folder, named during the previous ‘Run Model’ step. Upon running the analysis, M-Count creates two subfolders within the named analysis folder: ‘spreadsheets’ and ‘images’. The ‘images’ folder contains two further subfolders: ‘bounding’ and ‘threshold’. The ‘bounding’ subfolder possesses copies of the input images overlaid by detection boxes, thus outlining all the detected non-clumped mussels. The ‘thresholding’ folder has copies of the input images overlaid with masks representing areas detected as clumped mussels by the color thresholding algorithm. The ‘spreadsheets’ folder contains an Excel spreadsheet named ‘overall_counts’ with three tabs. The ‘Total mussels’ tab shows the total mussel count for every image located in the selected input directory. The ‘Bounding’ tab has the mussel counts for non-clumped mussels detected by the YOLO model only. The ‘Thresholding’ tab contains the mussel counts for clumped mussels counted using the color thresholding method only.
The user can also navigate to the analysis results through the M-Count app via the options in the ‘Count Complete’ window that appears after the analysis is complete. Clicking on ‘Open Detection Pictures’ will open the aforementioned ‘images’ folder, which contains the copies of the original input images overlaid by non-clumped mussel bounding boxes and clumped mussel area masks. Clicking on ‘Open Count Spreadsheet’ in the same window will open the aforementioned ‘overall_counts’ spreadsheet with total mussel, non-clumped mussel, and clumped mussel results separated into separate tabs. These same options are available via the main menu by clicking ‘Count’, then ‘View Past Detection Counts’, and selecting the name of the analysis from a dropdown list of previously done analyses.
The process for training a new object detection model for counting non-clumped mussels is represented in Fig. 6. First, the user must first create a set of annotated images using a software package such as LabelImg, which allows the user to identify (‘annotate’) the location of each mussel larva in each image. For each annotated image, LabelImg creates a text file that contains the annotation labels (which are the name(s) of the objects being detected; in this case, ‘mussel’) and coordinates for every identified object. For example, using LabelImg, the user would draw a bounding box around every mussel larva in an image, and then LabelImg creates a text file that lists the x and y coordinates of the four corners of each bounding box in that image. LabelImg provides the option to record these annotations in different formatting schemes; the user should select the ‘YOLO’ formatting option. Once the annotated image set is ready, the user must create a text file saved in.yaml format that contains the annotation label name for the object class being detected (such as ‘mussel’) and the file path of the folder where the annotated training image set is located (formatted as ‘train: “file path”’ exactly as shown in Fig. 6, lower right). Validation of the training is optional: if desired, the user creates a unique separate annotated image set folder for validation and inputs its file path location into the .yaml file, similar to the training image path, under the heading ‘val:’. When the training set and.yaml file are ready, the user opens M-Count and selects ‘Train Model’ in the main menu, followed by ‘Select Training Config (.yaml)’ in the resulting window. The user will be prompted to name the new model. After the user enters a name and clicks ‘ok,’ the training is performed, and the new model will be saved as a PyTorch weights file in the ‘Training’ subfolder within the ‘Mcount (dist)’ directory. If the user supplied an annotated validation set, the validation results are populated in a subfolder named ‘runs’ within the ‘Mcount (dist)’ folder. The newly trained model can be selected by clicking ‘Select Model’ in the main menu, adding the new model by clicking the ‘Add model’ button, navigating in the file selection pop-up to the ‘Mcount (dist)/Training’ folder, and selecting the desired model. The user can switch between any models they have added by choosing them in the ‘Select Model’ dropdown menu.
Training and evaluation of the YOLOv8 machine learning model for detection of individual mussel larvae was performed. A maximum F1 score of 0.76 was calculated at a confidence of 0.32. The full F1-confidence curve, along with other training and evaluation metrics, is shown in SI, Fig. 1. A confusion matrix is shown in SI, Fig. 2. These results show that the model was trained sufficiently well to perform well with complementary thresholding analysis. These metrics will vary for other users of M-Count depending on the quality of images, quality of annotation, and features of the objects being detected.
As a more practical demonstration of M-Count, in Fig. 7 the results from the M-Count method and the manual counting method are compared according to the three categories of mussels: non-clumped mussels, clumped mussels, and total (non-clumped and clumped) mussels.
In Fig. 7A–C, the M-Count results (blue-filled circles) are co-plotted against the average manual count (averaged across five users) for each coupon of a set. Co-plotted with the M-Count results are the average manual counts for each coupon (orange-filled squares), the line of fit of which naturally forms a line with a slope of one (dotted black line). Error bars on the average manual counts show the maximum and minimum manual count for each coupon, highlighting the fact that undesirable user-to-user variation is inherent to manual counting. M-Count data points, on the other hand, do not have error bars because M-Count returns the same count value across all runs on a given image. The plots in Fig. 7A–C show that M-Count tends to slightly undercount non-clumped mussels and slightly overcount clumped mussels, but the total count produced by M-Count is centered around the line formed by the average manual count results.
For all three mussel quantities (non-clumped, clumped, and total mussels) in Fig. 7A–C, the M-Count results are fitted to a linear curve using the least squares LINEST function in Excel. The coefficients of determination, R2, for non-clumped, clumped, and total mussels are 0.9208, 0.6956, and 0.6877 respectively. The coefficients of determination for individual users (whose counts are plotted against the average manual counts in SI, Fig. 3) fall within 0.9230–0.9946, 0.7713–0.9527, and 0.9387–0.9673 for non-clumped, clumped, and total mussels respectively and are listed by user in SI, Table 1.
The normalized M-Count residuals were also compared to the normalized average maximum manual count residuals (Fig. 7D–F). For non-clumped mussels, the manual count average maximum residual was 0.368 and the M-Count residual was 0.199. For clumped mussels, the manual count average maximum residual was 0.325 and the M-Count residual was 0.390. For total mussels, the manual count average maximum residual was 0.209 and the M-Count residual was 0.220.
A major motivation for the development M-Count was to increase the speed and consistency of counting mussel larvae. As shown in Fig. 8A, manual mussel larvae counting was completed at an average rate of 0.95 larvae per s. M-Count accomplished the same counting task at a rate of 58.0 larvae per s, 61× faster than manual counting.
Consistency of counting is also a major benefit when using M-Count. Human users lack precision in their counting skills, reporting different mussel counts for the same coupon counted on different days (Fig. 8B). Averaged across a set of coupons, individual human average day-to-day variation ranged from 7.50% to 33.2% depending on the user. The maximum day-to-day variation across the set of images ranged from 24.4% to 74.9%. M-Count provides the exact same results every time as long as the same trained model is used.
In this effort, the method of object detection was chosen instead of alternative methods such as semantic segmentation, instance segmentation, or simple image classification because of the many small objects with few defining features present in the images. Early work attempted to break the image into tiny tiles and perform image classification on each tile, but this resulted in many of the mussel larvae being split and poorly quantified. Semantic and instance segmentation were also deemed poorly suited to the task because the exact boundaries of the mussels were not needed and because the mussels were relatively very small – roughly 20 px long by 10 px wide – and lacked defining geometries, making their exact boundaries difficult to determine. While small object segmentation is an area of focused study, both semantic and instance segmentation methods have difficulty in detecting small objects.29,30 Object detection is better suited to quantifying individual objects without requiring that their exact boundary be detected. Thresholding was then chosen as a parallel method to capture mussel clumps, which varied greatly in size and shape and may have presented a challenge for instance or semantic segmentation. Other works have performed thresholding with object detection, but these studies typically used thresholding as a preliminary augmentation step to improve the accuracy of the model31 or as a secondary stage32 after object detection is complete. Other strategies combine multiple machine learning architectures,33 but such efforts did not produce the type of user-friendly application required for widespread adoption.
M-Count is a user-friendly application that features increased larvae counting speed and precision compared to manual counting. The user menu button options (Fig. 5 and 6) are minimal because M-Count has been created for the specific (yet widely applicable) process of detecting clumped and non-clumped individual organisms that the machine learning model and thresholding algorithm have been designed to detect. An entire set of images can be analyzed in one session, and the application saves an Excel file with the larvae counts tabulated for each image, resulting in well-organized, quantified fouling data. M-Count is set up such that it can be trained to recognize any type of object within an image, which could have widespread applications in a variety of biological detection tasks such as field testing, maintenance scheduling, and ecological monitoring. In addition to effectively quantifying mussel larvae, M-Count could also effectively quantify other marine organisms that tend to exist as both clumped and non-clumped individuals, including adult mussels, barnacles, and colonial hydroids.
The goal of developing M-Count was to obtain a rapid, precise, mostly hands-off method for counting mussel larvae without sacrificing the accuracy of manual counting. The accuracy of M-Count is illustrated in Fig. 7, where the M-Count result is co-plotted with the average manual result, with error bars showing the maximum and minimum manual results for each coupon. M-Count had a moderate R2 value, 0.688, for the total mussel count. A higher R2 would be desirable, but a lower R2 is an acceptable trade-off for the precision and speed increase offered by M-Count.
Another metric for comparing the accuracy of M-Count with manual counts is the maximum residual for each image (Fig. 7D–F). On average, the maximum M-Count residual was comparable to the maximum manual count residual. For non-clumped mussels, the average M-Count residual was lower than the average manual count residual. For clumped and total mussels, the average M-Count residual was only slightly higher than the average manual count residual. This indicates that M-Count yields results within the distribution of manual counts.
M-Count does not need to be more accurate than manual counting to be useful; rather, its utility lies in being much faster and more precise without losing accuracy. The superior speed of M-Count is clear, as it demonstrated a 61× speed increase over manual counting (Fig. 8A), and most of the time requirement for M-Count is hands-off for the user. The precision of M-Count was demonstrably improved over human users, which varied by as much as 74.9% from day to day, whereas M-Count produced zero inter-day variation (Fig. 8B). Human users were susceptible to changes in their impression of the visual appearance of objects such as mussel larvae, which are small, transparent, and can be easily confused with other debris or surface asperities. M-Count, on the other hand, when provided with the task of analysing the same set of images multiple times, provided the same count results each time.
A variety of other deep learning Image analysis software packages with GUIs for non-experts are available. JustDeepIt25 is an open-source deep learning software with a GUI and is perhaps the closest alternative to M-Count, but it is better suited for broad image classification, rather than for quantification of many small objects. Ilastik is a powerful machine learning tool developed for non-experts that contains multiple workflows for different image analysis requirements and provides an interactive training environment that reduces the time required for creating training data.24 FastER is designed for high-throughput segmentation of cell-shaped objects, which are similar in appearance to mussels.34 However, these and other image analysis packages are relatively complicated to operate and focus on classification and segmentation rather than providing readily accessible quantification of identified objects.35–38 While object counting may be an available option in these packages, the accompanying workflows did not satisfy our requirements for clarity, simplicity, and ease-of-use. M-Count, on the other hand, prioritizes quantification of objects and simplicity of operation to provide a pragmatic biofouling quantification tool for a variety of users. M-Count was developed to address a specific need – to quantify thousands of mussel larvae that can take the form of isolated individuals and also be grouped together like masses of tissue – while remaining as simple as possible. M-Count may also serve as a useful tool for other image quantification tasks.
M-Count in its current incarnation has some limitations. Despite being trained to detect non-clumped mussels on a variety of substrates, M-Count is currently only capable of analysing clumped mussels on white or off-white substrates because the thresholding method has not been equipped with a way to automatically determine the optimal color thresholding limits. Future versions of M-Count should incorporate automatic threshold optimization, background color detection, and/or perhaps a machine learning instance segmentation algorithm. Instance segmentation was tested as method for quantifying clumped larvae in this effort, but did not deliver acceptable results, likely due to the small pixel dimensions of the mussel larvae, lack of diverse defining characteristics (e.g., shape and color variations) and wide range of clump sizes. The current version of M-Count is also lacking in its coefficient of determination when plotted against average manual counting values; the R2 for M-Count could likely be improved by further training the model with higher quality training data, as the annotations can be ambiguous due to the uncertain distinction between non-clumped mussels and clumped mussels. M-Count performance could also be improved by further optimizing the larvae imaging process, which currently relies on a coarse manual focus step that produces better focus than automatic focusing but leaves room for error that can cause larvae to be slightly out of focus. Future model training should be conducted by using multiple humans to create annotated training data that averages the biases of multiple humans.
Supplementary information (SI) is available. See DOI: https://doi.org/10.1039/d5ay01759a.
Footnote |
| † Co-first authors |
| This journal is © The Royal Society of Chemistry 2026 |