Skip to content

About

We propose a hybrid framework for automated coral reef ecological risk assessment that combines zero-shot visual reasoning with causal inference

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

coral-reef-risk-fcm

A Hybrid Framework for Automated Coral Reef Risk Assessment by Zero-Shot Visual Perception and Fuzzy Cognitive Map Inference

Fabio Porcelli · Simone Cioffi · Emanuel Di Nardo · Angelo Ciaramella Department of Science and Technologies — University of Naples Parthenope

AUSTech 2026


Overview

This project presents an automated pipeline for ecological risk assessment of coral reef ecosystems, developed at the University of Naples Parthenope. The system processes raw underwater survey images and produces a six-dimensional risk profile without any task-specific fine-tuning or manual annotation.

Coral reefs cover less than 1% of the ocean floor yet sustain approximately 25% of all known marine species. The fourth global mass bleaching event (2023–2025) affected 84% of the world's reef systems across 82 countries — the largest on record. As of 2024, the IUCN Red List classifies 44% of reef-building coral species as threatened with extinction. This pipeline addresses the monitoring gap left by labour-intensive manual surveys.


Core Components

Technical Stack: The pipeline combines Gemma 4-E4B (Google DeepMind, Apache 2.0) as a zero-shot multimodal perception layer with a Fuzzy Cognitive Map for expert-guided causal inference, evaluated on the Coralscapes dataset. The notebook runs on a single NVIDIA T4 GPU via the Kaggle platform.

Key Capabilities:

  • Zero-shot ecological feature extraction from raw underwater images — no fine-tuning, no annotation
  • 25 quantitative features normalised to [0, 1] across coral-specific, general marine, and anthropogenic groups
  • Causal risk inference through a 31-node FCM with an expert-initialised weight matrix (94 directed edges)
  • Six-dimensional risk profile: ecosystem_health, pollution_risk, thermal_stress_risk, habitat_degradation_risk, recovery_potential, heritage_integrity_risk
  • Convergence within 4–5 FCM iterations across all tested inputs
  • Deployable on commodity single-GPU hardware with open-weight models and public datasets

Architecture

The framework operates in two sequential stages:

Coralscapes Image (1024×2048 px)
        │
        ▼
┌─────────────────────────────┐
│  Stage 1 · Gemma 4-E4B      │  ← zero-shot, expert system prompt, JSON output
│  25 ecological features     │     visual token budget: 1120
│  normalised to [0, 1]       │
└────────────┬────────────────┘
             │  feature vector x ∈ [0,1]²⁵
             ▼
┌─────────────────────────────┐
│  Stage 2 · Fuzzy Cognitive  │  ← expert weight matrix W, sigmoid dynamics
│  Map (31 nodes, 94 edges)   │     clamped input activations, max 50 iterations
└────────────┬────────────────┘
             │
             ▼
     Risk Profile r ∈ [0,1]⁶

Stage 1 queries Gemma 4-E4B with a structured system prompt that assigns it the role of an expert marine biologist. The model returns the 25-feature vector as a valid JSON object with no additional text, enforcing parsability without post-processing heuristics.

Stage 2 feeds the feature vector as clamped input activations into the FCM. Risk concept activations evolve according to:

$$c_j^{(t+1)} = \sigma!\left(\sum_{i \in C_{\mathrm{in}}} w_{ij}, x_i + \sum_{k \in C_{\mathrm{risk}}} w_{kj}, c_k^{(t)}\right), \quad j \in C_{\mathrm{risk}}$$

where $\sigma(z) = (1 + e^{-z})^{-1}$. Convergence criterion: $|c^{(t+1)} - c^{(t)}|_\infty < 10^{-5}$.

The weight matrix encodes biological prior knowledge with ordinal strength tiers (weak ±0.20, moderate ±0.40–0.60, strong ±0.70–0.90) validated by scenario simulation. habitat_degradation_risk is the most highly connected concept, receiving excitatory input from blast_fishing_damage (+0.90) and rubble_cover (+0.75), and inhibitory modulation from recovery_potential (−0.55) and ecosystem_health (−0.60).


Ecological Features

Group Features
Coral-specific (12) coral_cover_alive, coral_bleaching, coral_morphology_diversity, dead_coral_algae, juvenile_coral_recruitment, coralline_algae, substrate_rugosity, rubble_cover, sediment_stress, water_turbidity, algae_coverage, sand_cover
General marine (7) fish_abundance, seagrass_coverage, macro_invertebrate_diversity, sponge_coverage, coral_disease_signs, crown_of_thorns_starfish, soft_coral_abundance
Anthropogenic (6) anchoring_mechanical_damage, ghost_fishing_gear, blast_fishing_damage, image_assessability, sea_urchin_density, marine_debris

