A counting method and system for steel bar inventory

The semantic segmentation model and contour division rules are used to identify and divide steel bar images and calculate the cross-sectional area ratio of steel bars, which solves the problem of inaccurate statistics of the number of steel bars and improves statistical efficiency and accuracy.

CN118470093BActive Publication Date: 2024-09-13NANCHANG ZHIQIAO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410917091.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-09-13
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

When taking pictures of bundles of steel bars, because the shooting angle is not flush with the cross-section of the steel bars, the diameters of bundles of the same type of steel bars are inconsistent, and the label partially blocks the cross-section of the steel bars, making it impossible to accurately count the number of steel bars.

Method used

Use the preset semantic segmentation model and contour division rules to identify and divide the target image to be recognized, obtain the cross-sectional area of ​​the steel bar end face, determine the number of steel bars contained in the sub-area through the average cross-sectional area ratio, and add them up to calculate the total number of steel bars .

Benefits of technology

It effectively solves the problem of inaccurate number of steel bars, improves point counting efficiency and ensures accuracy, especially when the shooting angle is uneven.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118470093B
    Figure CN118470093B
Patent Text Reader

Abstract

The present invention discloses a counting method and system for steel bar inventory, the method comprising: determining a first counting result of a second to-be-identified area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-identified area, and then obtaining the first target counting result of each second to-be-identified area in the target to-be-identified image; performing target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model, and obtaining the second target counting result; adding the first counting result and the second counting result to obtain the total number of steel bars in the current video image. The number of steel bars in a sub-area of ​​a target second to-be-identified area is estimated by the counting result of a second to-be-identified area, which can effectively improve the efficiency of steel bar counting while ensuring the accuracy of counting as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image recognition, and in particular relates to a counting method and system for steel bar inventory. Background Art

[0002] At present, the inventory counting of steel bars is still mainly carried out manually. The focus of computer vision technology related to steel bar counting is mostly on designing algorithms to improve the accuracy of steel bar counting, without considering the application needs of actual scenarios.

[0003] In fact, when taking pictures of bundled steel bars, the shooting angle is not flush with the steel bar cross section, which may cause the diameters of the same type of bundled steel bars in a picture to be displayed inconsistently. Therefore, when there are labels in the picture that partially block the steel bar cross section, it is impossible to accurately count the current number of steel bars based on the steel bar cross section. Summary of the invention

[0004] The present invention provides a counting method and system for steel bar inventory, which is used to solve the technical problem that when there is a label in a picture that partially blocks the steel bar cross section, it is impossible to accurately count the current number of steel bars according to the steel bar cross section.

[0005] In a first aspect, the present invention provides a counting method for steel bar inventory, comprising:

[0006] Acquire a video image shot of the end face of the steel bar, and recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result;

[0007] Dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour;

[0008] Dividing each second to-be-recognized area in the target to-be-recognized image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-recognized area;

[0009] Obtaining the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculating the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second region to be identified;

[0010] Determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and then determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified;

[0011] Determine a first counting result of the second to-be-recognized area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-recognized area, and then obtain a first target counting result of each second to-be-recognized area in the target to-be-recognized image;

[0012] Performing target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result;

[0013] The first target counting result and the second target counting result are added to obtain the total number of steel bars in the current video image.

[0014] In a second aspect, the present invention provides a counting system for steel bar inventory, comprising:

[0015] A recognition module is configured to obtain a video image shot of the end face of the steel bar, recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result;

[0016] A first segmentation module is configured to segment the target image to be identified based on a preset contour segmentation rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour;

[0017] A second division module is configured to divide each second to-be-identified area in the target to-be-identified image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-identified area;

[0018] A calculation module is configured to obtain the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculate the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second area to be identified;

[0019] A first determination module is configured to determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and further determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified;

[0020] A second determination module is configured to determine a first counting result of the second to-be-identified area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-identified area, and thereby obtain a first target counting result of each second to-be-identified area in the target to-be-identified image;

[0021] A counting module is configured to perform target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result;

[0022] The third determination module is configured to add the first target counting result and the second target counting result to obtain the total number of steel bars in the current video image.

[0023] In a third aspect, an electronic device is provided, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of the counting method for steel bar inventory according to any embodiment of the present invention.

[0024] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor executes the steps of the counting method for steel bar inventory of any embodiment of the present invention.

