Christian Minich
Back to Projects

AI Trailer Identification

Design, implementation and evaluation of multiple machine learning models for automated truck trailer identification using barcode detection on an NVIDIA Jetson edge platform, developed as part of the TIDA5G project at Krone Business Center GmbH.

Tech Stack

pythonpytorchyolov8faster-rcnnnvidia-jetsontensorrtonnxcomputer-visionobject-detectionedge-ai

AI-Based Trailer Identification

A machine learning system for automated truck trailer identification through barcode and sticker detection, designed for real-time edge inference on NVIDIA Jetson hardware. Developed as a Bachelor's thesis project within the TIDA5G initiative at Krone Business Center GmbH.

Problem Statement

During storage operations at Krone Business Center GmbH, trailers are occasionally lost or their positions are incorrectly entered into the existing software by Terberg drivers. These discrepancies lead to time-consuming search processes, delays, and increased operating costs. Manual inventory of trailers on storage yards is error-prone, costly, and disrupts the logistics chain.

The goal was to develop an automated, AI-powered solution that identifies trailers via their barcodes and stickers, even under varying lighting conditions, angles, and weather, and deploys directly on edge hardware mounted on yard vehicles.

System Architecture

Camera (Terberg / Drone)
        β”‚
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   NVIDIA Jetson Orin Nano   β”‚
β”‚         (8GB)               β”‚
β”‚                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   TensorRT Engine     β”‚  β”‚
β”‚  β”‚   (Optimized Model)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚              β”‚              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Object Detection    β”‚  β”‚
β”‚  β”‚   Trailer + Barcode   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚              β”‚              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Barcode Sequence    β”‚  β”‚
β”‚  β”‚   Extraction          β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
  Inventory System

Model Selection & Comparison

Three major object detection architectures were evaluated for suitability:

CriterionYOLOFaster R-CNNSSD
Speed⭐⭐⭐ Fastest⭐ Slowest⭐⭐ Medium
Accuracy⭐⭐ Good⭐⭐⭐ Best⭐⭐ Good
Small Objects⭐ Weak⭐⭐⭐ Best⭐ Weak
Real-time Capability⭐⭐⭐ Excellent⭐ Limited⭐⭐ Good
Edge Deployment⭐⭐⭐ Ideal⭐⭐ Possible⭐⭐ Good

YOLO was selected as the primary architecture due to its real-time processing capability, critical for the Krone use case where trailers must be identified quickly without disrupting yard operations. Faster R-CNN was implemented as a secondary model for comparison.

Implementation

Three Model Approaches

  1. Custom YOLOv8 (from scratch): Full implementation of the YOLOv8 architecture in PyTorch, including backbone (CSPDarknet-inspired), neck (PANet), head, and custom loss functions (CIoU + Distribution Focal Loss). This approach encountered challenges with tensor shape alignment and loss function implementation.

  2. YOLOv8 Ultralytics: Using the Ultralytics library with pretrained weights and fine-tuning on custom datasets. This was the most successful approach, achieving >90% mAP.

  3. Faster R-CNN (ResNet-50 + FPN): Using torchvision's pretrained Faster R-CNN with a custom classification head, fine-tuned on trailer and sticker datasets.

Custom YOLOv8 Architecture

The from-scratch implementation included these key components:

Input Image (416Γ—416)
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      YOLOv8 Backbone        β”‚
β”‚  Conv β†’ Conv β†’ Conv β†’ Conv  β”‚
β”‚  (3β†’64β†’128β†’256β†’512β†’1024)    β”‚
β”‚           β”‚                 β”‚
β”‚      SPPF Layer             β”‚
β”‚  (Multi-scale pooling)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       YOLOv8 Head           β”‚
β”‚  Upsample + C2f blocks     β”‚
β”‚  Multi-scale detection      β”‚
β”‚  (P3, P4, P5)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
  [bbox, objectness, class]
  per grid cell at 3 scales

Key architectural components:

  • Conv: 2D Convolution + BatchNorm + SiLU activation
  • Bottleneck: 1Γ—1 reduction β†’ 3Γ—3 expansion with residual connections
  • C2f: Cross-Stage Partial blocks with multiple Bottleneck layers
  • SPPF: Spatial Pyramid Pooling Fast for multi-scale feature extraction

Loss Function Evolution

The initial MSE + BCE loss function suffered from underfitting. It was replaced with:

  • CIoU Loss: Complete Intersection over Union, accounting for centroid distance and aspect ratio
  • Distribution Focal Loss (DFL): Focusing on hard-to-classify examples with a Ξ³ parameter

Datasets

Six dataset configurations were tested:

  • Trailer dataset: Trailer images only
  • Sticker dataset: Sticker/barcode images only
  • Combined dataset: Both merged
  • Combined (no trailer subclasses): Removed Trailer_2, Trailer_3, Trailer_4
  • Combined (no stickers): Removed sticker images
  • Trailer (Trailer_1 + stickers only): Simplified classes

NVIDIA Jetson Platform

Hardware Journey

The project went through several hardware iterations:

  1. Jetson Nano 2GB: Hit End-of-Life status, boot failures after dependency installation, abandoned
  2. Jetson AGX Orin: Initial development platform, pre-installed OS
  3. Jetson Orin Nano 8GB: Final deployment target, reflashed with JetPack 6.x

Model Deployment Pipeline

PyTorch (.pth) β†’ ONNX (.onnx) β†’ TensorRT (.trt)

The conversion pipeline enables significant inference speedups on NVIDIA GPUs:

  1. PyTorch β†’ ONNX: Export with torch.onnx.export(), opset version 11
  2. ONNX β†’ TensorRT: Parse and build optimized CUDA engine
  3. Inference: Real-time camera feed processing with PyCUDA memory management

Results

ModelSizePrecisionRecallmAP50mAP50-95
YOLOv8 Combined (no stickers), mMedium0.9890.9340.9710.944
YOLOv8 Combined, sSmall0.9870.9300.9670.938
YOLOv8 Combined (no trailer classes), nNano0.9840.9050.9530.915
YOLOv8 Trailer_1 + Stickers, nNano0.9370.8290.9170.732
Faster R-CNN (Sticker)N/ALoss: 0.1968, Inference: 0.031s/iter
Faster R-CNN (Trailer)N/ALoss: 0.2267, Inference: 0.042s/iter

The YOLOv8 medium model trained on the combined dataset without sticker images achieved the best overall performance with 98.9% precision and 97.1% mAP50.

Key Challenges & Learnings

  • Tensor shape alignment in custom YOLOv8, getting all model components to produce compatible tensor dimensions was the most difficult technical challenge
  • Loss function implementation: transitioning from MSE/BCE to CIoU + DFL required careful mathematical implementation
  • Jetson platform setup: multiple hardware iterations, boot failures, dependency conflicts, and JetPack version incompatibilities
  • Custom vs. library trade-off: the from-scratch YOLOv8 implementation provided deep architectural understanding but the Ultralytics library delivered production-ready results

Context

This project was developed as a Bachelor's thesis at the University of Applied Sciences OsnabrΓΌck (Campus Lingen), Institute for Management and Technology, in collaboration with Krone Business Center GmbH as part of the TIDA5G research initiative for automated yard inventory management.