# Bird Detection on Power Transmission Lines Based on Improved YOLOv7
## 3 Enhanced YOLO v7 Model
### A New Dynamic Convolutional Kernels of ODConv  
Although the YOLO series has made substantial advancements in speed and accuracy, it does have certain limitations, particularly in detecting small objects:  
Inaccurate Localization of Small Objects: YOLO algorithms use a grid of multiple scales for object detection. However, for small-sized objects, the receptive field of these grid cells is often too large, making it difficult to accurately localize the bounding boxes of small objects. Limited Feature Representation Capability: Small objects typically have fewer pixels, resulting in a less robust feature representation. YOLO algorithms employ pooling layers and convolutions with larger strides, which may result in the loss of finer object details, impacting the capability to detect small objects. Class Imbalance in Training Data: Since larger objects are easier to detect, datasets often contain more samples of larger objects. This causes the algorithm to focus more on large objects during training, resulting in fewer training samples for small objects and impacting the detection performance. Traditional convolutional neural networks utilize static convolutional kernels, while dynamic convolutional methods employ linear combinations of kernel weights to achieve attention-weighted input data. Dynamic convolutional kernels can autonomously adjust their receptive field size based on the content and context of the input image. This facilitates a more favorable equilibrium among features of varying scales, ultimately resulting in enhanced accuracy and resilience in feature extraction. It also allows slight variations in their shapes at each location, making them better suited to handle non-rigid deformations or distortions present in the image. This strengthens the model's ability to remain robust in the face of variations in the positioning of target objects within the image. Unlike traditional convolutional kernels that use the same weights across the entire input, dynamic convolutional kernels generate different weights at each position dynamically. This leads to a notable reduction in the quantity of parameters requiring learning, which, in turn, leads to decreased computational complexity and memory utilization. Dynamic convolutional kernels can adjust their parameters to capture features at diverse scales, offering benefits for a range of computer vision tasks, including object detection and segmentation. Also, dynamic convolutional kernels can flexibly adapt the kernel's channel count, thereby enhancing the model's versatility and expressive capability. This approach significantly improves the accuracy of lightweight convolutional neural networks while maintaining high-speed inference. However, existing dynamic convolutional methods such as CondConv and DyConv focus only on the dynamicity of kernel numbers [22; 23], neglecting the dynamicity of spatial dimensions, input channels, and output channels. The structural diagram of DyConv is shown in Figure 2. From a mathematical perspective, dynamic convolution operations can be formally expressed as Equation (1). Explation: \"*\" stands for addition and \"*\" stands for multiplication  
\[y=(\alpha_{w1}W_{1}+\ldots+\alpha_{wn}W_{n})*x \tag{1}\]In light of this, [PERSON] et al. proposed ODConv [24], a full-dimensional dynamic convolution method based on SE attention. ODConv can be described according to Equation (2). \[y=\left(\alpha_{wi}\odot\alpha_{f1}\odot\alpha_{c1}\odot\alpha_{s1}\odot W_{1}+ \ldots+\alpha_{wn}\odot\alpha_{fn}\odot\alpha_{cn}\odot\alpha_{sn}\odot W_{n} \right)*x \tag{2}\]  
Among them, \(\alpha_{wi}\) represents the attention scalar of convolutional kernel \(W_{i}\), \(\alpha_{si}\in R^{k\times k}\), \(\alpha_{ci}\in R^{c_{in}}\), and \(\alpha_{fi}\in R^{c_{out}}\) represent the three newly introduced attentions along the spatial dimension, input channel dimension, and output channel dimension, respectively. These four attentions are computed using a multi-head attention module denoted as \(\pi_{i}(x)\)[25].