[0025] The counting method and system for steel bar inventory of the present application divide the second area to be identified into at least four sub-areas using a preset area division rule, which can make the diameter of the second steel bar end face and the diameter of the first steel bar end face in the same sub-area consistent as much as possible, and can more effectively solve the problem of inaccurate estimation of the number of steel bars in the second area to be identified, and estimate the number of steel bars in a sub-area of ​​a target second area to be identified through the counting result of a second area to be identified, which can more effectively improve the efficiency of steel bar counting while ensuring the accuracy of counting as much as possible. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1A flowchart of a counting method for steel bar inventory provided by one embodiment of the present invention;

[0028] Figure 2 A structural block diagram of a counting system for steel bar inventory provided by one embodiment of the present invention;

[0029] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] See also Figure 1 , which shows a flow chart of a counting method for steel bar inventory in the present application.

[0032] like Figure 1 As shown, the counting method for steel bar inventory specifically includes the following steps:

[0033] Step S101, obtaining a video image shot of the end face of a steel bar, and recognizing the video image according to a preset semantic segmentation model, and obtaining a target image to be recognized according to the recognition result.

[0034] In this step, a camera device with an image acquisition function is used to collect the end face of the steel bar in real time to obtain a video image. The semantic segmentation model recognizes the video image. If the semantic segmentation recognition result indicates that there is an incomplete end face of the steel bar in the video image, then an adjacent video image corresponding to the video image is obtained; the video image and the adjacent video image are spliced ​​based on a preset image splicing algorithm to obtain the target image to be identified. That is, the preset semantic segmentation model recognizes the video image, performs a forward operation on the video image, identifies the steel bar end face area and the background area in the video image, and determines whether the boundary of the above steel bar end face area and the video image intersect. If so, it indicates that there is an incomplete end face of the steel bar in the video image. At this time, an adjacent video image corresponding to the video image is obtained; and the video image and the adjacent video image are spliced ​​to obtain the target image to be identified. In this way, the problem that a complete count cannot be achieved through one image in a large-scale densely stacked steel bar scene can be avoided.

[0035] Step S102, dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour.

[0036] In this step, each second steel bar end face having a defect contour in the target image to be identified is identified and merged based on a preset image recognition model to obtain a second sub-region to be identified; a sliding window of a preset size is slid on the edge of the second sub-region to be identified to obtain at least one second region to be identified, wherein the preset size is larger than the diameter of any second steel bar end face or the diameter of any first steel bar end face in the target image to be identified.

[0037] It should be noted that the image recognition model is obtained by training a circle recognition network based on deep learning. The network structure of the circle recognition network is the AlexNet structure. The AlexNet structure has 5 cascaded convolutional layers and 3 fully connected layers.

[0038] Step S103 : dividing each second to-be-recognized region in the target to-be-recognized image based on a preset region division rule to obtain at least four sub-regions corresponding to each second to-be-recognized region.

[0039] In this step, the second areas to be identified are sorted according to their area sizes; the second areas to be identified are divided in order from small to large, wherein the area division rule is: the center point of a second area to be identified is used as the coordinate origin, and the second area to be identified is divided into at least four sub-areas. Specifically, the four sub-areas are the upper left area, the lower left area, the upper right area, and the lower right area. For another example, the center point of a second area to be identified is used as the coordinate origin to construct a coordinate system, so that the four sub-areas divided by the second area to be identified fall into the first quadrant, the second quadrant, the third quadrant, and the fourth quadrant respectively.

[0040] It should be noted that by dividing the second area to be identified from small to large in sequence and first determining the steel bar counting result of the second area to be identified with a small area, it is possible to quickly determine the steel bar counting result of the second area to be identified with a large area later.

[0041] For example, assuming that in the process of acquiring the target image to be identified, the diameter of the end face of the steel bar in the target image to be identified may be inconsistent due to the shooting angle not being flush with the cross section of the steel bar. If the area of ​​the end face of the first steel bar with a complete outline in the second area to be identified is directly replaced with the area of ​​the end face of the second steel bar with a defective outline in the second area to be identified, it may cause inaccurate estimation of the number of steel bars in the second area to be identified. Therefore, this embodiment uses a preset area division rule to divide the second area to be identified into at least four sub-areas, which can make the diameter of the second steel bar end face in the same sub-area as consistent as possible with the diameter of the first steel bar end face, and can more effectively solve the above-mentioned problem.

[0042] Step S104, obtaining the first cross-sectional area of ​​all first steel bar end faces and the second cross-sectional area of ​​all second steel bar end faces in a certain sub-region, and calculating the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a second area to be identified.

[0043] It should be noted that the average first cross-sectional area of ​​the first steel bar end faces in a certain sub-region is the ratio of the sum of the areas of all the first steel bar end faces in the certain sub-region to the total number of all the first steel bar end faces in the certain sub-region.

[0044] Step S105, determining the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and further determining the number of second steel bar end faces contained in each sub-region of the certain second area to be identified.

