A Fast Positioning Technology for Compensation Hole of Automobile Brake Master Cylinder

The compensation hole of the automobile brake master cylinder is an important structural part for adjusting the reservoir and pressure chamber of the brake master cylinder. Its detection accuracy is strictly controlled. However, because the compensation hole is located on the inner wall of the blind hole, the existing detection method cannot meet the testing needs. Therefore, this paper introduces the SSD model into the detection of the compensation hole of the brake master cylinder, and realizes the rapid positioning of the compensation hole by means of network fine-tuning. The compensation hole positioning detection is carried out on the self-developed automobile brake master cylinder compensation hole detector. The entire detection process time is about 5s, and the positioning accuracy is high. We apply the fine-tuning SSD model to the detection of the compensation hole of automobile brake master cylinder, which replaces the traditional method based on human-computer interaction to determine the position of the compensation hole. It has better detection accuracy and faster detection speed, and lays the foundation for the subsequent detection of the size of the compensation hole.


Introduction
In recent years, the position of the automobile industry in the development of the national economy has become more and more important, and one of the main performance indicators of automobiles is the braking performance of the automobile during driving, which directly affects the safety of driving and road traffic operation. Many major road traffic accidents are caused by the long braking distance of the car or the sideslip caused by the car's emergency braking. Therefore, how to improve the processing quality of the entire automobile brake is the top priority of the entire automobile design and manufacturing engineering industry, and the brake master cylinder [1] is the most important component of the entire automobile brake, and its processing quality is important to the entire automobile brake. The performance and operation of the braking system have a great influence.
The traditional automatic detection technology is mainly based on the experience of construction personnel through contact measurement, which leads to the problems of low detection accuracy, poor stability and low work efficiency, so it is difficult to meet the detection requirements of modern industrial automation. Wang Hongping [2] proposed a high-precision non-contact detection method for the compensation hole of the brake master cylinder. The image of the compensation hole was collected by the micro-endoscopic camera system, and the vehicle was braked by human-computer interaction. The master cylinder compensation hole is inspected. This method mainly observes whether the endoscope reaches the designated position by the human eye. This way, working for a long time will make the operator visually fatigued, so the efficiency and accuracy will be reduced.
With the development of modern deep learning, target detection based on neural network models has gradually been widely used in industrial environments. Nowadays, target detection algorithms mainly include two categories. One is the two-stage target detection algorithm based on candidate regions, R-CNN [3], Fast R-CNN [4], Faster R-CNN [5] and other target detection models, the other is a one-stage target recognition algorithm based on regression, mainly composed of SSD, YOLO [6] and other algorithms composition. Due to the balance between the detection speed and detection accuracy of the one-stage target detection algorithm, this paper is based on the SSD algorithm to study the location of the compensation hole.

Principle of SSD algorithm
In 2016, Liu Wei et al. proposed a one-stage target detector called single shot multibox detector algorithm (SSD) [7], which mainly convolves with the original image to obtain the feature map of the original image. The score and position offset of the frame are predicted by the prior frame on the feature map. The SSD model is mainly based on the network structure of the VGG16 network, extracts the features in the image, and removes the fully connected layer in the traditional VGG network. And on this basis, 6 layers of convolutional layers and pooling layers with different scales are added. By adding the detection method of the feature gold tower, using different sizes of convolutional layers, it is possible to detect smaller ones in a relatively large feature map. Target, a larger target is detected in a smaller feature map to complete the target detection in the image. The specific SSD network structure diagram is shown in the following figure:

Training stage
In the training phase of SSD, the data set is first read, and then input into the network. Multi-scale anchor boxes are generated in the forward calculation of the model to predict the category and offset. Assuming that the center coordinates of anchor box A and its corresponding true We generally calculate the anchor box A by the following formula offset: The default values of the constants in the formula are = 0 If an anchor box is not assigned a true bounding box, then we set the anchor box category as background. We define the anchor frame as the background category is usually defined as the negative anchor frame, and the remaining anchor frames are defined as the positive anchor frame. The total error loss during the training of the SSD target detection network is the weighted sum of the category error loss and the position error loss. The specific expression is as follows: In the formula, The category prediction loss function uses the crossentropy loss function. Assuming that the prediction probability of the real category j is j p and the crossentropy loss is -log j p , then given the hyperparameters  and  , the specific expression of the category prediction loss function is as follows: By increasing the value of in the category prediction loss function expression, the loss when the category prediction probability is large can be effectively reduced.
Among them, the offset prediction loss function uses the 1 L norm loss function, but because the 1 L norm is not differentiable near the zero point, this paper uses the smooth 1 L norm to replace it, and the square function is used near the zero point to make the function smoother. For the area outside the vicinity of the zero point, an expression similar to the 1 L norm is used. The specific expression is as follows: In the formula, l and g are the position representations of the predicted anchor frame and the real anchor frame, and  is a hyperparameter. The smoothness of the curve is controlled by adjusting  . When  is large, the loss function is similar to 1 L norm, and when  is small, the loss function is smoother.

