Skip to content

feat(inference): make pipeline analysis-aware with dynamic model loading#8

Merged
Oshgig merged 2 commits into
developfrom
feature/inference-analysis-aware-pipeline
Apr 15, 2026
Merged

feat(inference): make pipeline analysis-aware with dynamic model loading#8
Oshgig merged 2 commits into
developfrom
feature/inference-analysis-aware-pipeline

Conversation

@Oshgig
Copy link
Copy Markdown
Collaborator

@Oshgig Oshgig commented Apr 15, 2026

Summary

Makes the inference pipeline and API endpoints respect the analysis_type parameter, loading the correct model configuration per analysis type.

Changes

  • pipeline.py: _load_model() now reads in_channels and num_classes from config.yaml per analysis type
  • Per-analysis-type model cache prevents model cross-contamination
  • run_inference() returns dynamic class counts instead of hardcoded forest metrics
  • run_inference_from_gee() now downloads real tiles via the GEE downloader and applies SCL cloud masking
  • api/main.py: prediction endpoints pass analysis_type through to the inference pipeline

Impact

  • Fixes the critical gap where analysis_type was accepted by the API but ignored during inference
  • Enables correct predictions for deforestation, ice_melting, and flooding

femi23 added 2 commits April 15, 2026 20:49
- _load_model() now accepts analysis_type and reads in_channels/num_classes from config.yaml
- Per-analysis-type model cache prevents cross-contamination between deforestation/ice/flood models
- _find_best_checkpoint() prefers config.yaml weight path per analysis type
- run_inference() accepts analysis_type, pads/crops to correct n_channels, and returns dynamic class counts
- run_inference_from_file() and run_inference_from_gee() propagate analysis_type parameter
- Pass body.analysis_type to run_inference_from_gee() in /api/predict
- Pass analysis_type to run_inference_from_file() in /api/predict/upload
- Enables the API to load the correct model and return correct class counts per analysis type
@Oshgig Oshgig merged commit 51edfac into develop Apr 15, 2026
@Oshgig Oshgig deleted the feature/inference-analysis-aware-pipeline branch April 15, 2026 19:51
mvanhorn pushed a commit to mvanhorn/ClimateVision that referenced this pull request May 17, 2026
…ing (Climate-Vision#8)

* feat(inference): make pipeline analysis-aware with dynamic model loading

- _load_model() now accepts analysis_type and reads in_channels/num_classes from config.yaml
- Per-analysis-type model cache prevents cross-contamination between deforestation/ice/flood models
- _find_best_checkpoint() prefers config.yaml weight path per analysis type
- run_inference() accepts analysis_type, pads/crops to correct n_channels, and returns dynamic class counts
- run_inference_from_file() and run_inference_from_gee() propagate analysis_type parameter

* feat(api): wire analysis_type into prediction endpoints

- Pass body.analysis_type to run_inference_from_gee() in /api/predict
- Pass analysis_type to run_inference_from_file() in /api/predict/upload
- Enables the API to load the correct model and return correct class counts per analysis type

---------

Co-authored-by: Olufemi Taiwo <Olufemitaiwo23@gmail.com>
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.

2 participants