[0045] Step S106, determining a first counting result of a second area to be identified based on the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second area to be identified, and then obtaining a first target counting result of each second area to be identified in the target image to be identified.

[0046] In this step, after determining the first counting result of the certain second area to be identified, it is determined whether there is at least one target second area to be identified adjacent to the certain second area to be identified; if there is a certain target second area to be identified adjacent to the certain second area to be identified, the number of second steel bar end faces contained in a certain target sub-area of ​​the certain target second area to be identified is determined according to the area of ​​the certain target second area to be identified and the first counting result, wherein the certain second area to be identified is located within the division direction of the certain target sub-area; the number of second steel bar end faces contained in the other target sub-areas is determined according to the ratio of the average first cross-sectional area of ​​the other target sub-areas to the second cross-sectional area of ​​the other target sub-areas, wherein the other target sub-areas are the target sub-areas of the certain target second area to be identified excluding the certain target sub-area; the second counting result of the certain target second area to be identified is determined according to the number of second steel bar end faces contained in each sub-area of ​​the certain target sub-area and the number of first steel bar end faces, thereby obtaining the first target counting result of each second area to be identified in the target to be identified image.

[0047] It should be noted that a target second area to be identified is adjacent to a second area to be identified specifically when the minimum distance between the boundary of a target second area to be identified and the boundary of the second area to be identified is less than a preset threshold, the target second area to be identified is adjacent to the second area to be identified.

[0048] In this embodiment, the number of steel bars in a sub-area of ​​a target second area to be identified is estimated by the counting result of a second area to be identified, which can effectively improve the efficiency of steel bar counting. For example, assuming that there is a difference in steel bar diameter due to the shooting angle, since a second area to be identified is adjacent to a target second area to be identified, and a second area to be identified is located in the first sub-area or the first quadrant of a target second area to be identified, the difference between the cross-sectional diameter of the steel bars in a second area to be identified and the cross-sectional diameter of the steel bars in the first sub-area of ​​a target second area to be identified may be minimized or even eliminated. Therefore, the number of steel bars in a sub-area of ​​a target second area to be identified is estimated by the counting result of a second area to be identified, which can effectively improve the efficiency of steel bar counting while ensuring the accuracy of counting as much as possible.

[0049] Step S107 , performing target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result.

[0050] In this step, the preset target detection model is a model obtained by training an initial model constructed based on an artificial intelligence algorithm using a pre-acquired training set; the training set includes an image of the end face of the steel bar and corresponding label information representing the type of features.

[0051] Step S108, adding the first target counting result and the second target counting result to obtain the total number of steel bars in the current video image.

[0052] In summary, the method of the present application divides the second area to be identified into at least four sub-areas using a preset area division rule, which can make the diameter of the second steel bar end face in the same sub-area consistent with the diameter of the first steel bar end face as much as possible, and can more effectively solve the problem of inaccurate estimation of the number of steel bars in the second area to be identified, and estimate the number of steel bars in a sub-area of ​​a target second area to be identified through the counting results of a second area to be identified, which can more effectively improve the efficiency of steel bar counting while ensuring the accuracy of the counting as much as possible.

[0053] See also Figure 2 , which shows a structural block diagram of a counting system for steel bar inventory in the present application.

[0054] like Figure 2 As shown, the point system 200 includes an identification module 210 , a first division module 220 , a second division module 230 , a calculation module 240 , a first determination module 250 , a second determination module 260 , a counting module 270 and a third determination module 280 .

[0055] Among them, the recognition module 210 is configured to obtain a video image shot of the end face of the steel bar, and recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result; the first division module 220 is configured to divide the target image to be recognized based on a preset contour division rule to obtain a first area to be recognized and a second area to be recognized, wherein the first area to be recognized only contains at least one first steel bar end face with a complete contour, and the second area to be recognized contains at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour; the second division module 230 is configured to divide each second area to be recognized in the target image to be recognized based on a preset area division rule to obtain at least four sub-areas corresponding to each second area to be recognized; the calculation module 240 is configured to obtain the first cross-sectional area of ​​all the first steel bar end faces and the second cross-sectional area of ​​all the second steel bar end faces in a certain sub-area, and calculate the first steel bar end face in the certain sub-area. The average first cross-sectional area of ​​a surface, wherein the certain sub-region is any sub-region in a certain second area to be identified; a first determination module 250 is configured to determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and then determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified; a second determination module 260 is configured to determine the first counting result of the certain second area to be identified according to the number of second steel bar end faces contained in each sub-region of the certain second area to be identified and the number of first steel bar end faces, and then obtain the first target counting result of each second area to be identified in the target image to be identified; a counting module 270 is configured to perform target detection and counting on the first area to be identified in the target image to be identified according to a preset target detection model to obtain a second target counting result; a third determination module 280 is configured to add the first target counting result to the second target counting result to obtain the total number of steel bars in the current video image.