Prediction stage
When performing target detection for a target object that needs to be detected in an image, multiple candidate frames may appear on the same target object, and these candidate frames overlap each other. This is not what we need, so we need to pass the non-maximum suppression algorithm removes redundant candidate frames and only retains the most accurate candidate frame. The specific steps are as follows: 1. We assume that the predicted bounding box of a target image is B, and the model will calculate the maximum predicted probability of each predicted category. Assuming that the maximum predicted probability is p, the predicted category corresponding to the predicted probability is the predicted category of frame B. We Call p the confidence of predicting the bounding box B.
2. In the target image to be detected, we sort the confidence of the prediction bounding box whose prediction category is non-background in order from high to low, and obtain the confidence list L, and select the one with the highest confidence The prediction bounding box is used as the reference of the confidence level, and the non-reference prediction bounding box whose intersection ratio with 1 B is greater than the preset confidence threshold is removed from the confidence list L.
3. Then select the second highest prediction bounding box 2 B from the confidence list L as the confidence benchmark, and remove the non-reference prediction bounding box whose intersection with 2 B is greater than the preset confidence threshold from L, repeat the above operations until all the predicted bounding boxes in L have been benchmarked.
4. At this time, the intersection ratio of any pair of predicted bounding boxes in L is less than the preset threshold. All predicted bounding boxes in list L are target areas in the image and drawn in the image.

Network fine-tuning
Although the existing data set is very rich, it still has a certain gap with the target image we want to identify and detect. The existing solution is either to take a large number of images of the target object to be detected and then make it into a data set. The data set produced may be very large, but it is still very different from a data set such as ImageNet. This will lead to a complex model with a high detection accuracy on a large data set such as ImageNet. It appears on the target object we want to detect. The fitting phenomenon, also because of the limited data, the accuracy of the final trained model does not meet the detection requirements. If you simply start with collecting more data, it will probably spend a lot of time and money. Therefore, scholars have proposed network training through the application of network fine-tuning.
Network fine-tuning, as the name suggests, is to transfer the network model parameters trained on a large data set to a small target data set to be trained. Although most images on the large data set have nothing to do with the target object, but from the large data set the acquired ability to recognize information such as edges, textures, and shapes is still effective for target recognition.
The fine-tuning model of specific network fine-tuning is expressed as follows:

Results & Discussion
The compensation hole of the automobile brake master cylinder is a small hole located on the inner wall of the deep cavity, as shown in Figure 3. The compensation hole image is obtained on the self-developed high-efficiency and high-precision brake master cylinder compensation hole detection device [8,9], the details are shown in Figure  4.  The working principle of the device is to work in the way of human-computer interaction, that is, the brake master cylinder is inverted on the inspection table, and the endoscope is driven into the brake master cylinder by manually driving the ball screw. When the human eye observes the brake After the position of the master cylinder, its parameters are tested. We collected 400 images of 10 different types of brake master cylinder compensation holes at different distances and different angles, and used them as a training set. The data set was manually marked to mark the coordinates of the compensation holes in the image, and record it in the data sheet. By removing the input and output ends of the trained SSD model, the SSD model can be accurately positioned to the position of the compensation hole in the image by means of fine-tuning.
When training the model, use an i7cpu2, 8G computer, use caffe software, and use a single GPU for training. Randomly select 30 compensation hole images from the training set each time for training. After 40 trainings, the following table records. In the training process, the classification error at different iteration times, the frame prediction error, and the training time are calculated. By randomly inputting an image of a compensation hole that has not been trained before, the trained network is randomly input, the confidence threshold is set to 0.5, and the anchor box with a confidence greater than 0.5 is input. The following figure shows the location of the detected compensation hole image and confidence value. It can be seen from the figure that the network trained by fine-tuning can accurately detect the position of the compensation hole in the image, and the detection time is only 5s, while the traditional human-computer interaction method, the time it takes to detect the compensation hole is about 1 minute, so the target detection algorithm based on deep learning is superior to traditional detection methods in detection accuracy and detection time, which is of great significance for the automatic detection of subsequent compensation holes.

Conclusions
In order to solve the existing problem of positioning the compensation hole of the automobile brake master cylinder based on human-machine interaction, this paper proposes to apply the deep convolutional neural network SSD model to the rapid positioning of the compensation hole. Compared with the traditional manual positioning method under the premise of the same detection accuracy, the detection method proposed in this paper takes about 5s for the entire detection process, and the detection time is only one-tenth of the traditional detection method, and the compensation hole positioning algorithm based on the SSD model has good robustness , Which can meet the allweather rapid detection, which lays a good foundation for the automatic detection of the compensation hole parameters of the brake master cylinder of the subsequent automobile.