File size: 2,556 Bytes
90d1de1
09efaa0
 
 
 
90d1de1
 
 
09efaa0
90d1de1
 
09efaa0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90d1de1
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: Marine Species Identification API
emoji: 🐟
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: apache-2.0
short_description: marine species identification api
---

# Marine Species Identification API

A scalable FastAPI-based API for marine species identification using YOLOv5 deep learning model. This API can detect and classify 691+ marine species from images with high accuracy.

## Features

- **Marine Species Detection**: Identify 691+ marine species using YOLOv5
- **RESTful API**: Clean, well-documented REST API endpoints
- **Real-time Processing**: Fast inference with GPU/CPU support
- **Annotated Results**: Returns both detection data and annotated images
- **Scalable Architecture**: Built with FastAPI for high performance
- **HuggingFace Integration**: Seamless model loading from HuggingFace Hub
- **Docker Ready**: Containerized for easy deployment

## API Endpoints

### Core Endpoints

- `POST /api/v1/detect` - Detect marine species in images
- `GET /api/v1/species` - List all supported marine species
- `GET /api/v1/species/{class_id}` - Get specific species information
- `GET /api/v1/health` - Health check and model status
- `GET /api/v1/info` - API information and capabilities

### Example Usage

```bash
# Detect marine species
curl -X POST "http://localhost:7860/api/v1/detect" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "base64_encoded_image_data",
    "confidence_threshold": 0.25,
    "return_annotated_image": true
  }'
```

## Development

### Local Setup

1. Clone the repository
2. Install dependencies: `pip install -r requirements.txt`
3. Run the API: `uvicorn app.main:app --host 0.0.0.0 --port 7860`

### Docker Deployment

```bash
docker build -t marine-species-api .
docker run -p 7860:7860 marine-species-api
```

## Documentation

- **Interactive API Docs**: `/docs` (Swagger UI)
- **Alternative Docs**: `/redoc` (ReDoc)
- **OpenAPI Schema**: `/api/v1/openapi.json`

## Model Information

- **Model**: YOLOv5 trained on marine species dataset
- **Classes**: 691+ marine species
- **Input**: RGB images (JPEG, PNG, etc.)
- **Output**: Bounding boxes, confidence scores, species labels

## Supported Marine Species

The model can detect a wide variety of marine life including:
- Fish species (Sebastes, Rockfish, etc.)
- Marine invertebrates (Sea stars, Urchins, etc.)
- Cephalopods (Octopus, Squid, etc.)
- Cnidarians (Jellyfish, Corals, etc.)
- And many more...

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference