# Fertility Detection of Hitching Eggs Based on a Convolutional Neural Network
## 2 Methods
### Two-Dimensional CNN Design  
The collected heartbeat signal most contains noises, thus we decided to try to transform the heartbeat signal sequence to a gray waveform image, using the advantage of convolutional neural network in image feature extraction to extract effective features for classification. We propose a convolutional neural network named SR-CNN, which combines SE block and a residual learning unit used for solving the problem that E-CNN has difficulties in extracting the valid features of noisy original heartbeat signals. The channel weighting module SE block measures the dependence between channels by recalibrating the channels of the convolution layer output feature map, making the effective features concerned and the invalid features ignored, so as to make full and effective use of the features contained in waveform image of heartbeat signal. The \"shortcut connection\" approach used in residual learning unit is not only helpful to solve the performance degradation problem in the deep network but also helps to increase the training speed of the model and improve the effect of network \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Model** & \multicolumn{6}{c}{**Related Parameters**} \\ \hline \multirow{3}{*}{E-CNN} & Conv1 & MaxPool1 & Conv2 & Conv3 & MaxPool2 & Conv4 & Conv5 & Dense \\ \cline{2-8}  & \(1\times 20\), & \(1\times 5\) & \(1\times 20\), & \(1\times 20\), & \(1\times 5\) & \(1\times 20\), & \(1\times 20\), & \(2\)d \\  & 64 & \(1\times 5\) & \(64\) & \(128\) & \(1\times 5\) & \(128\) & \(256\) & \(2\)d \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The parameter of model E-CNN. Figure 7: The architecture of convolution neural network E-CNN. training. The core for the SR-CNN is a module that we term \"SE-Res\" (Figure 8a,b), which combines SE block and the residual module for better classification performance improvement. SR-CNN mainly consists of one convolution layer, four SE-Res modules, two pooling layers and one fully-connected layer. Before each convolutional layer, we applied Batch Normalization and a rectified linear activation. Figure 9 depicts the network structure, the convolution layers extract low-level heartbeat signal features from the input grayscale waveform, and then the feature maps are normalized by the BN (Batch Normalization) layer to accelerate the learning speed of the network. The Pool1 layer is a max pooling layer that subsamples the feature maps to reduce the size of feature maps. Next, the SE-Res module enhances useful features and suppresses features for the feature maps and its shortcut connections make the optimization of such a network tractable. The Pool2 layer is an average pooling layer; it not only reduces the size of feature maps but reserves more background information for images. The final fully-connected layer and softmax activation produce a distribution over the two output classes (fertile eggs and dead eggs). It is important to set hyper-parameters and choose an appropriate solution policy for the purpose of reducing the number of parameters and the amount of calculation in the process of model training. Generally speaking, images with higher resolution are helpful for improving network performance; therefore, we set the size of input images as 227 \(\times\) 227 pixels. While training, we followed standard practice and performed data augmentation with random-size cropping to 227 \(\times\) 227 pixels. The convolution kernels that we used with the primary small size of 3 \(\times\) 3 to increase network capacity and reduce parameters. More details and the parameters of different layers are shown in Table 4.  
Figure 8: Two connected schemas of the SE-Res module. (**a**) Represents that the output of two branches have the same channels contrary to (**b**). Here Conv1, Conv2, and Conv3 all represent the convolution layer, where Conv1 has the 3 \(\times\) 3 filter with a stride of 2, and Conv2 has 3 \(\times\) 3 filters with a stride of 1.