AircraftOps
Search
Posts

Aircraft Type Image Vetting Worker

Architecture → Serverless Functions

The ICAO Image Vetting service is an automated serverless image-processing pipeline responsible for validating, cropping, scoring, and persisting aircraft imagery. The system is designed to run as an event-driven AWS Lambda worker triggered via SQS, performing computer-vision inference using an ONNX YOLOv8 model and storing processed assets in S3 while recording metadata in DynamoDB.


High-Level Flow
  1. SQS event triggers Lambda handler
  2. Image downloaded and hashed
  3. Duplicate hash checked in DynamoDB
  4. Aircraft detected using YOLOv8 ONNX model
  5. Image cropped, resized, and composition-scored
  6. Approved images stored in S3 (multi-size variants)
  7. Metadata persisted to DynamoDB
app.py — Lambda Entry

The Lambda handler processes SQS records, parses message payloads, and invokes the pipeline orchestrator.

  • Parses SQS message JSON payload
  • Calls process_record()
  • Logs approval / rejection outcomes
  • Rejects malformed events safely
pipeline.py — Orchestration Layer

Core workflow controller responsible for coordinating all processing stages.

  • Downloads source image
  • Performs duplicate hash validation
  • Executes detection and cropping pipeline
  • Uploads processed image variants to S3
  • Writes resulting metadata to DynamoDB
detector.py — Aircraft Detection

Runs YOLOv8 inference using ONNX Runtime to detect aircraft bounding boxes.

  • Loads ONNX model via CPUExecutionProvider
  • Preprocesses image into model input tensor
  • Filters predictions using configurable confidence threshold
  • Returns best aircraft detection candidate
scoring.py — Composition Scoring

Calculates composition quality metrics to determine whether an image meets publishing standards.

  • Evaluates aircraft area ratio vs. image
  • Measures center offset alignment
  • Generates composition score for approval logic
storage.py — S3 Asset Handling
  • Uploads processed images to S3
  • Handles multipart chunked uploads
  • Supports JSON retrieval utilities
  • Manages bucket routing via environment configuration
ddb.py — DynamoDB Persistence
  • Serializes Python objects to DynamoDB AttributeValues
  • Stores processed image metadata
  • Supports duplicate image hash detection
  • Ensures normalized storage formats
Configuration Layer

System behavior is configured through environment variables and centralized config definitions.

  • DynamoDB table name and S3 bucket configuration
  • Minimum crop size thresholds
  • Image size variant definitions (Full, Medium, Thumbnail)
  • YOLO model path and detection thresholds
Design Characteristics:
  • Fully event-driven serverless architecture
  • Stateless Lambda processing nodes
  • Deterministic image normalization pipeline
  • Automated duplicate detection via hashing
  • Computer-vision-driven quality enforcement