akridge commited on
Commit
8373aa5
Β·
verified Β·
1 Parent(s): 18b0adf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -1
README.md CHANGED
@@ -5,11 +5,120 @@ language:
5
  - en
6
  base_model:
7
  - google/vit-base-patch16-224
 
 
 
 
 
 
 
 
 
8
  ---
9
- # NOAA-ESD-Coral-Bleaching-ViT-Classifier-v1
10
 
 
 
11
 
 
 
 
 
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  #### Disclaimer
15
  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.
 
5
  - en
6
  base_model:
7
  - google/vit-base-patch16-224
8
+ tags:
9
+ - vit
10
+ - vision-transformer
11
+ - coral
12
+ - coral-bleaching
13
+ - image-classification
14
+ - NOAA
15
+ - marine-ecosystem
16
+ pipeline_tag: image-classification
17
  ---
18
+ # NOAA ESD Coral Bleaching ViT Classifier
19
 
20
+ ## πŸ“ Model Overview
21
+ 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.
22
 
23
+ - **Model Architecture**: Google/ViT Base Patch16 224
24
+ - **Task**: Coral Bleaching Image Classification
25
+ - **Classes**:
26
+ - `CORAL`: Healthy coral
27
+ - `CORAL_BL`: Bleached coral
28
 
29
+ ## πŸ“Š Model Weights
30
+ - Download the **TorchScript model** [here](./noaa-esd-coral-bleaching-vit-classifier-v1.pt)
31
+ - Download the **ONNX model** [here](./noaa-esd-coral-bleaching-vit-classifier-v1.onnx)
32
+ - Access the **base model folder** [here](./coral_vit_model/)
33
+
34
+ ## πŸ“… Dataset & Annotations
35
+ - **Dataset**: [NOAA ESD Coral Bleaching Classifier Dataset](https://huggingface.co/datasets/akridge/NOAA-ESD-CORAL-Bleaching-Dataset)
36
+ - **Annotation Method**:
37
+ - Points annotated by human experts using both **randomly generated** and **targeted sampling methods**.
38
+
39
+ ## πŸ“š Training Configuration
40
+ - **Dataset**: NOAA ESD Coral Bleaching Classifier Dataset
41
+ - **Training/Validation Split**: 70% training, 15% validation, 15% testing
42
+ - **Epochs**: 10
43
+ - **Batch Size**: 16
44
+ - **Learning Rate**: 3e-4
45
+ - **Image Size**: 224x224 (consistent with ViT input requirements)
46
+
47
+ ## πŸ“ˆ Results and Metrics
48
+ The model was evaluated using a withheld test set. The predictions were compared against human-labeled points for validation.
49
+
50
+ ### Confusion Matrix
51
+
52
+ ## πŸš€ How to Use the Model
53
+
54
+ ### πŸ”— Load with Transformers
55
+ ```
56
+ import torch
57
+ from transformers import ViTForImageClassification, AutoImageProcessor
58
+ from PIL import Image
59
+
60
+ # βœ… Load the model and processor
61
+ model = ViTForImageClassification.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
62
+ processor = AutoImageProcessor.from_pretrained("akridge/noaa-esd-coral-bleaching-vit-classifier-v1")
63
+
64
+ # βœ… Load and process image
65
+ image = Image.open("your_image.jpg").convert("RGB")
66
+ inputs = processor(images=image, return_tensors="pt")
67
+
68
+ # βœ… Perform inference
69
+ with torch.no_grad():
70
+ outputs = model(**inputs)
71
+ prediction = outputs.logits.argmax(-1).item()
72
+
73
+ id2label = model.config.id2label
74
+ print(f"Prediction: {prediction} ({id2label[prediction]})")
75
+ ```
76
+ ### πŸ”— Use TorchScript
77
+ ```
78
+ import torch
79
+
80
+ # βœ… Load the TorchScript model
81
+ scripted_model = torch.jit.load("noaa-esd-coral-bleaching-vit-classifier-v1.pt")
82
+ scripted_model.eval()
83
+
84
+ # βœ… Inference with TorchScript model
85
+ with torch.no_grad():
86
+ scripted_output = scripted_model(inputs["pixel_values"])
87
+ scripted_prediction = scripted_output.argmax(-1).item()
88
+
89
+ print(f"TorchScript Prediction: {id2label[scripted_prediction]}")
90
+
91
+ ```
92
+ ### πŸ”— Use ONNX
93
+ ```
94
+ import onnxruntime as ort
95
+
96
+ # βœ… Load the ONNX model
97
+ onnx_model = "noaa-esd-coral-bleaching-vit-classifier-v1.onnx"
98
+ ort_session = ort.InferenceSession(onnx_model)
99
+
100
+ # βœ… Prepare ONNX input
101
+ onnx_inputs = {"input": inputs["pixel_values"].numpy()}
102
+
103
+ # βœ… Run inference with ONNX
104
+ onnx_outputs = ort_session.run(None, onnx_inputs)
105
+ onnx_prediction = onnx_outputs[0].argmax(axis=1)[0]
106
+
107
+ print(f"ONNX Prediction: {id2label[onnx_prediction]}")
108
+
109
+ ```
110
+
111
+ ### Intended Use
112
+ - **Monitoring coral reef health** through automated image classification.
113
+ - **Scientific research** in marine biology and ecosystem science.
114
+
115
+ ### Limitations
116
+ - The model was trained on the NOAA ESD dataset; it may not generalize to different regions or unrepresented coral species.
117
+ - Images with **low resolution** or **poor lighting** may lead to incorrect predictions.
118
+ - **Vertical or flipped images** should be processed with appropriate orientation adjustments.
119
+
120
+ ### Ethical Considerations
121
+ - Predictions should not replace expert human validation in **critical conservation decisions**.
122
 
123
  #### Disclaimer
124
  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.