[0056] It should be understood that Figure 2 Modules and references documented in Figure 1 Therefore, the operations and features described above for the method and the corresponding technical effects are also applicable to Figure 2 The modules in it will not be described in detail here.

[0057] In other embodiments, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the program instructions are executed by a processor, the processor is caused to execute the counting method for steel bar inventory in any of the above method embodiments;

[0058] As an implementation mode, the computer-readable storage medium of the present invention stores computer-executable instructions, and the computer-executable instructions are configured as follows:

[0059] Acquire a video image shot of the end face of the steel bar, and recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result;

[0060] Dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour;

[0061] Dividing each second to-be-recognized area in the target to-be-recognized image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-recognized area;

[0062] Obtaining the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculating the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second region to be identified;

[0063] Determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and then determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified;

[0064] Determine a first counting result of the second to-be-recognized area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-recognized area, and then obtain a first target counting result of each second to-be-recognized area in the target to-be-recognized image;

[0065] Performing target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result;

[0066] The first target counting result and the second target counting result are added to obtain the total number of steel bars in the current video image.

[0067] The computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the counting system for steel bar inventory counting, etc. In addition, the computer-readable storage medium may include a high-speed random access memory, and may also include a memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the computer-readable storage medium may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the counting system for steel bar inventory counting via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0068] Figure 3 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Figure 3 As shown, the device includes: a processor 310 and a memory 320. The electronic device may also include: an input device 330 and an output device 340. The processor 310, the memory 320, the input device 330 and the output device 340 may be connected via a bus or other means. Figure 3 In the example, the connection through the bus is taken as an example. The memory 320 is the above-mentioned computer-readable storage medium. The processor 310 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 320, that is, the counting method for steel bar inventory in the above-mentioned method embodiment is implemented. The input device 330 can receive input digital or character information, and generate key signal input related to user settings and function control of the counting system for steel bar inventory. The output device 340 may include display devices such as display screens.

[0069] The electronic device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0070] As an embodiment, the electronic device is applied to a counting system for steel bar inventory, and is used for a client, and includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can:

[0071] Acquire a video image shot of the end face of the steel bar, and recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result;

[0072] Dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour;

[0073] Dividing each second to-be-recognized area in the target to-be-recognized image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-recognized area;

[0074] Obtaining the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculating the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second region to be identified;

[0075] Determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and then determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified;

[0076] Determine a first counting result of the second to-be-recognized area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-recognized area, and then obtain a first target counting result of each second to-be-recognized area in the target to-be-recognized image;

[0077] Performing target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result;

[0078] The first target counting result and the second target counting result are added to obtain the total number of steel bars in the current video image.

[0079] Through the description of the above implementation modes, those skilled in the art can clearly understand that each implementation mode can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A counting method for steel bar inventory, characterized in that: include: Acquire a video image shot of the end face of the steel bar, and recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result; Dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour; Dividing each second to-be-recognized area in the target to-be-recognized image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-recognized area; Obtaining the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculating the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second region to be identified; Determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and then determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified; Determine the first counting result of the second to-be-recognized area according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second to-be-recognized area, and then obtain the first target counting result of each second to-be-recognized area in the target to-be-recognized image, wherein obtaining the first target counting result of each second to-be-recognized area in the target to-be-recognized image includes: After determining the first counting result of the certain second area to be identified, determining whether there is at least one target second area to be identified adjacent to the certain second area to be identified; If there is a certain target second area to be identified that is adjacent to the certain second area to be identified, then determine the number of second steel bar end faces contained in a certain target sub-area of ​​the certain target second area to be identified according to the area of ​​the certain target second area to be identified and the first counting result, wherein the certain second area to be identified is located in the division direction of the certain target sub-area; Determine the number of second steel bar end faces contained in the other target sub-regions according to the ratio of the average first cross-sectional area of ​​the other target sub-regions to the second cross-sectional area of ​​the other target sub-regions, wherein the other target sub-regions are the target sub-regions in the second target area to be identified excluding the certain target sub-region; Determine a second counting result of the second to-be-recognized area of ​​the target according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the target sub-area, and then obtain the first target counting result of each second to-be-recognized area in the target to-be-recognized image; Performing target detection and counting on the first area to be identified in the target to be identified image according to a preset target detection model to obtain a second target counting result, wherein the preset target detection model is a model obtained by training an initial model constructed based on an artificial intelligence algorithm using a pre-acquired training set; the training set includes an image containing an end face of a steel bar and corresponding label information representing a type of feature; The first target counting result and the second target counting result are added to obtain the total number of steel bars in the current video image.

