Tabular Classification
Scikit-learn
Joblib
agriculture
crop-type
crop-mapping
remote-sensing
alphaearth
Instructions to use edoggy/crop-classifier-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use edoggy/crop-classifier-v1 with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("edoggy/crop-classifier-v1", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +39 -0
- crop_classifier_v1.joblib +3 -0
- metrics.json +80 -0
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
library_name: sklearn
|
| 4 |
+
tags: [agriculture, crop-type, crop-mapping, remote-sensing, alphaearth, tabular-classification]
|
| 5 |
+
datasets: [edoggy/sugarcane-satellite-embeddings]
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# Crop-type classifier on Satellite Embeddings (v1)
|
| 9 |
+
|
| 10 |
+
One gradient-boosted model (sklearn HistGradientBoosting) that maps a 64-dim Google Satellite Embedding
|
| 11 |
+
vector of a cropland pixel to a crop type. Trained on USDA CDL labels (Louisiana, Florida, Texas, 2018–2024)
|
| 12 |
+
and MapBiomas Collection 10 labels (São Paulo, 2020, 2023). Classes: sugarcane, soybeans, corn, cotton, rice,
|
| 13 |
+
winter_wheat, peanuts, sorghum, citrus, hay, sod, other_tree, pasture, forest_plantation, other.
|
| 14 |
+
|
| 15 |
+
## Results — US 2024, trained on 2018–2023 only
|
| 16 |
+
Accuracy 0.823, weighted F1 0.858. Per-class F1: sugarcane 0.94, corn 0.90, soybeans 0.89, cotton 0.86,
|
| 17 |
+
rice 0.85, winter wheat 0.83, peanuts 0.80, citrus 0.76, sorghum 0.68, hay 0.49, sod 0.17.
|
| 18 |
+
|
| 19 |
+
## Known confusions (honest limits)
|
| 20 |
+
- US: sugarcane→sorghum (both tall C4 grasses), citrus→sod and citrus→hay (Florida sod farms between groves),
|
| 21 |
+
hay↔sod↔other (grassy classes CDL itself labels inconsistently).
|
| 22 |
+
- Brazil (SP 2023 holdout): sugarcane→pasture, ~10% of cane pixels. Cane on marginal land and degraded
|
| 23 |
+
pasture overlap in the embedding.
|
| 24 |
+
|
| 25 |
+
## Scope
|
| 26 |
+
- Class proportions reflect the sampling: sugarcane is oversampled (50% of rows); other crops appear at their
|
| 27 |
+
natural frequency among cropland. Rare classes (<1,500 rows) are folded into `other`.
|
| 28 |
+
- Embeddings are strongly region/season-specific; this model is calibrated to the trained regions. Elsewhere,
|
| 29 |
+
label a few thousand local pixels and retrain (see the sugarcane classifier card for the dose curve).
|
| 30 |
+
- Apply only to pixels already known to be cropland.
|
| 31 |
+
- Not a price or supply predictor: annual embeddings arrive after official acreage reports.
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
```python
|
| 35 |
+
import joblib; from huggingface_hub import hf_hub_download
|
| 36 |
+
m = joblib.load(hf_hub_download("edoggy/crop-classifier-v1", "crop_classifier_v1.joblib"))
|
| 37 |
+
m.predict(embeddings_64d) # returns class names
|
| 38 |
+
```
|
| 39 |
+
Embeddings: Google Satellite Embedding V1 (CC-BY-4.0). Labels: USDA CDL (public domain), MapBiomas C10 (CC-BY-4.0).
|
crop_classifier_v1.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:16ea236584060f3dbc72a150076bd256727895cc5084ee33160bb65e628e5fe5
|
| 3 |
+
size 682112
|
metrics.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"classes": [
|
| 3 |
+
"citrus",
|
| 4 |
+
"corn",
|
| 5 |
+
"cotton",
|
| 6 |
+
"forest_plantation",
|
| 7 |
+
"hay",
|
| 8 |
+
"other",
|
| 9 |
+
"other_tree",
|
| 10 |
+
"pasture",
|
| 11 |
+
"peanuts",
|
| 12 |
+
"rice",
|
| 13 |
+
"sod",
|
| 14 |
+
"sorghum",
|
| 15 |
+
"soybeans",
|
| 16 |
+
"sugarcane",
|
| 17 |
+
"winter_wheat"
|
| 18 |
+
],
|
| 19 |
+
"cdl_map": {
|
| 20 |
+
"45": "sugarcane",
|
| 21 |
+
"5": "soybeans",
|
| 22 |
+
"1": "corn",
|
| 23 |
+
"3": "rice",
|
| 24 |
+
"24": "winter_wheat",
|
| 25 |
+
"2": "cotton",
|
| 26 |
+
"37": "hay",
|
| 27 |
+
"212": "citrus",
|
| 28 |
+
"72": "citrus",
|
| 29 |
+
"61": "fallow",
|
| 30 |
+
"59": "sod",
|
| 31 |
+
"26": "dbl_wheat_soy",
|
| 32 |
+
"4": "sorghum",
|
| 33 |
+
"10": "peanuts",
|
| 34 |
+
"215": "avocado",
|
| 35 |
+
"71": "other_tree",
|
| 36 |
+
"47": "vegetables",
|
| 37 |
+
"216": "vegetables",
|
| 38 |
+
"221": "strawberries"
|
| 39 |
+
},
|
| 40 |
+
"mapbiomas_map": {
|
| 41 |
+
"20": "sugarcane",
|
| 42 |
+
"39": "soybeans",
|
| 43 |
+
"41": "other_temp_crop",
|
| 44 |
+
"40": "rice",
|
| 45 |
+
"62": "cotton",
|
| 46 |
+
"46": "coffee",
|
| 47 |
+
"47": "citrus",
|
| 48 |
+
"48": "other_perennial",
|
| 49 |
+
"9": "forest_plantation",
|
| 50 |
+
"15": "pasture"
|
| 51 |
+
},
|
| 52 |
+
"us_2024_holdout": {
|
| 53 |
+
"accuracy": 0.823,
|
| 54 |
+
"weighted_f1": 0.858,
|
| 55 |
+
"macro_f1": 0.695,
|
| 56 |
+
"per_class_f1": {
|
| 57 |
+
"sugarcane": 0.94,
|
| 58 |
+
"corn": 0.9,
|
| 59 |
+
"soybeans": 0.89,
|
| 60 |
+
"cotton": 0.86,
|
| 61 |
+
"rice": 0.85,
|
| 62 |
+
"winter_wheat": 0.83,
|
| 63 |
+
"peanuts": 0.8,
|
| 64 |
+
"citrus": 0.76,
|
| 65 |
+
"sorghum": 0.68,
|
| 66 |
+
"hay": 0.49,
|
| 67 |
+
"sod": 0.17
|
| 68 |
+
}
|
| 69 |
+
},
|
| 70 |
+
"top_confusions_us": [
|
| 71 |
+
"sugarcane->sorghum",
|
| 72 |
+
"citrus->sod",
|
| 73 |
+
"citrus->hay",
|
| 74 |
+
"hay->sod"
|
| 75 |
+
],
|
| 76 |
+
"top_confusions_brazil": [
|
| 77 |
+
"sugarcane->pasture (~10% of cane)",
|
| 78 |
+
"sugarcane->soybeans"
|
| 79 |
+
]
|
| 80 |
+
}
|