Estimating fish size classes using image classification and machine learning models


Catarina Silva and Asta Audzijonyte


Here we present a simple approach to develop models for estimating fish size classes from images where people are holding fish in their hands. Millions of such fish images available on social media, smart phone app citizen science platforms, but in most cases there is no fish body size information associated with these images. Yet, if body size data was available, it would greatly improve assessments of many inland and coastal fisheries. To solve this challenge we have trained a machine learning model to classify such images into 5 to 10 centimeter size classes. The framework is similar to what we presented in the fish species identification model, but now it is adapted to fish sizes.

Images for the model training were collected through collaborative agreement between Nature Reserach Centre and **My Catch, Angler’s Atlas citizen science platform, where users contributed images during various fishing tournaments. Additional photos were also collected through the FishSizeProject smart phone app developed durign this project.

To learn more about the framework, please visit our online course webpage.

Model code

To use our models it is very important that fish size classes in your dataset are identified correctly, otherwise your model will not be very useful. You can upload images (in JPEG or PNG format) to your Google drive by size class (i.e. fish images of each size class per folder), following this directory structure:

|__ class5
    |______ image1.PNG
    |______ image2.PNG
    |______ ...
|__ class10
    |______ image3.JPG
    |______ image4.PNG
    |______ ...
|__ class15
    |______ image5.PNG
    |______ image.JPG
    |______ ...
|__ ...

Image names are not important, as long as directory names (classes) are correct.

To apply our model you can use this code:

Open In Colab

You can also find all the scripts used in the framework in our Github page.

Application of the model

To learn more about the model development and applications you can watch this talk for the online seminar “Recreational angling effort and engagement in the digital age”. You can also watch this talk presented in the workshop “Can citizen science, smartphone app and social media data be used for recreational fisheries management?”

In this publication you will find a detailed description of the method and a pilot case-study where we demonstrate potential use for estimating fish size classes from images without a specified reference object.

The next steps are to invite angler contributions to provide more images, train model with more data for higher accuracy and precision, and then apply this model to social media data of a charismatic predatory fish. So watch this space.

Common barbel drawing by Amy Rose Coghlan