YOLOv8 Salmon Tracker

My roommate works for the US Fish and Wildlife Service and gave me the idea for this project. He asked if I was able to build a model that could identify and count Salmon in an underwater video camera.

I was already familiar with YOLO for object detection, but the last versions I used were v3 and v5. I was excited to get to use v8. The video on the right shows me playing around with the instance segmentation pretrained model from ultralytics. It would be ideal to have this type of output for the Salmon model, but it would take forever for me to hand annotate every pixel.

I did find a pretty nice salmon dataset from here. Many of the images are not what I wanted (half of it is people holding fish they just caught lol), but I won’t pass up 1,000 annotated images. I imported the YOLOv5 annotations into roboflow and was able to export the annotations as YOLOv8 without any issues

I trained a model on these images using the pretrained weights from the yolov8x model. For the object tracking and counting, I used packages called supervision and ByteTracker off pypi. I had a couple issues using their packages with a certain numpy version. I had to go in and rebuild some Cython code and util files where a deprecated call to np.float was being used. Other than that, everything worked great and I got a pretty solid output. I’ll keep an eye out for better datasets to improve this model.