## 3 Method Implementation
### Meter Classification and Target Detection
**Convolutional layer:** The model has 4 convolutional layers, where each layer applies a \(3\times 3\) convolutional kernel (or filter). This kernel slides over the input image (or feature map) to extract local spatial features such as edges, corners, and textures. The convolution operation reduces the image size based on the padding and stride used. In ResNet18, these convolutions are followed by the ReLU (Rectified Linear Unit) activation function, which introduces non-linearity by converting all negative values to zero, helping the model learn complex features. **Residual block:** The core of ResNet18 consists of 8 residual blocks, where each block contains two convolutional layers followed by a skip connection or jump connection. This connection allows the input of the block to bypass the two convolution layers and be added directly to the output. The residual blocks are designed to address the vanishing gradient and exploding gradient problems that occur in very deep networks. By adding the original input back to the output, it becomes easier for the model to learn identity functions, which simplifies the training of very deep models. **Global average pooling layer:** After the residual blocks, the model applies global average pooling (GAP) to the feature maps. This operation converts the spatial dimensions of the feature map into a single value for each feature (channel), effectively transforming the feature map into a 1D vector. GAP reduces the dimensionality of the feature map while retaining the most important information from each feature map channel. This helps prevent overfitting and reduces the number of parameters as compared to using a fully connected layer. Figure 10: ResNet18 structure chart. **Output layer:** The final layer of the model is a fully connected layer that generates predictions for 2 different classes: digital and pointer. This layer uses the softmax activation function to convert the raw output scores into probabilities, ensuring that the sum of the probabilities across all classes equals 1. To achieve accurate readings of pointer and digital meters, it is essential to first detect the meter's location and precisely extract the dial area from the complex background environment. This step aims to filter out background interference, thereby enhancing the accuracy of subsequent meter feature detection. To improve accuracy, the MAMRS employs the YOLOv5 algorithm to detect the meter's position and extract the dial area image. The YOLOv5 network model presented in this paper comprises an input layer, a backbone network, a neck, and an output layer. The structure of YOLOv5 in this study is as follows:  
**Input layers:** The input image is typically resized to 640 \(\times\) 640 pixels. Mosaic augmentation combines 4 images into one during training, and its use helps in increasing the variety of the training set and improving generalization. **Backbone Network:** The backbone uses two major structures, Focus and CSP (Cross Stage Partial). The Focus structure reduces the input image's resolution by 4\(\times\) via slicing the input and concatenating, and it outputs feature maps of dimensions **160 \(\times\) 160 \(\times\) 64** for a 640 \(\times\) 640 input. The CSP structure introduces two parallel paths, where one path is processed through residual blocks and the other path remains untouched. **Neck:** The neck combines an FPN (Feature Pyramid Network) and PAN (Path Aggregation Network) to fuse multi-scale features. The FPN helps in fusing high-level semantic features with lower-level spatial features to enhance object detection across different scales. The PAN enhances the bottom-up path aggregation to improve localization and feature propagation. Typically, the neck produces feature maps at three different resolutions: 80 \(\times\) 80, **40 \(\times\) 40**, and **20 \(\times\) 20** for the **640 \(\times\) 640** input. **Output Layer:** The output layer predicts the bounding boxes, object classes, and confidence scores.