Skip to main content
Back

MSD-DETR Beats YOLOv8 Spotting Train Defects at 98 FPS

A new transformer detector for locomotive coil spring inspection hits 92.4% mAP at 98 FPS, beating YOLOv8, DINO, and RT-DETR on the same data.

Pro

  • MSD-DETR extends RT-DETR for locomotive coil spring defect detection, hitting 92.4% mAP@0.5 at 98 FPS.
  • Combines RepVGG-style re-parameterization, multi-scale deformable attention, and bidirectional feature fusion with GSConv modules.
  • Beats YOLOv8-L by 4.2 mAP and DINO by 3.5 mAP on the same industrial dataset.
  • Small-object AP improves 3.8 points over RT-DETR, addressing DETR's classic weakness on tiny defects.
  • Trained on 5,000 images with 12,847 annotated defects across five categories including cracks and decarburization.
  • Zero-shot transfer to NEU-DET steel dataset reaches 68.3 mAP, no code released.

Inspecting the coil springs that sit under locomotive suspensions is one of those unglamorous computer vision problems that quietly matters. Miss a hairline crack and you get derailments; over-inspect and you clog production lines with false alarms. A new paper introduces MSD-DETR, a Multi-Scale Deformable Detection Transformer purpose-built for this task, and it posts 92.4% mAP@0.5 at 98 FPS on a custom industrial dataset, meaningfully ahead of YOLOv8, DINO, and the RT-DETR baseline it extends.

Why coil springs break vision models

Locomotive coil springs live under continuous cyclic stress, moisture, temperature swings, and chemical contaminants. That mix produces a nasty catalogue of defects: fatigue cracks that branch unpredictably, decarburization zones with diffuse boundaries and low contrast, pitting, corrosion patches, and shallow scratches. On top of that, the helical geometry throws specular reflections and self-occlusion at the camera.

For a detector this means three problems at once:

  • Huge scale variance: defects range from a few pixels to regions covering large parts of the frame.
  • Irregular morphology: cracks are thin and branching, corrosion is blobby, decarburization is barely visible.
  • Real-time constraint: inspection lines can't wait on 20 FPS models.

Off-the-shelf detectors handle one or two of these but not all three. Vanilla DETR converges slowly and struggles on small objects. YOLO variants are fast but leave accuracy on the table for low-contrast defects. That gap is what MSD-DETR targets.

Three ideas glued onto RT-DETR

The architecture builds on RT-DETR, the first transformer detector to genuinely match YOLO on speed, and adds three modules working in concert.

MSD-DETR architecture diagram showing offset calculation, multi-head deformable attention, and convolutional fusion layers

1. Structural re-parameterization in the backbone. Following the RepVGG playbook, each convolutional block in the ResNet-50 backbone runs three parallel branches during training: a 3x3 conv, a 1x1 conv, and an identity skip. At inference time, the 1x1 kernel is zero-padded to 3x3, the identity is expressed as a centered unit kernel, batch norm parameters are folded into the weights, and everything collapses to a single 3x3 convolution. The math is exact, not an approximation. You get the training-time regularization and gradient flow benefits of a multi-branch network with the deployment cost of a plain conv net.

2. Multi-scale deformable attention. Standard self-attention is O(N²) in spatial positions, which becomes prohibitive at the high resolutions needed to catch small defects. Deformable attention instead learns a small set of sampling offsets per query, roughly K=4 points per attention head, and only attends to those. Complexity drops to O(NK). Because the offsets are predicted from the query itself, the model dynamically shifts its focus onto defect-relevant pixels rather than treating the whole feature map uniformly. The multi-scale variant extends this across four feature levels so a single query can gather evidence from fine and coarse maps simultaneously.

3. Bidirectional cross-scale fusion with GSConv. The neck combines a top-down semantic enrichment pathway with a bottom-up detail enhancement pathway. Both use GSConv blocks, which mix a 1x1 projection with a 3x3 depthwise convolution and channel shuffling to keep parameters low while preserving representational capacity. These feed into VoVGSCSP modules that stack GSConv operations with dense skip concatenations.

The numbers

The authors built a custom dataset from railway maintenance depots: 5,000 annotated images, 12,847 defect instances across five categories (surface cracks, corrosion, decarburization, scratches, pitting), split 70/15/15. Training runs 300 epochs on a single RTX 3090 with AdamW and standard augmentation including mosaic.

Against a broad slate of baselines, MSD-DETR leads on every accuracy metric while staying comfortably real-time:

MethodmAP@0.5mAP@0.5:0.95AP smallParams (M)FPS
Faster R-CNN82.354.141.241.518
YOLOv8-L88.260.147.543.778
DINO88.961.248.247.021
RT-DETR-L89.161.548.532.0114
MSD-DETR92.465.852.334.298

The stricter mAP@0.5:0.95 gain of 4.3 points over RT-DETR is more telling than the headline number, because it measures how tightly the boxes actually wrap the defect. Small-object AP jumps by 3.8 points too, which is exactly where DETR-style models historically underperform CNN detectors.

Ablations confirm the three modules are complementary rather than redundant. Deformable attention alone adds 1.7 mAP, cross-scale fusion adds 1.4, and re-parameterization adds 1.2, but the full stack adds 3.3 - more than any pair. The 14% FPS drop from the RT-DETR baseline is a fair trade for the accuracy gain.

Where it holds up and where it doesn't

Per-category results show the biggest wins on the hardest defect types: surface cracks (+4.6 AP) and decarburization (+4.3 AP), both known for low contrast and irregular boundaries. Pitting only gains 1.2 because the baseline was already near ceiling. In a zero-shot transfer test on the public NEU-DET steel surface defect dataset (no fine-tuning), MSD-DETR still leads at 68.3 mAP@0.5 versus 65.8 for RT-DETR-L, suggesting the learned features generalize beyond springs.

The authors are candid about the limits:

  • 5,000 images is small by modern detection standards, and the dataset is not public.
  • The model detects and classifies, but does not quantify severity (crack length, corrosion area) - a gap for real condition-based maintenance workflows.
  • It's 2D only. Defects tucked into the helical geometry can be missed without multi-view or 3D sensing.
  • Edge deployment on embedded hardware would need quantization or distillation. Real-time at 98 FPS assumes an RTX 3090.
  • No public code or model weights are released with the paper.

The real contribution here is less any single component - deformable attention and RepVGG-style re-parameterization are both well-known - and more the demonstration that a carefully assembled DETR variant can genuinely outrun optimized YOLO pipelines on a gnarly industrial dataset without giving up real-time inference. For anyone working on defect detection in manufacturing, this is a useful blueprint even without a public checkpoint to fine-tune.