Add local model asset catalog
This commit is contained in:
@@ -636,12 +636,51 @@ Returns object-detection model capability descriptors.
|
||||
}
|
||||
```
|
||||
|
||||
### GET `/api/v1/detection/model-assets`
|
||||
|
||||
Returns local runtime model files discovered in the configured model directory.
|
||||
This is a read-only catalog. GeoIntel never downloads, creates, mutates or
|
||||
deletes model weights from this endpoint.
|
||||
|
||||
The backend scans `YOLO_MODELS_DIR` (default `/app/models`) and reports
|
||||
supported local model files such as `.pt`, `.onnx` and `.engine`. The active
|
||||
model is the file matching `YOLO_MODEL_PATH`.
|
||||
|
||||
Response data:
|
||||
|
||||
```json
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"model_asset_id": "building-detector-pt",
|
||||
"filename": "building-detector.pt",
|
||||
"display_name": "building-detector",
|
||||
"model_path": "/app/models/building-detector.pt",
|
||||
"suffix": ".pt",
|
||||
"framework": "ultralytics/pytorch",
|
||||
"task_type": "object_detection",
|
||||
"size_bytes": 123456,
|
||||
"sha256": "sha256hex",
|
||||
"active": true,
|
||||
"status": "available",
|
||||
"limitation_message": "Local runtime model asset. GeoIntel will not download or mutate model weights.",
|
||||
"will_download_models": false
|
||||
}
|
||||
],
|
||||
"total": 1,
|
||||
"model_directory": "/app/models"
|
||||
}
|
||||
```
|
||||
|
||||
### GET `/api/v1/detection/yolo/preflight`
|
||||
|
||||
Returns a canonical envelope with read-only configured-YOLO runtime preflight
|
||||
state. Optional query parameters:
|
||||
|
||||
- `tile_manifest_path`: existing raster tile manifest path to validate.
|
||||
- `model_asset_id`: optional local model asset ID from
|
||||
`GET /api/v1/detection/model-assets`; when supplied, preflight validates that
|
||||
asset path instead of the default `YOLO_MODEL_PATH`.
|
||||
- `check_model_load`: default `false`; when `true`, explicitly loads only the
|
||||
configured local model file for compatibility smoke. It never downloads
|
||||
weights and never runs inference.
|
||||
@@ -651,6 +690,7 @@ Response data:
|
||||
```json
|
||||
{
|
||||
"model_id": "yolo-configured",
|
||||
"model_asset_id": null,
|
||||
"model_path": null,
|
||||
"tile_manifest_path": null,
|
||||
"status": "not_configured",
|
||||
@@ -693,6 +733,7 @@ Request:
|
||||
"project_id": "uuid",
|
||||
"dataset_id": "uuid",
|
||||
"model_id": "yolo-placeholder",
|
||||
"model_asset_id": null,
|
||||
"confidence_threshold": 0.5,
|
||||
"class_filter": ["building"],
|
||||
"tile_manifest_path": null,
|
||||
@@ -707,6 +748,12 @@ Sprint 8B configured YOLO mode uses `model_id: "yolo-configured"`. It requires:
|
||||
- backend optional AI dependencies installed with `geointel-backend[ai]`
|
||||
- `tile_manifest_path` pointing to an existing raster tile manifest generated by the raster tile operation
|
||||
|
||||
`model_asset_id` may be supplied with `model_id: "yolo-configured"` to select a
|
||||
specific local model file from the read-only model asset catalog. The backend
|
||||
resolves the ID to a file inside the configured model directory and persists the
|
||||
asset ID, path and SHA-256 in the job and analysis-run parameters for
|
||||
reproducibility. Clients must not submit arbitrary model paths.
|
||||
|
||||
GeoIntel does not download model weights automatically. Configured YOLO runs read existing tile files from the manifest, convert YOLO pixel-space boxes to EPSG:4326 detection polygons and persist detections as first-class records.
|
||||
|
||||
Unavailable model response:
|
||||
@@ -729,6 +776,7 @@ Validation errors:
|
||||
|
||||
- `INVALID_DATASET_TYPE` when the dataset is not raster.
|
||||
- `DETECTION_MODEL_NOT_FOUND` when the model id is unknown.
|
||||
- `DETECTION_MODEL_ASSET_NOT_FOUND` when `model_asset_id` is not present in the configured model directory.
|
||||
- `FIXTURE_MODE_REQUIRED` when `manual-fixture-detector` is requested without `parameters_json.fixture_mode=true`.
|
||||
- `DETECTION_TILE_MANIFEST_REQUIRED` when `yolo-configured` is requested without `tile_manifest_path`.
|
||||
- `DETECTION_TILE_MANIFEST_NOT_FOUND` when the provided manifest path does not exist.
|
||||
|
||||
Reference in New Issue
Block a user