Download examples/predict_area.py from -1/Brigalow-QLD-v1: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/-1/Brigalow-QLD-v1/resolve/main/examples/predict_area.py
- Command line
-
hf download hf://-1/Brigalow-QLD-v1/examples/predict_area.py
-
curl -L -o predict_area.py https://huggingface.co/-1/Brigalow-QLD-v1/resolve/main/examples/predict_area.py
884 Bytes
| """Map clearing in a small area from Python (Brigalow, a model that maps woody-vegetation clearing in Queensland). | |
| Needs the weights (a model directory with model.json, or a .onnx file). The Queensland mask layers come from the public | |
| mirror (-1/Brigalow-QLD-inputs) by default, no key needed; tern_root="DIR" uses local files instead. If the masks | |
| cannot be read the run is Sentinel-2 only, and it says so.""" | |
| import geopandas as gpd, rasterio | |
| from brigalow.cli import predict_area | |
| run = predict_area((146.60, -22.70, 146.65, -22.65), 2025, "out_2025", weights="weights/brigalow") | |
| alerts = gpd.read_file("out_2025/alerts.gpkg") # EPSG:4326, one row per alert | |
| print(alerts.groupby("confidence").area_ha.agg(["count", "sum"])) | |
| with rasterio.open("out_2025/probability.tif") as src: | |
| prob = src.read(1, masked=True) / 250.0 # 255 = no data | |