Skip to content

Single window models#58

Merged
asmithml merged 4 commits into
mainfrom
single-window-models
Oct 12, 2025
Merged

Single window models#58
asmithml merged 4 commits into
mainfrom
single-window-models

Conversation

@asmithml

@asmithml asmithml commented Oct 12, 2025

Copy link
Copy Markdown
Member

This PR adds support for single-window ML models and implements comprehensive model validation across the inference pipeline. The changes enable the API to handle both single-window and dual-window (temporal) models with proper validation and user guidance. Closes issues #48 #47 #46

Key Changes

Model Validation & Discovery

  • Added model existence validation with helpful error messages referencing available models
  • Implemented image count validation that ensures requests match model requirements (1 image for single-window, 2 for dual-window)
  • Created new endpoints: GET /v1/models to list all models and GET /v1/models/{model_id} for detailed model information
  • Enhanced request validation with @field_validator and @model_validator decorators

Single-Window Model Support

  • Updated ML pipeline to handle optional win_b parameter for single-window models
  • Modified download_images() and execute_inference_pipeline() to support both single and dual window modes
  • Added conditional polygonization check - models that output GeoJSON directly skip polygonization step
  • Updated inference service to determine window count based on model specifications

Testing & Type Safety

  • Added comprehensive test suite (test_model_validation.py) with 163 new lines covering:
    • Model validation edge cases
    • Single vs dual-window model workflows
    • Model discovery endpoints
  • Created reusable test fixtures for models, bboxes, and image URLs
  • Re-enabled mypy type checking in CI pipeline
  • Fixed all type checking issues and added mypy ignore rule for ftw_tools

Infrastructure Updates

  • Changed dependency to ftw-tools[all]>=2.0.0b2 for complete feature set
  • Fixed boto3 type hints to use types-aiobotocore-s3 instead of mypy-boto3-s3
  • Updated project service to use .remove() instead of .set(None) for clearing progress field

Breaking Changes

None - all changes are backwards compatible with existing dual-window workflows.

Testing

  • All existing tests pass
  • Added 9 new test cases for model validation scenarios
  • CI now runs mypy type checking on all application code

@asmithml asmithml merged commit 590bbb0 into main Oct 12, 2025
1 check passed
@asmithml asmithml deleted the single-window-models branch October 12, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant