What's changed
REST API (samgeo.api) robustness fixes, validated end-to-end against the example imagery in docs/examples/ (#535):
- Model cache mode collision — the cache key now folds in the model-shaping kwargs (
automatic,backend,confidence_threshold,points_per_side,pred_iou_thresh,stability_score_thresh), so an automatic mask-generation instance is no longer reused for a prompt-predictrequest ('SamGeo2' object has no attribute 'predictor'), and requests that differ only by configuration no longer silently reuse a stale instance. - SAM3 second-request dtype error — SAM3 mutates its encoded-image state during
generate_*, so the image-hash optimization made the 2nd+ SAM3 request fail withexpected scalar type BFloat16 but found Float._set_image_cachednow always re-encodes for SAM3 (SAM/SAM2 still cached). - Empty-mask vectorization —
raster_to_vectornow emits a valid emptyFeatureCollectioninstead of raising geopandas' "no active geometry column" when a mask has no foreground. /segment/automaticgained the empty-masks 404 guard the other endpoints have, and now defaults to SAM3.
Added regression tests for all of the above.
Full diff: v1.3.2...v1.3.3