samgis_web.prediction_api package¶
Submodules¶
samgis_web.prediction_api.predictors module¶
functions using machine learning instance model(s)
- samgis_web.prediction_api.predictors.samexporter_predict(bbox, prompt, zoom, model_name='mobile_sam', source='https://tile.openstreetmap.org/{z}/{x}/{y}.png', source_name=None, model_folder=PosixPath('/opt/buildhome/.cache/pypoetry/virtualenvs/samgis-VmB9M1Nz-py3.12/lib/python3.12/site-packages/machine_learning_models'))[source]¶
Return predictions as a geojson from a geo-referenced image using the given input prompt.
if necessary instantiate a segment anything machine learning instance model
download a geo-referenced raster image delimited by the coordinates bounding box (bbox)
get a prediction image from the segment anything instance model using the input prompt
get a geo-referenced geojson from the prediction image
- Parameters:
bbox (
LlistFloat
) – coordinates bounding boxprompt (
ListDict
) – machine learning input promptzoom (
float
) – Level of detailmodel_name (
str
, default:'mobile_sam'
) – machine learning model namesource (
str
, default:'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
) – xyz tile provider objectsource_name (
str
, default:None
) – name of tile provider,model_folder (
str
|Path
, default:PosixPath('/opt/buildhome/.cache/pypoetry/virtualenvs/samgis-VmB9M1Nz-py3.12/lib/python3.12/site-packages/machine_learning_models')
) – ML models folder
- Return type:
- Returns:
dict containing the output geojson, the prediction masks number and the geojson shapes number
Module contents¶
functions useful to handle machine learning models