Rebar counting method and system based on MobileNetV3 improved model
By using an improved model based on MobileNetV3 to solve the problems of low efficiency and poor accuracy in rebar detection, this method utilizes equalization processing, attention modules, and cross convolution to achieve effective identification and accurate counting of rebars with irregular end shapes.
Patent Information
- Application Number
- CN202211705142.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-12-29
AI Technical Summary
Existing rebar counting methods are complex and inefficient, and cannot accurately identify rebars with irregular end shapes, resulting in poor counting accuracy.
A rebar counting method based on an improved MobileNetV3 model is adopted. By equalizing the original image and combining attention module and cross convolution, feature edge information is enhanced, so as to achieve accurate identification and counting of rebar targets.
It improves the efficiency and accuracy of rebar detection, reduces the probability of duplicate and missed counts, simplifies the detection process, and enhances the operating efficiency of the counting system.
Smart Images

Figure CN115810006B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of steel bar counting, in particular to a steel bar counting method and system based on an improved MobileNetV3 model. BACKGROUND
[0002] When calculating various engineering and building material data, or in the steel manufacturing process, it is often necessary to count the steel bars to count the number of steel bars. The traditional method of steel bar counting is manual counting. However, steel bars are usually placed or transported in a stacked or bundled manner, and the quantity is large and stacked together. The cross section is irregular, and the diameter is small. Relying only on manual calculation is not only time-consuming and laborious, but also low in efficiency and easy to be affected by subjective factors, resulting in repeated counting or missed counting, which leads to errors in steel bar counting.
[0003] The prior art provides a steel bar counting method based on target detection. The method obtains the target to be detected by constructing a process pyramid, constructing a prediction circular frame, and calculating a position loss function. Then, the method realizes steel bar counting by threshold maximum suppression method to screen the prediction circular frame and retrain the network model. The method can improve the detection and counting efficiency and the counting accuracy. However, the operation process of the method is complex, and the detection efficiency is still low. Moreover, the method can only achieve accurate counting under the condition that the shape of the steel bar is a regular circle. However, in actual application, the end of the steel bar is prone to have dents and deformations due to extrusion and bumping. The existing method cannot accurately obtain the target to be detected when the end of the steel bar has defects or the shape of the end is irregular, thereby reducing the accuracy of counting. SUMMARY
[0004] In view of the technical problems in the prior art that the detection process is complex, the detection and operation efficiency is low, and the irregular steel bar at the end of the image cannot be accurately identified, affecting the counting accuracy, the present application provides a steel bar counting method based on an improved MobileNetV3 model. The method can effectively identify the irregular steel bar at the end of the image, improve the target detection operation efficiency, and improve the target identification and counting accuracy.
[0005] To achieve the above-mentioned purpose, the present application adopts the following technical solutions:
[0006] A steel bar counting method based on an improved MobileNetV3 model, which is realized based on a computer system. The method is realized based on an improved MobileNetV3 model, and the specific steps include:
[0007] S1, acquiring an original image of the cross section of a steel bar to be measured;
[0008] S2, performing equalization processing on the original image to obtain an equalized image;
[0009] S3, data labeling is performed on the reinforcement cross section in the equalization image to obtain a labeled image;
[0010] S4, the labeled image is divided into a training set and a test set;
[0011] S5, the training set is imported into a MobileNetV3 improved model for training to obtain the MobileNetV3 improved model, the MobileNetV3 improved model comprises an attention module and a cross convolution, wherein the attention module is used for enhancing the features of the labeled image to obtain a feature enhanced image, and the cross convolution enhances the extraction effect of the feature edge information in the feature enhanced image by changing the shape of the convolution kernel;
[0012] S6, based on the established MobileNetV3 improved model, target detection is performed on the test set to obtain the detection target of the test set;
[0013] S7, the detection target is counted to obtain a total number;
[0014] S8, it is judged whether the total number is the same as a pre-stored real value, if yes, it indicates that the counting is accurate, otherwise, it indicates that the counting is wrong.
[0015] Further features thereof are,
[0016] In step S1, the original image is a gray image, and the original image is collected by an industrial camera;
[0017] Further, in step S2, the equalization processing mode is histogram equalization;
[0018] Further, in step S3, an image labeling tool is used to label the reinforcement region in the equalization image to obtain the labeled image;
[0019] Further, in step S4, the labeled image is divided into a training set and a test set in a ratio of 1:1;
[0020] Further, in step S5, the training steps of the MobileNetV3 improved model comprise:
[0021] S51, an attention module is added to the MobileNetV3 model to extract the feature enhanced image;
[0022] S52, cross convolution is used to sequentially perform feature extraction and feature fusion on the feature enhanced image to obtain a fused feature image;
[0023] S53, the target region of the fused feature image is identified to obtain a reinforcement target, and the MobileNetV3 improved model training is realized;
[0024] Further, in step S51, the attention module is configured to enhance the channel dimension of the labeled image features.
[0025] Further, in step S5, the feature edge information in the feature enhanced image indicates the contour feature of the steel bar target.
[0026] A steel bar counting system for implementing the steel bar counting method based on the improved MobileNetV3 model, the system comprising a computer system and an image acquisition system, the image acquisition system being in communication connection with the computer system, characterized in that the image acquisition system is configured to acquire an original image of a steel bar to be measured, the computer system comprising a data processing module, the data processing module comprising an image preprocessing unit, a labeling tool unit, an improved MobileNetV3 model recognition unit, and a statistical unit, the image preprocessing unit being configured to perform equalization processing on the original image.
[0027] The labeling tool unit is configured to perform data labeling on the steel bar cross section in the equalized image to obtain a labeled image.
[0028] The improved MobileNetV3 model recognition unit is configured to recognize the target features in the labeled image to obtain a steel bar target.
[0029] The statistical unit is configured to count the number of steel bar targets to obtain the total number of steel bar targets in the original image.
[0030] Further features are that,
[0031] The steel bar counting system further comprises a storage module and a display module, the image acquisition system comprising an industrial camera, the industrial camera being connected to the data processing module and the storage module through a data communication line, the storage module storing at least the following contents: original image, steel bar target, and total number of steel bar targets; and the display module displaying at least the following contents: total number of steel bar targets.
[0032] The method described in this invention achieves the following beneficial effects: First, this application uses an improved MobileNetV3 model to detect and identify rebar targets in the original image. Then, it performs statistical counting based on the identification results to obtain the actual number of rebars to be measured. The improved MobileNetV3 model includes an attention module, which enhances the features of the labeled image. This feature enhancement facilitates accurate identification of subsequent target features. Furthermore, the improved MobileNetV3 model also incorporates cross-convolution, which enhances the edge information of features in the image. This edge information enhancement also improves the accuracy of rebar target identification. Moreover, edge information enhancement is not limited by the shape of the target features. Therefore, using this improved MobileNetV3 model enables effective and accurate identification of rebars with irregular end shapes in the image. Accurate identification of rebar targets in the image reduces the probability of duplicate counting and missed counting, significantly improving the accuracy of subsequent rebar statistical counting.
[0033] In the method of this application, only the original image is equalized in the early stage. During recognition, the improved MobileNetV3 model can achieve accurate and effective recognition of steel bar targets by using only attention module and cross convolution. The whole detection and recognition process is simple and fast, which greatly improves the detection efficiency, as well as the steel bar counting efficiency and the overall operating efficiency of the steel bar counting system. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. The accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart of the rebar counting method of the present invention;
[0036] Figure 2 This is a structural diagram of the original MobileNetV3 model;
[0037] Figure 3 This is a structural diagram of the improved MobileNetV3 model of this invention;
[0038] Figure 4 This is a schematic diagram of the original image of the steel bar to be tested, acquired by a camera in an industrial setting.
[0039] Figure 5 This is a schematic diagram of an equalized image obtained using the equalization processing method of the present invention;
[0040] Figure 6This is a comparison diagram of the steel reinforcement targets obtained using the original MobileNetV3 model and the improved MobileNetV3 model. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0042] It should be noted that the terms "comprising" and "having" and any variations thereof in the specification, claims and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product or device.
[0043] This application uses stacked steel bars as the target to be detected. The following provides a specific embodiment of a steel bar counting method based on an improved MobileNetV3 model, and a steel bar counting system capable of implementing this method. The system includes a computer system and an image acquisition system. The computer system includes a data processing module, a storage module, and a display module. The storage module stores the following: original images, steel bar targets, the total number of steel bar targets in each original image, a first average precision, and a second average precision. The display module displays the following: the total number of steel bar targets, the first average precision, and the second average precision. The image acquisition system includes an industrial camera, which is connected to the data processing module and the storage module via a data communication line. The industrial camera is used to acquire original images of the steel bars to be detected. In this embodiment, the acquired original images are grayscale images.
[0044] The data processing module includes an image preprocessing unit, an annotation tool unit, a MobileNetV3 improved model recognition unit, and a statistics unit. The image preprocessing unit is used to perform equalization processing on the original image; the annotation tool unit is used to annotate the cross-sections of the reinforcing bars in the equalized image to obtain an annotated image. In this embodiment, the annotation tool used by the annotation tool unit is the labelimg annotation tool; the MobileNetV3 improved model recognition unit is used to identify the target features in the annotated image to obtain the reinforcing bar targets; and the statistics unit is used to count the number of reinforcing bar targets to obtain the total number of reinforcing bar targets in the original image.
[0045] Among them, in the MobileNetV3 improved model recognition unit, see Figure 3 The improved MobileNetV3 model structure includes an attention module and cross-convolution. The attention module is used to enhance the features of the labeled image and obtain the feature-enhanced image. This module enhances the feature effect of the labeled image by enhancing the channel dimension information. The cross-convolution enhances the feature edge information in the feature-enhanced image by changing the shape of the convolution kernel. The cross-convolution is achieved by parallel horizontal and vertical convolution, which has better image edge extraction capabilities.
[0046] In this improved MobileNetV3 model, the formula for calculating the attention module is as follows:
[0047]
[0048] Among them, u c For the original image features, z c Let W and H be the width and height of the original image features, respectively, and represent the compressed image vector.
[0049] S c =σ(( c ,)),
[0050] Where z c To compress image features, s c Let σ be the feature-enhanced image vector, σ be the sigmoid activation function, and g be the ReLU activation function.
[0051] The formula for calculating cross-convolution is:
[0052]
[0053] Where F in ,F out The input and output features are respectively, k 1×m ,k m×1 ...
[0054] See Figure 2The original MobileNetV3 model primarily extracts features using concatenated Mobile convolutional modules. These modules involve: first, dilating the channel dimensions using point convolution; then, extracting features from the dilated image using general convolution; and finally, reducing the channel dimensions back to their original size using point convolution. The original MobileNetV3 model mainly processes the channel dimensions of the image, without enhancing edge information, which is detrimental to subsequent target region extraction based on feature edges. In contrast, the improved MobileNetV3 model in this application uses cross convolution instead of general convolution. Cross convolution is faster and has better edge information extraction capabilities, particularly for sharp-edged rebar.
[0055] Based on the above-mentioned improved MobileNetV3 model, the quantity of the reinforcing bars to be tested is detected. See Figure 1 The specific testing steps include:
[0056] S1. Use an industrial camera to acquire the original image of the steel bar to be measured. The original image is a grayscale image, see [link / reference]. Figure 4 The original image size is 640 pixels × 640 pixels.
[0057] S2. Perform equalization processing on the original image to obtain an equalized image. The purpose of equalization processing is to enhance the contrast between the foreground and background in the image and reduce the influence of the background, thereby helping to further improve the recognition accuracy of steel bar targets in the foreground.
[0058] The formula for image equalization is:
[0059]
[0060] Where n i P represents the number of occurrences of the i-th gray level. r ( i S represents the probability of the i-th gray level appearing. k This represents the converted grayscale value.
[0061] S3. Use an image annotation tool (e.g., labelimg) to annotate each steel bar area in the original image to obtain an annotated image; in this embodiment, the steel bar area is the end area of each steel bar.
[0062] S4. Divide the labeled images into training and test sets in a 1:1 ratio;
[0063] S5. Import the training set into the MobileNetV3 improved model for training and establish the MobileNetV3 improved model. The specific training steps include: S51. Add an attention module to the MobileNetV3 model and extract features to enhance the image.
[0064] S52. Use cross-convolution to sequentially extract and fuse features from the feature-enhanced image to obtain a fused feature image;
[0065] S53. Identify the target region of the fused feature image, obtain the steel reinforcement target, and realize the training of the MobileNetV3 improved model.
[0066] S6. Based on the established MobileNetV3 improved model, perform target detection on the test set to obtain the detection targets of the test set;
[0067] S7. Count the detected targets and obtain the total number;
[0068] S8. Determine whether the total quantity is the same as the pre-stored actual value. If they are the same, it indicates that the count is accurate; otherwise, it indicates that the count is incorrect.
[0069] This application improves the structural attention module and cross-convolution settings of the MobileNetV3 model, enhancing the edge information extraction capability of target features while reducing computational cost and parameter count. The recognition performance of the MobileNetV3 model and the improved MobileNetV3 model on rebar targets is shown in [reference needed]. Figure 6 ,from Figure 6 As can be seen from Figure 6a, the original MobileNetV3 model can only complete the pre-identification of most steel bar cross sections. Figure 6 As can be seen from Figure 6b, after adopting the improved lightweight model using MobileNetV3 of this application, it is possible to identify all steel bar cross sections. Figure 6 The area enclosed by the rectangular box represents the identified rebar target. The recognition results are an improvement over the original MobileNetV3 model. Figure 6 The cross-sectional shape of a single steel bar is irregular; some are circular, and some are non-circular. Figure 6 As can be seen from Figure 6b, the method of this application can effectively identify steel bars with irregular and non-circular ends.
[0070] Evaluation metrics were used to evaluate the original MobileNetV3 model and the improved MobileNetV3 model. These metrics included: first average precision (mAP ≥ 0.5, with an IoU threshold of 0.5; IoU quantifies the overlap between two regions); second average precision (mAP ≥ 0.5: 0.95, with an IoU threshold range of 0.5–0.95); GFlops (to measure the computational cost of the network model); and the number of parameters (params, used to count the number of parameters in the network model). The evaluation metric values for the original MobileNetV3 model and the improved MobileNetV3 model are shown in Table 1.
[0071] Table 1. Evaluation index values of the original MobileNetV3 model and the improved MobileNetV3 model.
[0072]
[0073] As shown in Table 1, after adopting the improved lightweight model using MobileNetV3 of this application, both the first and second average accuracies are significantly improved. The improved model using MobileNetV3 of this application also reduces the computational load and the number of parameters. Furthermore, the entire process of the rebar counting method and the rebar counting system of this application are simple and easy to implement, with low system configuration requirements; therefore, it can be used in computers and other equipment with lower configurations.
[0074] The above are merely preferred embodiments of this application, and the present invention is not limited to the above embodiments. It is understood that other improvements and variations that are directly derived or conceived by those skilled in the art without departing from the spirit and concept of the invention should be considered to be included within the scope of protection of the invention.
Claims
1. A steel bar counting method based on a MobileNetV3 improved model, characterized in that, The method is realized based on a MobileNetV3 improved model, and specific steps include: S1, collect the original image of the cross section of the steel bar to be tested; S2, perform equalization processing on the original image to obtain an equalized image; S3, label the cross section of the steel bar in the equalized image to obtain a labeled image; S4, divide the labeled image into a training set and a test set; S5, import the training set into the MobileNetV3 improved model for training to obtain a MobileNetV3 improved model, the MobileNetV3 improved model comprising an attention module and a cross convolution, wherein the attention module is used to enhance the features of the labeled image to obtain a feature-enhanced image, and the cross convolution enhances the extraction effect of feature edge information in the feature-enhanced image by changing the shape of the convolution kernel; S6, based on the established MobileNetV3 improved model, perform target detection on the test set to obtain the detection target of the test set; S7, count the detection target to obtain the total number; S8, determine whether the total number is the same as the pre-stored true value, if yes, it indicates that the counting is accurate, otherwise it indicates that the counting is wrong; In step S5, the training steps of the MobileNetV3 improved model include: S51, add an attention module to the MobileNetV3 model to extract the feature-enhanced image; S52, use cross convolution to sequentially perform feature extraction and feature fusion on the feature-enhanced image to obtain a fused feature image; S53, identify the target region of the fused feature image to obtain a steel target, and realize the training of the MobileNetV3 improved model.
2. The steel bar counting method based on the improved MobileNetV3 model according to claim 1, characterized in that, In step S1, the original image is a gray image, and the original image is collected by an industrial camera.
3. The steel bar counting method based on the improved MobileNetV3 model according to claim 1, characterized in that, In step S2, the equalization processing method is histogram equalization.
4. The steel bar counting method based on the improved MobileNetV3 model according to claim 1, characterized in that, In step S3, use an image labeling tool to label the steel bar region in the equalized image to obtain the labeled image.
5. The steel bar counting method based on the improved MobileNetV3 model according to claim 1, characterized in that, In step S4, the labeled image is divided into a training set and a test set in a ratio of 1:
1.
6. The steel bar counting method based on the improved MobileNetV3 model according to claim 1, characterized in that, In step S51, the attention module is used to enhance the channel dimension of the features of the labeled image.
7. The steel bar counting method based on the improved MobileNetV3 model according to claim 6, characterized in that, In step S5, the feature edge information in the feature-enhanced image refers to the contour features of the steel target.
8. A steel bar counting system for implementing the steel bar counting method based on the improved MobileNetV3 model according to claim 1, the system comprising a computer system, an image acquisition system, wherein the image acquisition system is in communication connection with the computer system. The image acquisition system is used to collect the original image of the steel bar to be tested, and the computer system comprises a data processing module, the data processing module comprising an image preprocessing unit, a labeling tool unit, a MobileNetV3 improved model identification unit, and a statistical unit, the image preprocessing unit being used to perform equalization processing on the original image; The labeling tool unit is used to data label the cross section of the steel bar in the equalized image to obtain a labeled image; The MobileNetV3 improved model identification unit is used to identify the target features in the labeled image to obtain a steel target; The statistical unit is used to count the number of steel targets to obtain the total number of steel targets in the original image.
9. The rebar counting system of claim 8, wherein, The steel bar counting system further comprises a storage module and a display module, the image acquisition system comprises an industrial camera, the industrial camera is connected with the data processing module and the storage module through a data communication line, and the storage content of the storage module at least includes original images, steel bar targets and the total number of steel bar targets; the display content of the display module at least includes the total number of steel bar targets.
Citation Information
Patent Citations
Medical waste classification detection method based on improved SSD
CN112270347A
Accurate detection method and system for dense plums picked by robot
CN114387520A