---
license: cc-by-nc-4.0
language:
- en
base_model:
- Ultralytics/YOLO11
pipeline_tag: image-segmentation
tags:
- turtles
- head
- flippers
- carapace
---
TurtleDetector detects sea turtles, their heads, and their flippers. For flippers, it distinguishes front/rear and left/right flippers, enabling precise matching for re-identification of individual turtles. It is able to detect sea turtles both under and above water.
## Training
Two sources were used for training:
- [SeaTurtleID2022](https://www.kaggle.com/datasets/wildlifedatasets/seaturtleid2022): A large database of 438 individual loggerhead turtles spanning 13 years. All photos are underwater.
- [TurtlesOfSMSRC](https://www.inaturalist.org/projects/turtles-of-smsrc): Emerging database of mostly juvenile green turtles of both underwater photos and photos from rescue centres. Only the latter were chosen to complement the SeaTurtleID2022 database.
## Usage
The model can be used as any `ultralytics` model. First, download and load the model.
```
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
path_model = hf_hub_download(
repo_id="BVRA/TurtleDetector",
filename="turtle_detector.pt",
)
model = YOLO(path_model)
```
Then download an image (or use yours) and run the prediction.
```
import requests
from io import BytesIO
from PIL import Image
def load_image(url):
r = requests.get(url, timeout=30)
r.raise_for_status()
return Image.open(BytesIO(r.content)).convert("RGB")
img_url = "https://huggingface.co/BVRA/TurtleDetector/resolve/main/images/321595639_581630651.jpg"
img = load_image(img_url)
result = model.predict(img, verbose=False, save=False, show=False)[0]
img_annotated = result.plot()[:, :, ::-1]
Image.fromarray(img_annotated)
```