Update README.md
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
datasets:
|
| 4 |
- GlobalWheat/GWFSS_v1.0
|
| 5 |
metrics:
|
|
@@ -10,10 +10,67 @@ pipeline_tag: image-segmentation
|
|
| 10 |
tags:
|
| 11 |
- computer-vision
|
| 12 |
- semantic-segmentation
|
| 13 |
-
-
|
| 14 |
-
- agriculture
|
| 15 |
- phenotyping
|
|
|
|
| 16 |
- crop-analysis
|
| 17 |
-
- instance-counting
|
| 18 |
- yield-estimation
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
datasets:
|
| 4 |
- GlobalWheat/GWFSS_v1.0
|
| 5 |
metrics:
|
|
|
|
| 10 |
tags:
|
| 11 |
- computer-vision
|
| 12 |
- semantic-segmentation
|
| 13 |
+
- instance-counting
|
|
|
|
| 14 |
- phenotyping
|
| 15 |
+
- agriculture
|
| 16 |
- crop-analysis
|
|
|
|
| 17 |
- yield-estimation
|
| 18 |
+
- wheat
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# 🌾 HeadCount: Automated Wheat Head Counter
|
| 22 |
+
|
| 23 |
+
Semantic segmentation model for counting wheat heads in field images. Designed for yield estimation from aerial imagery, flowering time detection, and field maturity assessment.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
- **Architecture:** DeepLabV3+ with ResNet50 encoder
|
| 28 |
+
- **Framework:** PyTorch with segmentation-models-pytorch
|
| 29 |
+
- **Input:** RGB images (resized to 512×512)
|
| 30 |
+
- **Output:** 4-class segmentation (Background, Leaf, Stem, Head)
|
| 31 |
+
- **Counting Method:** Distance transform + peak detection on head mask
|
| 32 |
+
- **Loss Function:** Dice loss with inverse frequency weighting (1.5× stem boost)
|
| 33 |
+
- **Optimizer:** Adam with CosineAnnealingLR scheduling
|
| 34 |
+
|
| 35 |
+
## Performance
|
| 36 |
+
|
| 37 |
+
| Class | F1 |
|
| 38 |
+
|------------|-------|
|
| 39 |
+
| Background | 0.858 |
|
| 40 |
+
| Leaf | 0.889 |
|
| 41 |
+
| Stem | 0.535 |
|
| 42 |
+
| Head | 0.897 |
|
| 43 |
+
|
| 44 |
+
## Example Usage
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
from inference import GWFSSModel
|
| 48 |
+
from PIL import Image
|
| 49 |
+
|
| 50 |
+
# Load model
|
| 51 |
+
model = GWFSSModel("model.pth")
|
| 52 |
+
|
| 53 |
+
# Load and process image
|
| 54 |
+
image = Image.open("input.jpg")
|
| 55 |
+
predictions = model.predict(image)
|
| 56 |
+
|
| 57 |
+
# Count heads
|
| 58 |
+
num_heads = model.count_heads(predictions)
|
| 59 |
+
print(f"🌾 {num_heads} heads detected!")
|
| 60 |
+
|
| 61 |
+
# Create visualisation
|
| 62 |
+
overlay = model.overlay_mask(image, predictions, alpha=0.5, heads_only=True)
|
| 63 |
+
overlay.save("output.png")
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Limitations
|
| 67 |
+
|
| 68 |
+
Best performance is achieved with overhead imagery under diffuse lighting. Known challenges include:
|
| 69 |
+
- **Lighting Sensitivity:** Bright or harsh lighting can cause over-segmentation, splitting single heads into multiple detections
|
| 70 |
+
- **Overlapping Heads:** Dense clusters with significant overlap are challenging to separate accurately
|
| 71 |
+
- **Colour Dependency:** Performance is lower on senesced plants
|
| 72 |
+
|
| 73 |
+
## Training Data
|
| 74 |
+
|
| 75 |
+
This model was trained on [`GWFSS_v1.0_labelled`](https://huggingface.co/datasets/GlobalWheat/GWFSS_v1.0) from the
|
| 76 |
+
[Global Wheat Full Semantic Organ Segmentation](https://doi.org/10.1016/j.plaphe.2025.100084) dataset.
|