File size: 3,241 Bytes
4109acb |
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 |
---
language: "en"
license: "gpl-3.0"
tags:
- segmentation
- computer-vision
- yolo
- beach
- water
- open-source
task_categories:
- image-segmentation
---
# π Water Surface Segmentation on Beach Images
## Model Overview
This model performs **semantic segmentation of water surfaces** in beach or coastal images.
Itβs a fine-tuned version of **YOLOv11n**, adapted for **binary segmentation** with a single class: **`water`**.
Built for lightweight, real-time deployment, the model achieves strong accuracy while remaining small and efficient.
---
## π§ Model Details
- **Architecture**: YOLOv11n segmentation head (binary)
- **Base framework**: PyTorch / Ultralytics YOLOv11
- **Input size**: 640Γ640 RGB images
- **Output**: Binary segmentation mask (1 class β `water`)
- **Model file**: `nwsd-v2.pt` (β6 MB)
---
## π Key Features
- β‘ **Real-time inference** on CPU/GPU
- πΌ **Outputs**: Binary masks, overlays, and coverage statistics
- π **Evaluation tools** included for metrics & visualization
- π **Easy Python integration** via a simple API (`nwsd_api.py`)
---
## π Performance
| Metric | Value | Notes |
|:--|:--|:--|
| **mAP50** | > 0.85 | On validation set |
| **Inference speed** | ~50 ms/image | On CPU |
| **GPU memory** | < 2 GB | For 640Γ640 input |
---
## π Dataset
- **Type**: Binary segmentation
- **Classes**: `water`
- **Annotations**: PNG masks
- **Source**: Custom-labeled beach dataset
π [Dataset on Roboflow](https://universe.roboflow.com/neptune-uxxqf/neptune-water-surface-detection)
---
## π§© Intended Uses
**Use cases:**
- Coastal or maritime monitoring
- Beach safety & drowning prevention systems
- Environmental analysis (e.g., water coverage estimation)
**Limitations:**
- Designed for daylight, clear beach imagery
- May underperform in low-visibility or night-time scenes
---
## π§ͺ How to Use
### Load model from Hub
```python
from huggingface_hub import hf_hub_download
import torch
model_path = hf_hub_download(repo_id="Ehlum-Lucas/NWSD", filename="nwsd-v2.pt")
model = torch.load(model_path, map_location="cpu")
model.eval()
```
### Inference example
```python
from PIL import Image
import torch
from torchvision import transforms
img = Image.open("beachTest.jpg").convert("RGB")
input_tensor = transforms.ToTensor()(img).unsqueeze(0)
with torch.no_grad():
pred = model(input_tensor)
```
### βοΈ Training
You can fine-tune or retrain the model using YOLOv11 tools:
```bash
python train.py --data data.yaml --weights <path_to_weights> --img 640 --batch 16 --epochs 50
```
Example configuration (data.yaml) defines paths to your datasets and class names.
### π§ Evaluation
```bash
python evaluate.py --data data.yaml --weights model/nwsd-v2.pt
```
Generates:
- Binary mask
- Overlay visualization
- Water coverage stats
## License
This model is released under the **GPL-3.0 License**. See the [LICENSE](LICENSE) file for details.
## Citation
If you use this model in your work, please consider citing:
```latex
@misc{nwsd2025,
title={Water Surface Segmentation on Beach Images},
author={Lucas Iglesia},
year={2025},
howpublished={\url{https://huggingface.co/Ehlum-Lucas/NWSD}}
}
```
|