Turqoa Docs

Damage Detection

Turqoa's damage detection system uses deep learning models to automatically identify and classify structural damage on shipping containers as they pass through the gate. The system captures images from multiple angles and produces a damage assessment that feeds directly into the decision engine.

14 Damage Categories

The damage detection model classifies damage into 14 standardized categories aligned with IICL (Institute of International Container Lessors) guidelines:

#CategoryDescriptionSeverity
1HolePuncture or perforation in panelHigh
2TearRipped or torn metalHigh
3CrackStructural fracture in frame or panelHigh
4Major dentDeformation > 25mm depthHigh
5Minor dentDeformation < 25mm depthMedium
6CorrosionRust or oxidation on surfaceMedium
7Bent frameStructural member misalignmentHigh
8Door damageHinge, locking rod, or gasket failureHigh
9Floor damageVisible floor deterioration or breachHigh
10Roof damageTop panel deformation or punctureMedium
11Missing partAbsent component (corner casting, etc.)High
12Loose partDetached but present componentMedium
13Paint damageSurface coating failure, scrapingLow
14GraffitiUnauthorized markingsLow

Note: Severity levels are defaults. You can reclassify severity per category in your site configuration to match your terminal's policies.

Model Architecture

The damage detection system uses a two-stage architecture:

  1. Region Proposal Network (RPN) — Identifies candidate damage regions across the container surface
  2. Classification Network — Categorizes each proposed region into one of the 14 damage types and assigns a confidence score

Both stages run on a single GPU inference call, processing a full set of container images (4-6 views) in under 800 milliseconds.

Model Specifications

PropertyValue
Base architectureEfficientDet-D4 with custom head
Input resolution1280 x 960 per image
OutputBounding boxes + category + confidence
Inference time120-180 ms per image
GPU memory2.4 GB
Training data2.8M annotated container images
Minimum damage size50 x 50 pixels in source image

Confidence Calibration

Damage detection confidence scores require careful calibration because the cost of false positives (unnecessary manual review) and false negatives (missed damage) varies by terminal:

# ~/.turqoa/sites/my-terminal/damage.yaml
damage:
  confidence:
    detection_threshold: 0.60    # Minimum confidence to report a damage instance
    severity_override:
      high: 0.50                 # Lower threshold for high-severity categories
      medium: 0.65
      low: 0.75                  # Higher threshold — don't flag minor cosmetic damage

  aggregation:
    method: max_severity         # Decision based on worst detected damage
    # Options: max_severity, weighted_sum, count_based

Calibration Workflow

  1. Deploy in shadow mode and collect damage assessments for 7+ days
  2. Have trained inspectors manually verify a sample of transactions
  3. Run the calibration analysis:
turqoa damage calibrate --site "my-terminal" --period 7d --sample-size 500

This produces a precision-recall curve for each category and recommends optimal thresholds.

Integration with Decision Engine

Damage detection results feed into the decision engine as structured data:

{
  "damage": {
    "detected": true,
    "count": 2,
    "max_severity": "high",
    "instances": [
      {
        "category": "major_dent",
        "severity": "high",
        "confidence": 0.87,
        "location": "left_panel",
        "bbox": [120, 340, 280, 490],
        "image_ref": "img/txn_abc123/left.jpg"
      },
      {
        "category": "corrosion",
        "severity": "medium",
        "confidence": 0.72,
        "location": "front_panel",
        "bbox": [45, 100, 190, 210],
        "image_ref": "img/txn_abc123/front.jpg"
      }
    ]
  }
}

Decision rules can reference any damage field:

rules:
  - name: deny_severe_damage
    priority: 10
    when:
      any:
        - field: damage.max_severity
          op: eq
          value: high
        - field: damage.count
          op: gte
          value: 5
    then:
      decision: review
      reason: "Significant structural damage detected"
      flags:
        - damage_review_required

  - name: accept_minor_cosmetic
    priority: 200
    when:
      all:
        - field: damage.max_severity
          op: eq
          value: low
        - field: damage.count
          op: lte
          value: 2
    then:
      decision: approve
      auto: true
      notes: "Minor cosmetic damage only — within tolerance"

Custom Training

For terminals with unique container types or environmental conditions, Turqoa supports custom model fine-tuning:

Preparing Training Data

Export annotated images from your existing transactions:

turqoa damage export-training \
  --site "my-terminal" \
  --period 90d \
  --min-operator-reviews 100 \
  --output ./training-data/

The export includes:

  • Source images with bounding box annotations
  • Operator-verified labels (from manual review corrections)
  • Metadata (camera, lighting conditions, container type)

Running Fine-Tuning

turqoa damage train \
  --base-model turqoa-damage-v3 \
  --training-data ./training-data/ \
  --validation-split 0.2 \
  --epochs 50 \
  --output ./models/damage-custom-v1

Deploying Custom Models

damage:
  model: ./models/damage-custom-v1   # Path to custom model
  fallback_model: turqoa-damage-v3   # Fallback to base model on error

Warning: Custom models should be validated against a held-out test set before production deployment. Use turqoa damage evaluate --model ./models/damage-custom-v1 --test-data ./test-set/ to measure performance.