BSPP: A dual-branch dual-mode spatial pyramid pooling module for industrial defect detection
Abstract Existing spatial pyramid pooling (SPP) modules and their variants generally employ fixed feature aggregation strategies, which are often optimized for specific defect scales or feature characteristics. In practical industrial inspection scenarios, different defect types may require distinct aggregation behaviors, adding complexity to module selection and deployment. To accommodate the distinct feature scales in industrial scenarios, the proposed BSPP module provides two task-specialized instantiations—static and dynamic—within a unified architecture via a simple control switch. The mode is manually selected before training based on the dominant defect scale, serving as a strong inductive bias rather than an online adaptive mechanism. This design allows practitioners to choose the appropriate feature-aggregation behavior for macro- or micro-scale defects without altering the backbone or switching among different SPP variants. The module adopts a dual-branch structure for progressive cross-scale feature fusion, where the static mode focuses on stable contextual aggregation for macro-scale defects, while the dynamic mode introduces lightweight channel refinement for micro-scale subtle defect recognition. As a modular replaceable component, BSPP can be conveniently integrated into existing object detection frameworks. This unification eliminates the need for structural re-design when migrating across inspection tasks. Experiments on two representative industrial defect datasets (steel macro-defect NEU-DET and PCB micro-defect PKU-Market-PCB) demonstrate stable performance gains when replacing mainstream SPP variants in YOLO-series lightweight detectors. The proposed module strikes a practical balance between detection accuracy and lightweight deployment in industrial inspection.