File size: 7,218 Bytes
d550e14 8b2729d d550e14 8373aa5 a43fc29 3244af8 d550e14 f07019a 18b0adf 8373aa5 18b0adf 8373aa5 3e8a46c 8373aa5 c540316 8373aa5 46ffc17 8373aa5 b71bb23 8373aa5 2ec2fd9 0a8a525 2ec2fd9 0a8a525 2ec2fd9 3e8a46c 8373aa5 facc1bd 8373aa5 678da24 18b0adf a43fc29 |
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
---
datasets:
- akridge/NOAA-ESD-CORAL-Bleaching-Dataset
language:
- en
license: agpl-3.0
base_model:
- google/vit-base-patch16-224
tags:
- vit
- vision-transformer
- coral
- coral-bleaching
- image-classification
- NOAA
- marine-ecosystem
pipeline_tag: image-classification
library_name: transformers
model-index:
- name: noaa-esd-coral-bleaching-vit-classifier-v1
results:
- task:
type: image-classification
dataset:
type: NOAA-ESD-CORAL-Bleaching-Dataset
name: NOAA-ESD-CORAL-Bleaching-Dataset
metrics:
- type: accuracy
value: 0.85
- type: precision
value: 0.84
- type: recall
value: 0.75
---
# NOAA ESD Coral Bleaching ViT Based Patch Image Classifier
## π Model Overview
This model was trained to **classify coral bleaching conditions** using the Vision Transformer (ViT) architecture on imagery from **NOAA-PIFSC Ecosystem Sciences Division (ESD)** Coral Bleaching Classifier dataset. The dataset includes **human-annotated points** indicating healthy and bleached coral, enabling classification for marine ecosystem monitoring.
- **Model Architecture**: Google/ViT Base Patch16 224
- **Task**: Coral Bleaching Image Classification
- **Classes**:
- `CORAL`: Healthy coral
- `CORAL_BL`: Bleached coral


## π Model Weights
- Download the **TorchScript model** [here](./noaa-esd-coral-bleaching-vit-classifier-v1.pt)
- Download the **ONNX model** [here](./noaa-esd-coral-bleaching-vit-classifier-v1.onnx)
- Access the **base model folder** [here](./model.safetensors)
## π
Dataset & Annotations
- **Dataset**: [NOAA ESD Coral Bleaching Classifier Dataset](https://huggingface.co/datasets/akridge/NOAA-ESD-CORAL-Bleaching-Dataset)
- **Annotation Method**:
- Points annotated by human experts using both **randomly generated** and **targeted sampling methods**.
| Split | Images | Description |
|------------|---------|------------------------------------|
| Training | 7,292 | Used for model training. |
| Validation | 1,562 | Used for model hyperparameter tuning and early stopping. |
| Test | 1,565 | Used for final model evaluation. |
## π Training Configuration
- **Dataset**: NOAA ESD Coral Bleaching Classifier Dataset
- **Training/Validation Split**: 70% training, 15% validation, 15% testing
- **Epochs**: 100
- **Batch Size**: 16
- **Learning Rate**: 3e-4
- **Image Size**: 224x224 (consistent with ViT input requirements)
## π Results and Metrics
The model was evaluated using a withheld test set. The predictions were compared against human-labeled points for validation.
π Classification Report:
| |precision |recall|f1-score|
|-|-|-|-|
|CORAL| 0.86| 0.91| 0.88|
|CORAL_BL| 0.84| 0.75| 0.79|
| | | | | |
|accuracy| | | 0.85|
|macro avg| 0.85| 0.83| 0.84|
|weighted avg| 0.85| 0.85| 0.85|

## π How to Use the Model
### π Load with Transformers
```
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
model = AutoModelForImageClassification.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
```
```
import torch
from transformers import ViTForImageClassification, AutoImageProcessor
from PIL import Image
# β
Load the model and processor
model = ViTForImageClassification.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
processor = AutoImageProcessor.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
# β
Load and process image
image = Image.open("your_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# β
Perform inference
with torch.no_grad():
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item()
id2label = model.config.id2label
print(f"Prediction: {prediction} ({id2label[prediction]})")
```
### π Use TorchScript
```
import torch
# β
Load the TorchScript model
scripted_model = torch.jit.load("noaa-esd-coral-bleaching-vit-classifier-v1.pt")
scripted_model.eval()
# β
Inference with TorchScript model
with torch.no_grad():
scripted_output = scripted_model(inputs["pixel_values"])
scripted_prediction = scripted_output.argmax(-1).item()
print(f"TorchScript Prediction: {id2label[scripted_prediction]}")
```
### π Use ONNX
```
import onnxruntime as ort
# β
Load the ONNX model
onnx_model = "noaa-esd-coral-bleaching-vit-classifier-v1.onnx"
ort_session = ort.InferenceSession(onnx_model)
# β
Prepare ONNX input
onnx_inputs = {"input": inputs["pixel_values"].numpy()}
# β
Run inference with ONNX
onnx_outputs = ort_session.run(None, onnx_inputs)
onnx_prediction = onnx_outputs[0].argmax(axis=1)[0]
print(f"ONNX Prediction: {id2label[onnx_prediction]}")
```
### Intended Use
- **Monitoring coral reef health** through automated image classification.
- **Scientific research** in marine biology and ecosystem science.
### Limitations
- The model was trained on the NOAA ESD dataset; it may not generalize to different regions or unrepresented coral species.
- Images with **low resolution** or **poor lighting** may lead to incorrect predictions.
- **Vertical or flipped images** should be processed with appropriate orientation adjustments.
### Ethical Considerations
- Predictions should not replace expert human validation in critical conservation decisions.
## Metadata / Citation
**Citation:**
Pacific Islands Fisheries Science Center (2025). Ecosystem Sciences Division (ESD);
**Related Metadata:**
- [Benthic Cover Derived from Analysis of Benthic Images (2019)](https://www.fisheries.noaa.gov/inport/item/59195)
- [NOAA ESD Coral Bleaching Classifier Annotations Data Dictionary](https://www.fisheries.noaa.gov/inport/item/68138)
- [Developing a semi-automated CoralNet Bleaching Classifier: annotations and imagery from survey sites across the Hawaiian Archipelago between 2014 and 2019](https://www.fisheries.noaa.gov/inport/item/67962)
#### Disclaimer
This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA project content is provided on an βas isβ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government. |