Spaces:
Runtime error
Runtime error
Use clean_crowns with built-in containment check, drop remove_contained_crowns
Browse filesclean_crowns now handles nested crowns natively — most confident wins.
post_clean fills gaps left when a large less-confident crown is replaced
by a small confident one. No separate removal step needed.
Pins detectree2 to 1af7f9f.
Co-authored-by: Cursor <cursoragent@cursor.com>
Files changed (2)
- Dockerfile+1-1
- app.py+2-5
30 unmodified lines3132333435363730 unmodified lines# Geo + UI + detectree2RUN python3 -m pip install --no-cache-dir \gradio==4.* rasterio geopandas shapely matplotlib \"git+https://github.com/PatBall1/detectree2.git@fdb3973"WORKDIR /appCOPY app.py /app/app.py30 unmodified lines3132333435363730 unmodified lines# Geo + UI + detectree2RUN python3 -m pip install --no-cache-dir \gradio==4.* rasterio geopandas shapely matplotlib \"git+https://github.com/PatBall1/detectree2.git@1af7f9f"WORKDIR /appCOPY app.py /app/app.py
22 unmodified lines23242526272829106 unmodified lines13613713813914014114214314414514614722 unmodified linesfrom detectron2.engine import DefaultPredictorfrom detectree2.preprocessing.tiling import tile_datafrom detectree2.models.outputs import project_to_geojson, stitch_crowns, clean_crowns, post_clean, remove_contained_crownsfrom detectree2.models.predict import predict_on_datafrom detectree2.models.train import setup_cfg106 unmodified linescrowns = stitch_crowns(preds_geo_dir, 1)cleaned = clean_crowns(crowns, 0.6, confidence=0)update_progress(0.86, "Filling gaps with post_clean...")cleaned = post_clean(crowns, cleaned, iou_threshold=0.3, field="Confidence_score", verbose=True)update_progress(0.90, "Removing nested crowns...")cleaned = remove_contained_crowns(cleaned, containment_threshold=0.85)cleaned = cleaned[cleaned["Confidence_score"] > float(conf_threshold)].set_geometry(cleaned.simplify(0.4))22 unmodified lines23242526272829106 unmodified lines13613713813914014114214314422 unmodified linesfrom detectron2.engine import DefaultPredictorfrom detectree2.preprocessing.tiling import tile_datafrom detectree2.models.outputs import project_to_geojson, stitch_crowns, clean_crowns, post_cleanfrom detectree2.models.predict import predict_on_datafrom detectree2.models.train import setup_cfg106 unmodified linescrowns = stitch_crowns(preds_geo_dir, 1)cleaned = clean_crowns(crowns, 0.6, confidence=0)update_progress(0.88, "Filling gaps with post_clean...")cleaned = post_clean(crowns, cleaned, iou_threshold=0.3, field="Confidence_score", verbose=True)cleaned = cleaned[cleaned["Confidence_score"] > float(conf_threshold)].set_geometry(cleaned.simplify(0.4))
Dockerfile+1-1
app.py+2-5