Installation

Docker (Recommended)

Requires Docker and an NVIDIA GPU with the NVIDIA Container Toolkit. Gemma 4 model weights must be downloaded separately from Hugging Face.

# Build the image
docker build -t coral-reef-risk-fcm .

# Run Jupyter inside the container
docker run --rm --gpus all \
  -p 8888:8888 \
  -v $(pwd)/outputs:/app/outputs \
  -v /path/to/model/weights:/app/models \
  -v /path/to/coralscapes:/app/data \
  coral-reef-risk-fcm

Then open http://localhost:8888 and run gemma4-fcm.ipynb.

For FCM-only inference (Stage 2, CPU, no GPU required):

docker run --rm \
  -v $(pwd)/outputs:/app/outputs \
  coral-reef-risk-fcm \
  python run_fcm.py --input outputs/features.jsonl --output outputs/risk_scores.jsonl

Kaggle (original environment)

The notebook is designed to run on Kaggle with a T4 GPU. Required sources declared in notebook metadata:

  • google/gemma/keras/gemma4-e4b — Gemma 4-E4B model weights
  • Coralscapes dataset (version ID 15929973)

No local setup needed; GPU, dependencies, and dataset are provisioned automatically.

Local Setup

Requires Python 3.12, an NVIDIA GPU, and the CUDA toolkit.

git clone https://github.com/porcellifabio/coral-reef-risk-fcm.git
cd coral-reef-risk-fcm
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
jupyter notebook gemma4-fcm.ipynb

Dataset

The pipeline is evaluated on Coralscapes (Sauder et al., ICCVW 2025):

  • 2,075 high-resolution images (1024×2048 px)
  • 35 dive sites across 5 Red Sea countries
  • 174k expert-labelled polygons, 39 benthic classes
  • Experiments use the test split (N = 50 images)

Download:


Results

Scenario Analysis

FCM risk profiles for four synthetic ecological scenarios validating the ecological consistency of the expert weight matrix:

Scenario EH PR TSR HDR RP HIR
Healthy reef 0.986 0.451 0.511 0.068 0.959 0.476
Post-bleaching 0.339 0.616 0.556 0.819 0.144 0.697
COTS + blast fishing 0.081 0.692 0.500 0.962 0.034 0.855
Urchin barren 0.674 0.500 0.500 0.540 0.459 0.568

EH = ecosystem health · PR = pollution risk · TSR = thermal stress risk · HDR = habitat degradation risk · RP = recovery potential · HIR = heritage integrity risk

Sample — test_0

{
  "ecosystem_health": 0.69,
  "pollution_risk": 0.59,
  "thermal_stress_risk": 0.52,
  "habitat_degradation_risk": 0.48,
  "recovery_potential": 0.51,
  "heritage_integrity_risk": 0.50
}

Consistent with a moderately degraded reef with residual structural complexity (substrate_rugosity = 0.70, coral_morphology_diversity = 0.60) alongside early-stage stressors.


Repository Structure

coral-reef-risk-fcm/
├── gemma4-fcm.ipynb       # Main notebook (Kaggle T4, Python 3.12)
├── Dockerfile
├── requirements.txt
├── README.md
└── outputs/
    └── results.jsonl      # Per-image feature vectors and risk scores

Future Direction

Planned enhancements include adaptive weight learning via online Hebbian strategies to allow the causal structure to self-refine from new observations, quantitative validation against expert-annotated reef health indices, longitudinal monitoring over temporal image sequences, and systematic prompt ablation across Gemma 4 model variants (E2B, E4B, 26B-A4B, 31B).


Citation

@inproceedings{porcelli2026coral,
  title     = {A Hybrid Framework for Automated Coral Reef Risk Assessment
               by Zero-Shot Visual Perception and Fuzzy Cognitive Map Inference},
  author    = {Porcelli, Fabio and Cioffi, Simone and
               Di Nardo, Emanuel and Ciaramella, Angelo},
  booktitle = {Proceedings of AUSTech 2026},
  year      = {2026},
  institution = {University of Naples Parthenope}
}

License

Code released under the Apache 2.0 License, consistent with the Gemma 4 model license. The Coralscapes dataset is subject to its own terms — see the dataset page.


Acknowledgements

This work uses Gemma 4 by Google DeepMind (Apache 2.0) and the Coralscapes dataset by Sauder et al. Experiments were conducted on the Kaggle platform with free T4 GPU access.

About

We propose a hybrid framework for automated coral reef ecological risk assessment that combines zero-shot visual reasoning with causal inference

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages