# Camera-Adaptive Foreign Object Detection for Coal Conveyor Belts
## 3 Methodology
### Context Feature Perception  
In coal mine environments, significant differences in conveyor belt backgrounds across various camera perspectives, along with noise factors such as light, dust, or water vapor, make it challenging to distinguish between foreground objects (foreign objects on the conveyor belt) and background objects (foreign objects outside the conveyor belt). As a result, models tend to misclassify background elements as foreign objects, leading to obvious false detection.  
To address this issue, we propose the Context Feature Perception (CFP) module, as shown in Figure 4. The key insight is that foreign objects on the conveyor belt should be surrounded by coal. This stable context feature allows the model to differentiate between relevant foreign objects on the belt and irrelevant objects in the background. By integrating coal features surrounding potential foreign objects into the detection process, the model can better capture contextual cues, thereby improving its ability to distinguish targets on the conveyor belt from background noise. To implement CFP, we first enlarge the predicted target bounding box by a factor of 1.2, then, subtract the original bounding box area to obtain a surrounding context region. This context region mask is applied to the encoder's output feature map to extract coal-related background features. Finally, we fuse these context features with the target features, yielding a context-aware representation that highlights foreign objects on the conveyor belt while suppressing irrelevant backgrounds. The detailed process is described as follows.  
First, the decoder outputs a target feature map \(F_{target}\) with the bounding box \(Box_{target}=(x_{c},y_{c},w,h)\), where \(x_{c}\) and \(y_{c}\) represent the coordinates of the center of the bounding box, \(w\) denotes the width and \(h\) denotes the height of the bounding box. To capture contextual information, the bounding box is enlarged by a _scale_ (set to 1.2) to produce an expanded bounding box \(Box_{expand}\) with \(w^{expand}\) and \(h^{expand}\), by Equation (5).  
\[\begin{split} w^{expand}&=w\cdot scale,\\ h^{expand}&=h\cdot scale,\\ Box_{target}^{expand}&=(x_{c},y_{c},w^{expand},h^{ expand}).\end{split} \tag{5}\]  
Figure 4: Context feature perception module. Integrates potential foreign object features with surrounding coal features to enhance the model’s ability to distinguish between foreground objects (foreign objects on the conveyor belt) and background objects (foreign objects outside the conveyor belt). The Encoder and Decoder are defined in Deformable DETR.  
Then, based on \(Box_{target}\) and \(Box_{target}^{expand}\), we can create two masks, \(M_{target}\) and \(M_{expand}\), to cover the two bounding box. By subtracting these two masks, as shown in Equation (6), a surrounding mas,k \(M_{context}\), can be obtained, representing the area between \(Box_{target}\) and \(Box_{target}^{expand}\).  
\[M_{context}=M_{expand}-M_{target} \tag{6}\]  
\[F_{context}=Pooling(Z_{final}\odot M_{context}) \tag{7}\]  
Next, the mask \(M_{context}\) is applied element-wise to the feature map \(Z_{final}\), extracting context features \(F_{context}\) around potential foreign objects to provide valuable context for the object classifier.  
\[F_{integrate}=F_{target}+F_{context} \tag{8}\]  
Finally, we integrate these context features \(F_{context}\) with the target features \(F_{target}\) as shown in Equation (8). The potential target features \(F_{integrate}\), enriched with contextual information, are fed into the classifier for the categorization task. By associating foreign object targets with the coal characteristics in their surroundings, the method enhances the context feature correlation for foreign object detection on the conveyor belt and aids in eliminating false detection of foreign objects outside the conveyor belt.