How manoj-dj/visiontransformerpestdetection_aws_cloud_project_2026 works
This repository combines a working local pest-image classification service and browser UI with a documented AWS target architecture. The implemented user workflow is image selection and upload, validation and preprocessing, ViT classification, optional Grad-CAM generation, and display of results. The README also describes dataset preparation, model training, cloud deployment, authentication, storage, monitoring, and alerts; those are represented as documented architecture, not as inspected implementations. AWS relationships are based on README statements, while source excerpts establish the local API flow.
Main entry points: main.py FastAPI routes · README.md Lambda request orchestration · model_loader.py Model and class loading · app.js Image upload UI
Components 22
Client experience
- Image upload UI
src/frontend/js/app.js
Inference service
- FastAPI routes
src/backend/app/main.py - API response schemas
src/backend/app/schemas.py - Request logging
src/backend/app/logging_config.py - Runtime settings
src/backend/app/config.py - Image validation and preprocessing
src/backend/app/image_utils.py
Model lifecycle
- ViT classification
src/backend/app/inference.py - Model and class loading
src/backend/app/model_loader.py - Grad-CAM explanation
src/backend/app/explainability.py - Model and class assets
src/ai_model - IP102 and field data
dataset - Dataset preprocessing
dataset/preprocessing_scripts/pytorch-vit-insect-classifier (3).ipynb
AWS target platform
- S3 image and artifacts store
src/aws/README.md - SageMaker training and hosting
src/aws/README.md - API Gateway
src/aws/README.md - Lambda request orchestration
src/aws/README.md - Cognito identity
src/aws/README.md - DynamoDB or RDS metadata
src/aws/README.md - CloudWatch monitoring
src/aws/README.md - SNS notifications
src/aws/README.md - Optional IoT ingestion
src/aws/README.md
Other components
- Farmer or agronomist
Connections 27
- Farmer or agronomist → Image upload UI: selects image
src/frontend/js/app.js - Image upload UI → FastAPI routes: posts image
src/frontend/js/app.js - FastAPI routes → Image validation and preprocessing: validates and preprocesses
src/backend/app/main.py - FastAPI routes → ViT classification: classifies tensor
src/backend/app/main.py - FastAPI routes → Grad-CAM explanation: requests explanation
src/backend/app/main.py - FastAPI routes → Model and class loading: loads at startup
src/backend/app/main.py - FastAPI routes → API response schemas: shapes responses
src/backend/app/main.py - FastAPI routes → Request logging: configures logging
src/backend/app/main.py - ViT classification → Model and class loading: uses model bundle
src/backend/app/inference.py - Grad-CAM explanation → Model and class loading: uses model and lock
src/backend/app/explainability.py - Image validation and preprocessing → Runtime settings: reads preprocessing settings
src/backend/app/image_utils.py - Model and class loading → Runtime settings: reads model settings
src/backend/app/model_loader.py - ViT classification → Runtime settings: reads top-k setting
src/backend/app/inference.py - IP102 and field data → Dataset preprocessing: prepared for modeling
README.md - IP102 and field data → SageMaker training and hosting: training input
README.md - S3 image and artifacts store → SageMaker training and hosting: provides data and artifacts
README.md - API Gateway → Lambda request orchestration: routes requests
README.md - Lambda request orchestration → SageMaker training and hosting: invokes hosted endpoint
README.md - Image upload UI → API Gateway: cloud client endpoint
README.md - Farmer or agronomist → Cognito identity: authenticates
README.md - Lambda request orchestration → S3 image and artifacts store: stores uploaded images
README.md - Lambda request orchestration → DynamoDB or RDS metadata: persists prediction metadata
README.md - Lambda request orchestration → CloudWatch monitoring: emits logs and metrics
README.md - CloudWatch monitoring → SNS notifications: triggers risk alerts
README.md - Optional IoT ingestion → S3 image and artifacts store: ingests canopy imagery
README.md - SageMaker training and hosting → S3 image and artifacts store: registers model artifacts
README.md - Model and class loading → Model and class assets: loads checkpoint and labels
src/backend/app/model_loader.py