arXiv:2608.30709cs.CVAug 2026

Manuscript Offprint

arXiv:2608.30709

RailSyn: Diagnosis-Guided Image Generation for Traceable Data Completion in Railway Foreign Object Detection

Quan Hao, Chenxi Zhang, Ziyang Tao, Yuyuan Zhou, Yudong Wang, Rui Shi, Lechuan Xu, Changhao Liu, Liguo Zhang

Abstract

Railway foreign object detection (RFOD) is critical to safe railway operation, yet scarce real positive samples incompletely represent task-relevant variations in object scale, intrusion relation, railway scene, illumination, and adverse weather. Existing synthetic augmentation can improve RFOD detection, but its gains lack an explicit account of the task-relevant deficiencies complemented by the generated data. We therefore introduce RailSyn, a diagnosis-guided framework comprising a real-referenced Inspector and a requirement-aligned Generator. The Inspector constructs a variable-radius empirical cover from finite real observations to localize candidate completion regions and profile synthetic pools. The resulting audit identifies railway-context, intrusion-semantic, and visual-consistency requirements; the Generator addresses them through domain adaptation, agent-planned placement and physical contact relations, and plan-consistent conditional refinement. Using the Inspector, we further trace representation-space changes across generation variants; the complete system attains a local-shell occupation of CgapC_{gap} to 13.64%, which measures generated coverage of real-derived completion regions. Extensive experiments show AP50–95 gains of up to 4.9 points and consistent improvements across nine mainstream detectors, demonstrating broad cross-architecture utility.

Introduction

Railway foreign object detection (RFOD) is critical to the safe operation of high-speed rail systems (Hao et al. 2026; Chen et al. 2024). Reliable detection requires examples that jointly represent railway structures, environmental conditions, object scales, and the physical relations by which foreign objects intrude into operational space (Hao et al. 2026; Chen et al. 2024, 2025; Oza et al. 2024). Such positive samples are scarce and costly to annotate, while small targets further concentrate task evidence in limited image regions (Hao et al. 2026; Chen et al. 2024; Cheng et al. 2023; Shi et al. 2025). Consequently, finite RFOD datasets incompletely capture not only visual appearance, but also the context, intrusion semantics, and local object-background effects that determine whether synthetic samples are useful for detection.

Existing augmentation and generation methods produce additional training samples (Hao et al. 2026; Feng et al. 2024; Wang et al. 2024). Conventional operations are confined to observed objects and contexts (Ghiasi et al. 2021; Trabucco et al. 2024), whereas advanced approaches such as SVDDD, RegionDiffusion, and broader grounded generation frameworks prioritize realism, diversity, or controllability (Wang, Pan, and Wen 2025; Li, Luo, and Tseng 2025; Li et al. 2023). However, none of these objectives explicitly identify which task-relevant regions remain weakly complemented relative to real RFOD observations; consequently, method selection is decoupled from a concrete completion demand. As a result, generated pools may repeat existing patterns, misalign object–scene intrusion semantics, or exhibit anomalous injection effects (Somepalli et al. 2023; Wu et al. 2024; Song et al. 2024). Their detection gains are likewise difficult to attribute: global similarity metrics are dominated by railway backgrounds, while AP provides a standardized measure of overall detector performance but still falls short of characterizing the contextual, relational, or localized contributions introduced by generated data (Jayasumana et al. 2024; Ghosh, Hajishirzi, and Schmidt 2023; Hu et al. 2023; Lee et al. 2023; Bolya et al. 2020). The outstanding gap, therefore, is a unified framework that diagnoses deficient information prior to synthesis, translates that evidence into explicit generation requirements, and evaluates whether the resulting pool effectively complements the specified regions.

We address this gap with RailSyn, an Inspector–Generator framework in which inspection explicitly guides generation. The Inspector builds a variable-radius empirical cover from our collected high-quality real RFOD reference and evaluates synthetic pools using reliable-support coverage ( CrelC_{rel}), local-gap completion ( CgapC_{gap}), and nonredundant volume efficiency ( ηvol\eta_{vol}). It applies the real-derived local-shell criterion underlying CgapC_{gap} to the SD-based(Rombach et al. 2022) RFOD23 AIGC pool and retrieves representative samples from the high-uncertainty regions induced by the finite real reference, followed by inspection of nearby RFOD23 sam-

Copyright © 2027, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.

(a) RailSyn Inspector

Task-Relevant Information Deficiency

(b) RailSyn Generator

Background / Scene-level

Figure

Disordered Backgrounds

Object / Attribute-level

Figure

Occupy Implausible Positions

Intrusion / Relationship-level

Figure

Abnormally Contours

① Background Domain Adaptation

Figure

Railway Scenario

Foreign Object

Scenario LoRA

Scene

Prompt

A

B

Railway Style Prior

Railway Scenario

Sample

Object

Prompt

FO LoRA

A

B

Foreign Object

Appearance Prior

Foreign Object

Sample

② Semantic Layout Planning

Object Set (Categories, Attributes)

"A piece of plastic film on the left rail, partially occluded by fastener ..."

Layout Prompt

LLM Planner

Figure

Structured Layout

③ Structural Constraint & Object Injection

Background

Objects

Zero

Conv

Zero

Conv

Zero

Conv

Zero

Conv

Fusion

Scale a

U-Net

Constrained

Composition

Data Completion Feature Space

Figure

Real-world Dataset

RailSyn Dataset

RailSyn Weather Dataset

Figure 1: RailSyn overview. (a) Inspector identifies high-uncertainty regions from the finite real reference and inspects nearby SD-based RFOD23 AIGC samples, revealing three recurring patterns. (b) Generator addresses them through railway scene preparation, relation-aware intrusion planning, and intrusion-pattern refinement. Right: generated samples and feature-space completion ( CgapC_{gap}).

ples. As shown on the left of Figure 1, these samples reveal gaps in railway-background fidelity, object–scene intrusion semantics, and anomalous edge effects around injected objects. Guided by this diagnosis, the Generator aligns one process with each gap: railway-domain low-rank adaptation prepares structural backgrounds (Hu et al. 2022); a multimodal Agent produces executable background-conditioned placement and physical-contact plans; and plan-consistent conditional refinement translates spatial and relation metadata into a unified control condition with mask-aware composition. RailSyn thus turns Inspector-localized deficiencies into explicit generation requirements for complementing the diagnosed regions and improving detection.

RailSyn data improve AP50–95 across all nine tested mainstream detectors, with an average best observed gain of 3.03 points and a maximum gain of 4.9 points. We further evaluate matched Generator ablations with DEIM and YOLO11, and reapply the Inspector to every ablated pool to trace representation-space changes. The complete Generator attains Cgap=13.64%C_{gap} = 13.64\%, and the Inspector diagnostics exhibit trends broadly consistent with the AP changes in the ablation study. This descriptive alignment links detector gains with greater occupation of the real-derived completion regions without treating CgapC_{gap} as an AP predictor. External-pool experiments further distinguish empirical completion from downstream utilization.

Our main contributions are:

• We introduce RailSyn, an Inspector–Generator framework that connects real-referenced deficiency analysis, guided synthesis, and representation-space assessment for traceable RFOD data completion.

• We develop a diagnosis-guided Generator that aligns railway-domain adaptation, Agent-planned intrusion semantics, and plan-consistent conditional refinement with the context, relation, and boundary gaps exposed by the Inspector.

• We demonstrate cross-architecture utility across nine heterogeneous detectors and conduct controlled DEIM/YOLO11 ablations with Inspector profiles to trace component-level effects on detection performance and local-gap completion.

References (43)