2. A counting method for steel bar inventory according to claim 1, characterized in that: in, Specifically, the second target area to be identified is adjacent to the second area to be identified: When the minimum distance between the boundary of the second to-be-recognized area of ​​the certain target and the boundary of the second to-be-recognized area is less than a preset threshold, the second to-be-recognized area of ​​the certain target is adjacent to the second to-be-recognized area.

3. A counting method for steel bar inventory according to claim 1, characterized in that: The step of dividing the target image to be identified based on a preset contour division rule to obtain a first area to be identified and a second area to be identified includes: Based on a preset image recognition model, each second steel bar end face having a defect contour in the target image to be recognized is identified and merged to obtain a second sub-region to be recognized; A sliding window based on a preset size slides on the edge of the second sub-area to be identified to obtain at least one second area to be identified, wherein the preset size is larger than the diameter of any second steel bar end face or the diameter of any first steel bar end face in the target image to be identified.

4. A counting method for steel bar inventory according to claim 1, characterized in that: The step of dividing each second area to be identified in the target image to be identified based on a preset area division rule to obtain at least four sub-areas corresponding to each second area to be identified includes: sorting the second regions to be identified according to the sizes of the respective second regions to be identified; The second areas to be identified are divided in order from small to large in area, wherein the area division rule is: taking the center point of a second area to be identified as the coordinate origin, the second area to be identified is divided into at least four sub-areas.

5. A counting system for steel bar inventory, characterized in that: include: A recognition module is configured to obtain a video image shot of the end face of the steel bar, recognize the video image according to a preset semantic segmentation model, and obtain a target image to be recognized according to the recognition result; A first segmentation module is configured to segment the target image to be identified based on a preset contour segmentation rule to obtain a first area to be identified and a second area to be identified, wherein the first area to be identified only includes at least one first steel bar end face with a complete contour, and the second area to be identified includes at least one first steel bar end face with a complete contour and at least one second steel bar end face with a defective contour; A second division module is configured to divide each second to-be-identified area in the target to-be-identified image based on a preset area division rule to obtain at least four sub-areas corresponding to each second to-be-identified area; A calculation module is configured to obtain the first cross-sectional areas of all first steel bar end faces and the second cross-sectional areas of all second steel bar end faces in a certain sub-region, and calculate the average first cross-sectional area of ​​the first steel bar end faces in the certain sub-region, wherein the certain sub-region is any sub-region in a certain second area to be identified; A first determination module is configured to determine the number of second steel bar end faces contained in the certain sub-region according to the ratio of the average first cross-sectional area to the second cross-sectional area, and further determine the number of second steel bar end faces contained in each sub-region of the certain second area to be identified; The second determination module is configured to determine a first counting result of a second area to be identified according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the second area to be identified, and then obtain the first target counting result of each second area to be identified in the target image to be identified, wherein obtaining the first target counting result of each second area to be identified in the target image to be identified includes: After determining the first counting result of the certain second area to be identified, determining whether there is at least one target second area to be identified adjacent to the certain second area to be identified; If there is a certain target second area to be identified that is adjacent to the certain second area to be identified, then determine the number of second steel bar end faces contained in a certain target sub-area of ​​the certain target second area to be identified according to the area of ​​the certain target second area to be identified and the first counting result, wherein the certain second area to be identified is located in the division direction of the certain target sub-area; Determine the number of second steel bar end faces contained in the other target sub-regions according to the ratio of the average first cross-sectional area of ​​the other target sub-regions to the second cross-sectional area of ​​the other target sub-regions, wherein the other target sub-regions are the target sub-regions in the second target area to be identified excluding the certain target sub-region; Determine a second counting result of the second to-be-recognized area of ​​the target according to the number of second steel bar end faces and the number of first steel bar end faces contained in each sub-area of ​​the target sub-area, and then obtain the first target counting result of each second to-be-recognized area in the target to-be-recognized image; A counting module is configured to perform target detection and counting on the first to-be-identified area in the target to-be-identified image according to a preset target detection model to obtain a second target counting result, wherein the preset target detection model is a model obtained by training an initial model constructed based on an artificial intelligence algorithm using a pre-acquired training set; the training set includes an image containing an end face of a steel bar and corresponding label information representing a type feature; The third determination module is configured to add the first target counting result and the second target counting result to obtain the total number of steel bars in the current video image.

6. An electronic device, characterized in that: include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.