ultralytics / ultralytics

NEW - YOLOv8 πŸš€ in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
23.76k stars 4.74k forks source link

Using YOLOv8 for Fish Detection in Underwater Videos #11690

Closed ValentinB16 closed 1 week ago

ValentinB16 commented 1 week ago

Search before asking

Question

Hello, I would like to use YOLOv8 on videos from an underwater camera containing underwater fish to detect different fish breeds. I have four questions :

1) My images are in 2592x1944 resolution, while YOLOv8 only supports images up to 1280 pixels. Since many instances in my dataset are very small, I wanted to resize them to 1280 pixels in width. If I'm not mistaken, YOLOv8 can handle non-square images. What would be the ideal length dimension in this case?

2) The trained model will be used on the same camera from which we took the videos, at the same (and only) angle. Would applying image processing affect the accuracy of the model negatively, particularly when using it on this camera ?

2) Regarding dataset annotations : In several videos, there are schools of fish (several tens, sometimes hundreds,of fish). Some are barely visible, but it's apparent they belong to the same breed as the other fish. Since they might not be recognizable without the other fish around, could annotating them potentially lower the precision of detection ? Another solution could be to create another class called 'school of fish'. What would be the best approach?

3) Due to the camera being underwater, sometimes there is a fish in an image, but we cannot determine which breed he belongs to. Should it not be annotated ? Should the image be excluded from the dataset ?

Thank you in advance for your responses

Additional

No response

github-actions[bot] commented 1 week ago

πŸ‘‹ Hello @ValentinB16, thank you for your interest in Ultralytics YOLOv8 πŸš€! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a πŸ› Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 1 week ago

Hello! It's great to hear about your project using YOLOv8 for detecting different fish breeds in underwater videos. Here are some concise answers to your questions:

1) YOLOv8 can handle images of non-square proportions. You can resize your 2592x1944 images to 1280 pixels in width. To preserve the aspect ratio, the corresponding height should be about 960 pixels (1280/2592 * 1944).

2) Image processing, like adjusting brightness or contrast, can sometimes help the model generalize better, especially if it matches the conditions during which you'll be using the trained model. Just ensure the processing doesn't obscure or alter the key features of the fish.

3) For the fishes appearing in schools, it's a good approach to create a distinct class like 'school of fish,' especially when individual fish are not discernible. This could help in improving the model's performance by reducing misclassifications of tightly grouped entities.

4) If a fish’s breed is not identifiable in an image, it's generally advisable not to annotate it as the model might learn incorrect features. Including such ambiguous images without annotations can help in teaching the model to recognize only clear examples, thereby potentially excluding them during inference.

I hope these answers help! Dive deep and happy modeling with YOLOv8! πŸŸπŸ“Ή