File size: 2,127 Bytes
9e188b3
bcdc0b7
9e188b3
 
 
 
 
 
 
bcdc0b7
 
 
 
 
 
 
48e836f
 
2789996
 
 
 
 
 
 
 
 
 
 
b7ca14c
 
2789996
48e836f
7fddf9c
4cdead4
 
7fddf9c
4cdead4
 
7fddf9c
 
 
 
4cdead4
 
 
7fddf9c
4cdead4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
library_name: ultralytics
license: cc-by-nc-4.0
language:
- en
base_model:
- Ultralytics/YOLO11
pipeline_tag: image-segmentation
tags:
  - object-detection
  - yolo
  - ultralytics
  - 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.

<img src="images/321595639_581630651.jpg" width="500"> <img src="images/321595639_581630651_seg.jpg" width="500">

## 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.

The training procedure is (very briefly) decribed in [this notebook](https://huggingface.co/BVRA/TurtleDetector/blob/main/training/segmentation_prepare.ipynb).

## 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)
```