chmcbs commited on
Commit
908afb0
·
verified ·
1 Parent(s): 4a10d47

Update README.md

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