Instructions to use BVRA/TurtleDetector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use BVRA/TurtleDetector with ultralytics:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("BVRA/TurtleDetector") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
| 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) | |
| ``` |