32. 🌊 AI for Marine Ecosystems (AI4ME) API#

πŸš€ AI-powered API for Marine Ecosystem Research
AI4ME API provides low-code APIs for machine learning-based image analysis tools focused on marine research.

πŸ”— GitHub Repository: [AI4ME API Link(https://connect.fisheries.noaa.gov/ai4me)
πŸ“© Contact: Michael.Akridge@noaa.gov

32.1. πŸ”Ή Features#

  • 🌍 Platform-Agnostic: Low-code and accessible via Python, R, shell, or any HTTP client.

  • πŸ”‘ Secure: Requires an API key for restricted endpoints.

  • πŸ“Š Scalable & Fast: Leverages optimized YOLO models for rapid predictions.

  • πŸ–ΌοΈ Supports Image Uploads: Accepts images up to 20MB.

  • 🌊 Research-Focused: Designed for marine ecosystem analysis.


32.2. πŸ’‘ Advantages of AI4ME API#

32.2.1. πŸ”Ή 1. Low Code & Platform-Agnostic#

  • Works with Python, R, JavaScript, cURL, commandline and any HTTP client.

  • Accessible from desktop, cloud, or mobile.

32.2.2. πŸ”Ή 2. Secure & Scalable#

  • Uses API key authentication for controlled access.

  • Supports high-throughput requests.

32.2.3. πŸ”Ή 3. Research-Oriented#

  • Designed for marine ecosystem monitoring.

  • Helps scientists analyze coral health & urchin populations.

32.2.4. πŸ”Ή 4. Fast & Efficient#

  • Uses optimized YOLO models for real-time predictions.

  • Processes images in milliseconds.


32.3. πŸ› οΈ How It Works#

32.3.1. 1️⃣ Input Data (Image)#

  • Users upload an image via API request (local file or URL).

  • The image is processed by YOLO-based models trained for specific tasks.

32.3.2. 2️⃣ API Processing#

  • The API validates the file (size, format).

  • The coral bleaching classifier or urchin detector model processes the image.

  • Predictions are filtered based on a confidence threshold.

32.3.3. 3️⃣ Output Response#

  • The API returns structured JSON containing:

    • πŸ”Ή Predicted class (e.g., "coral_bl" for bleached coral)

    • πŸ”Ή Confidence score (e.g., 0.85 = 85% confidence)

    • πŸ”Ή Bounding boxes (for object detection)


32.4. ⚑ API Request Flow#

32.4.1. 1️⃣ User Submits Image#

POST /predict/coral (or /predict/urchin)

πŸ“€ Request:

  • User uploads an image (JPEG/PNG).

  • API validates file size & format.

32.4.2. 2️⃣ Model Processes Image#

  • The YOLO model classifies the image.

  • Predictions are filtered by confidence threshold.

32.4.3. 3️⃣ API Returns JSON Output#

πŸ“₯ Response:

  • For Coral: Class label & confidence (e.g., "coral_bl" 85%).

  • For Urchins: Bounding boxes + confidence scores.


32.5. πŸ” API Security & Access#

  • Public Endpoints: /health, /info

  • Restricted Endpoints: /predict/coral, /predict/urchin (API key required)

32.5.1. πŸ”‘ How to Authenticate#

Every request to /predict/* must include:

X-API-KEY: your_api_key

Example in Python:

headers = {"X-API-KEY": "your_api_key"}
response = requests.post(url, headers=headers, files=files)

32.6. πŸ“Œ Endpoints & Usage#

32.6.1. πŸ”Ή βœ… Health Check (Public)#

πŸ”Ή Check if the API is live

GET /health

32.6.1.1. Response#

{
  "status": "OK",
  "message": "API is running"
}

32.6.2. Coral Bleaching Classification#

πŸ”Ή Endpoint:

POST /predict/coral

πŸ”Ή Required Parameters:

Parameter

Type

Description

file

Image File

Coral reef image (max 20MB)

threshold

Float (default=0.5)

Confidence threshold for filtering predictions

32.6.2.1. Example Request (Python)#

import requests

url = "https://connect.fisheries.noaa.gov/ai4me/predict/coral"
headers = {"X-API-KEY": "your_api_key"}
files = {"file": open("example_coral.jpg", "rb")}
response = requests.post(url, headers=headers, files=files)
print(response.json())

32.6.2.2. Response Example#

{
    "model": "coral_bleaching_classifier",
    "predictions": [
        {"class": "coral_bl", "confidence": 0.85},
        {"class": "coral", "confidence": 0.12}
    ]
}

32.6.3. Sea Urchin Detection#

πŸ”Ή Endpoint:

POST /predict/urchin

πŸ”Ή Required Parameters:

Parameter

Type

Description

file

Image File

Underwater image (max 20MB)

threshold

Float (default=0.4)

Minimum confidence for detections

32.6.3.1. Example Request (Python)#

import requests

url = "https://connect.fisheries.noaa.gov/ai4me/predict/urchin"
headers = {"X-API-KEY": "your_api_key"}
files = {"file": open("example_urchin.jpg", "rb")}
response = requests.post(url, headers=headers, files=files)
print(response.json())

32.6.3.2. Response Example#

{
    "model": "sea_urchin_detector",
    "detections": [
        {
            "class": "urchin",
            "confidence": 0.85,
            "bbox": [2974.38, 765.22, 3528.17, 1394.35]
        },
        {
            "class": "urchin",
            "confidence": 0.73,
            "bbox": [4257.12, 2783.82, 4684.24, 3146.24]
        }
    ]
}

32.7. πŸš€ Get Started#

1️⃣ Request API access from Michael Akridge.
2️⃣ Use Python, R, or cURL to send requests.
3️⃣ Upload images and get AI-powered insights!

For full documentation, visit:
πŸ“š API Docs
πŸ“‚ GitHub Repository
πŸ“‚ Backend Systems via FASTAPI


32.7.1. 🌊 NOAA-ESD AI4ME API – Advancing Marine Research with AI! πŸš€#