Steel pipe edge detection method, device and computer-readable storage medium
By using the Deeplabv3+ model to generate pixel classification diagrams and perform denoising and morphological operations, the center line of the effective steel pipe area is screened out, and the problem of inaccurate steel pipe edge identification is solved, and accurate detection of steel pipe edges is achieved to ensure construction safety.
Patent Information
- Application Number
- CN202210962599.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-11
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-08-11
AI Technical Summary
In the prior art, the convolutional neural networks identify the edges of steel pipes inaccurately enough, and the scope of steel pipes cannot be accurately determined, resulting in the inability to effectively monitor whether construction personnel are far away from steel pipes, which poses safety hazards.
The pixel classification diagram marked with steel pipe area and non-steel pipe area is generated using the Deeplabv3+ semantic segmentation model. The effective steel pipe area is screened through denoising and morphological operations, and the center line is calculated and the edge line of the steel pipe is determined.
Accurate detection of the edge of steel pipes is achieved, and it can effectively monitor whether construction workers are away from steel pipes and reduce safety hazards.
Smart Images

Figure CN115376065B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to a steel pipe edge detection method, device and computer-readable storage medium. Background Art
[0002] Steel pipes primarily refer to pipes made from steel, used for conveying fluids and powdered solids, exchanging heat, and manufacturing mechanical parts. During the casting and layout of steel pipes, due to their significant weight, workers should stay as far away from them as possible when lifting or moving them to avoid potential safety hazards. Related technologies use on-site monitoring equipment to capture images to monitor construction workers' compliance, thereby minimizing safety hazards.
[0003] Regarding the above-mentioned related technologies, the inventors found that when using convolutional neural networks to identify images collected by monitoring equipment, the convolutional neural networks were not accurate enough in identifying steel pipes and could not obtain relatively accurate edges of the steel pipes, making it difficult to determine the range of the steel pipes. Summary of the Invention
[0004] In order to facilitate the detection of the edge of a steel pipe, the present application provides a steel pipe edge detection method, device and computer-readable storage medium.
[0005] In a first aspect, the present application provides a steel pipe edge detection method, which adopts the following technical solutions:
[0006] A steel pipe edge detection method, comprising:
[0007] Obtain the image to be detected;
[0008] Input the image to be detected into the trained detection model to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas;
[0009] Screen the steel pipe area in the pixel classification map to obtain the valid steel pipe area in the pixel classification map;
[0010] Calculate the center line of the effective steel pipe area in the pixel classification map;
[0011] According to the center line of the effective steel pipe area in the pixel classification map, the edge line of the steel pipe is calculated.
[0012] By adopting the above technical solution, the image to be detected is input into the detection model, and a pixel classification map is output. Then, the effective steel pipe area is screened out from the steel pipe area in the pixel classification map to make the division of the steel pipe area more accurate. Then, the center line of the effective steel pipe area is calculated, and the center line is regarded as the center line of the steel pipe. Then, the edge line of the effective area is calculated from the center line, and the edge line is regarded as the edge line of the steel pipe. By further optimizing the steel pipe area result output by the detection model, the steel pipe edge line is obtained more accurately, thereby realizing the detection of the steel pipe edge.
[0013] Optionally, the screening of the steel pipe area in the pixel classification map to obtain the valid steel pipe area in the pixel classification map specifically includes:
[0014] De-noising the steel pipe region in the pixel classification image to obtain a first steel pipe region;
[0015] It is determined whether the area of the first steel pipe region is greater than a preset area screening threshold. If so, the first steel pipe region is determined as a valid steel pipe region; if not, the first steel pipe region is determined as a non-steel pipe region.
[0016] By adopting the above technical solution, the steel pipe area is denoised, the irregular areas in the steel pipe area are removed, and then the area of the obtained first steel pipe area is judged, and the first steel pipe area whose area is obviously inconsistent with the actual area of the steel pipe is excluded, so that the final selected effective steel pipe area is closer to the actual steel pipe.
[0017] Optionally, the denoising process on the steel pipe area in the pixel classification map specifically includes:
[0018] Perform one or more morphological opening operations on the steel pipe region in the pixel classification image to obtain a second steel pipe region;
[0019] Perform one or more morphological closing operations on the second steel pipe region to obtain a denoised steel pipe region.
[0020] By adopting the above technical solution, the connected steel pipe areas are separated by morphological opening operation, and isolated points or burrs in the steel pipe area can be removed. The morphological closing operation is used to eliminate some impurities inside the steel pipe area. Therefore, the steel pipe area after the opening and closing operations is closer to the actual steel pipe.
[0021] Optionally, the calculating of the center line of the effective steel pipe area in the pixel classification map specifically includes:
[0022] Divide the effective steel pipe area in the pixel classification map into n sub-effective steel pipe areas;
[0023] respectively obtaining the center of each of the effective sub-steel pipe areas;
[0024] Linear fitting is performed on the centers of the n sub-effective steel pipe areas to obtain the center line of the effective steel pipe area in the pixel classification map.
[0025] By adopting the above technical solution, the effective steel pipe area is divided into n parts, and then the center of each sub-effective steel pipe area after the division is obtained. All the obtained centers are linearly fitted to obtain the center line of the effective steel pipe area, thereby realizing the preliminary positioning of the steel pipe.
[0026] Optionally, calculating the edge line of the steel pipe according to the center line of the effective steel pipe area in the pixel classification map specifically includes:
[0027] According to the slope and length of the center line, a preset parallel line having the same slope and length as the center line is obtained;
[0028] Taking the center line as the starting point, parallel lines are translated to both sides of the center line in the direction perpendicular to the center line;
[0029] Each time the translation is performed, the number of intersecting pixels between the parallel line and the effective steel pipe area in the pixel classification map is recorded;
[0030] Determine whether the number of intersecting pixels meets the preset conditions. If so, take the corresponding parallel lines as edge lines.
[0031] By adopting the above technical solution, parallel lines are preset according to the slope and length of the center line, and the parallel lines are moved in the vertical direction of the center line. The number of intersecting pixels is recorded each time the movement is performed. When the number of intersecting pixels meets the preset conditions, the parallel lines corresponding to the number of intersecting pixels are used as the edge lines of the steel pipe, thereby achieving the effect of steel pipe edge detection.
[0032] Optionally, the parallel lines are translated equidistantly according to a preset movement distance.
[0033] By adopting the above technical solution and utilizing the method of equidistantly translating parallel lines, the translation range of the parallel lines can more comprehensively cover the effective steel pipe area, thereby facilitating more accurate determination of the edge line of the effective steel pipe area.
[0034] Optionally, the determining whether the number of intersecting pixels meets a preset condition, and if so, taking the corresponding parallel lines as edge lines specifically includes:
[0035] It is determined whether the number of intersecting pixels in the latter of two consecutive records is less than a first preset percentage of the number of intersecting pixels in the former record. If so, the parallel line corresponding to the latter record is used as the edge line.
[0036] By adopting the above technical solution, the number of intersecting pixels is compared with the number of intersecting pixels recorded in the previous record. When it is less than a first preset percentage of the number of intersecting pixels recorded in the previous record, the parallel line corresponding to the latter record is used as the edge line. By comparing the numbers of two consecutive intersecting pixels, the change in the number of intersecting pixels can be obtained more accurately. When the change is large, it is considered that the edge of the effective steel pipe area has been reached. In particular, for the case where the edge lines are not parallel, the range of the steel pipe can be determined more accurately.
[0037] Optionally, the determining whether the number of intersecting pixels meets a preset condition, and if so, taking the corresponding parallel lines as edge lines specifically includes:
[0038] Obtain the number of reference pixels where the center line intersects the valid steel pipe area in the pixel classification map;
[0039] It is determined whether the number of intersecting pixels is less than a second preset percentage of the number of reference pixels. If so, the corresponding parallel lines are taken as edge lines.
[0040] By adopting the above technical solution, since the number of reference pixels is the number of intersections between the center line and the effective steel pipe area, the number of reference pixels in each effective steel pipe area is fixed. By comparing the number of intersecting pixels with the number of reference pixels, the position of the edge line can be obtained more stably, and most of the effective steel pipe area can be covered between the two edge lines, and the result is more accurate.
[0041] In a second aspect, the present application provides a steel pipe edge detection device, which adopts the following technical solution:
[0042] A steel pipe edge detection device, comprising:
[0043] An image acquisition module, used to acquire an image to be detected;
[0044] A pixel map generation module is used to input the image to be detected into the trained detection model and generate a pixel classification map marked with steel pipe areas and non-steel pipe areas;
[0045] The pixel map screening module screens the steel pipe area in the pixel classification map to obtain the valid steel pipe area of the pixel classification map;
[0046] The steel pipe edge detection module is used to calculate the center line of the effective steel pipe area in the pixel classification map, and obtain the steel pipe edge line based on the center line of the effective steel pipe area in the pixel classification map.
[0047] By adopting the above technical solution, the image acquisition module is used to collect the image to be detected, the pixel map generation module is used to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas, the pixel map screening module then screens the steel pipe areas to obtain effective steel pipe areas, and the steel pipe edge detection module calculates the center line of the effective steel pipe area. Finally, the edge line of the effective steel pipe area is calculated based on the center line, thereby realizing the detection of the steel pipe edge.
[0048] In a third aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:
[0049] A computer-readable storage medium includes: a computer program stored therein that can be loaded by a processor and execute any one of the methods according to the first aspect.
[0050] In summary, this application has the following beneficial technical effects:
[0051] The image to be detected is input into the trained detection model to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas. Then, the effective steel pipe area is screened out from the steel pipe area, the center line of the effective steel pipe area is calculated, and the edge line of the steel pipe is obtained based on the center line. By calculating the center line and edge line of the effective steel pipe area, the edge line of the steel pipe is obtained, thereby realizing the detection of the steel pipe edge. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 This is a flow chart of a steel pipe edge detection method according to one embodiment of the present application.
[0053] Figure 2 This is a flow chart of screening effective steel pipe areas in one embodiment of the present application.
[0054] Figure 3 This is a flowchart of calculating the center line in one embodiment of the present application.
[0055] Figure 4 This is a flowchart of calculating edge lines in one embodiment of the present application.
[0056] Figure 5 This is a structural block diagram of a steel pipe edge detection device according to one embodiment of the present application.
[0057] Explanation of the accompanying symbols: 1. Image acquisition module; 2. Pixel map generation module; 3. Pixel map screening module; 4. Steel pipe edge detection module. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-5It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0059] During the casting and layout of steel pipes, due to their heavy weight, construction workers should stay away from the steel pipes as much as possible when lifting or moving them, or when the surface temperature of the steel pipes is high after casting and has not yet cooled, to avoid safety hazards. In order to analyze whether construction workers are staying away from the steel pipes in accordance with safety regulations based on monitoring images, when using convolutional neural networks to identify and detect monitoring images, if part of the steel pipe is blocked by other objects, the edge of the steel pipe cannot be determined, and it is even more impossible to detect whether construction workers are staying away from the steel pipe.
[0060] Explanation of terms:
[0061] Morphology: Morphological image processing is an image processing technique that processes image shape features. The basic idea of morphology is to use a special structure element to measure or extract the corresponding shape or features in the input image for further image analysis and target recognition.
[0062] Deeplabv3+: A semantic segmentation network. The semantic segmentation network is mainly used to attribute each pixel in the input image to a class label.
[0063] The embodiment of the present application discloses a steel pipe edge detection method.
[0064] Reference Figure 1 , a steel pipe edge detection method includes:
[0065] Step S101: Acquire an image to be detected;
[0066] Among them, the image to be detected can be obtained in real time from the image acquisition device. The image acquisition device can be set up at the construction site of the steel pipe or the casting workshop of the steel pipe, or it can be set up on a mobile device such as a drone for inspection of the construction site.
[0067] Step S102: Input the image to be detected into the trained detection model to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas;
[0068] The detection model uses the semantic segmentation model of Deeplabv3+, which records the pixel value of the steel pipe area as 1 and the pixel value of the non-steel pipe area as 0;
[0069] Compared with other versions of Deeplab models, the semantic segmentation model of Deeplabv3+ uses a simple and effective decoder module to expand and optimize the segmentation results, especially the segmentation results along the object boundaries. In addition, in the encoder-decoder structure of the semantic segmentation model of Deeplabv3+, the resolution of the extracted encoder features can be arbitrarily controlled through void convolution to compromise accuracy and running time.
[0070] The pixel classification map is a map composed of pixel grids. In the pixel classification map, each pixel grid is marked as a steel pipe pixel or a non-steel pipe pixel. All steel pipe pixels constitute a steel pipe area, and all non-steel pipe pixels constitute a non-steel pipe area.
[0071] Step S103: screening the steel pipe area in the pixel classification map to obtain a valid steel pipe area in the pixel classification map;
[0072] Each valid steel pipe area corresponds to a detected steel pipe, and the number of valid steel pipe areas can be one or more.
[0073] Step S104: calculating the center line of the effective steel pipe area in the pixel classification map;
[0074] Step S105: Calculate the edge line of the steel pipe according to the center line of the effective steel pipe area in the pixel classification map.
[0075] The steel pipe edge line is the boundary line of the effective steel pipe area, and the edge of the steel pipe can be determined by the obtained steel pipe edge line.
[0076] In the above embodiment, the image to be detected is input into the detection model to obtain a pixel classification map, and then the effective steel pipe area is screened out from the steel pipe area in the pixel classification map to make the division of the steel pipe area more accurate, and then the center line of the effective steel pipe area is calculated, and the center line is regarded as the center line of the steel pipe, and then the edge line of the effective area is calculated from the center line, and the edge line is regarded as the edge line of the steel pipe; by further optimizing the results output by the detection model, the edge line of the steel pipe is obtained more accurately, thereby realizing the detection of the edge of the steel pipe.
[0077] It should be noted that the purpose of detecting the edge of the steel pipe in this application is to facilitate the location of the steel pipe by detecting the edge of the steel pipe. For example, when it is necessary to subsequently detect whether construction workers are close to the steel pipe, it is only necessary to detect whether the construction workers are near the edge of the steel pipe. The steel pipe area can be used as a key detection area based on the detected steel pipe position.
[0078] Reference Figure 2 , step S103 specifically includes:
[0079] Step S1031: performing denoising processing on the steel pipe region in the pixel classification map to obtain a first steel pipe region;
[0080] Step S1032: Determine whether the area of the first steel pipe region is greater than a preset area screening threshold. If so, execute step S1033; if not, execute step S1034;
[0081] It should be noted that screening the first steel pipe area by area can exclude steel pipe areas whose sizes are obviously not equal to the actual steel pipe sizes. Therefore, when presetting the area screening threshold, it can be adaptively adjusted according to the actual diameter and length of the steel pipe to be detected.
[0082] Step S1033: determining the first steel pipe area as a valid steel pipe area;
[0083] Step S1034: Determine the first steel pipe area as a non-steel pipe area.
[0084] As an implementation method of performing denoising on the steel pipe area in the pixel classification map, step S1031 specifically includes:
[0085] Perform one or more morphological opening operations on the steel pipe region in the pixel classification image to obtain a second steel pipe region;
[0086] Perform one or more morphological closing operations on the second steel pipe region to obtain a denoised steel pipe region.
[0087] Among them, the morphological opening operation refers to the corrosion operation followed by the expansion operation. The purpose is to separate the connected steel pipe areas when there are multiple steel pipe areas, and at the same time remove isolated points or burrs in the steel pipe areas; the morphological closing operation refers to the expansion operation followed by the corrosion operation, and the purpose is to eliminate some impurities inside the steel pipe area.
[0088] In the above embodiment, the detected steel pipe area is optimized through morphological opening and closing operations to obtain a more accurate first steel pipe area. The first steel pipe area is then screened according to the area to exclude steel pipe areas whose areas are obviously inconsistent with the actual steel pipe size. The screened first steel pipe area is used as the effective steel pipe area, thereby achieving a more accurate screening of the steel pipe area.
[0089] Reference Figure 3 , step S104 specifically includes,
[0090] Step S1041: Divide the valid steel pipe area in the pixel classification map into n sub-valid steel pipe areas;
[0091] Among them, the value of n can be 10, 15 or 20. The larger the value of n, the more accurate the result of calculating the center line, and the smaller the value of n, the faster the calculation speed. Therefore, the value of n can be selected according to actual conditions, taking into account the accuracy of the results and the calculation speed.
[0092] In addition, since the shape of the steel pipes is a long strip, the screened effective steel pipe area is approximately a long strip. When dividing the sub-effective steel pipe area, the vertical distance between the two ends of the effective steel pipe area is obtained, and the sub-effective steel pipe area is divided into n equal parts in the direction of the vertical distance, thereby realizing the division of the sub-effective steel pipe area.
[0093] Step S1042: Obtain the center of each effective sub-steel pipe area;
[0094] Step S1043: performing linear fitting on the centers of the n sub-effective steel pipe areas to obtain the center line of the effective steel pipe area in the pixel classification map.
[0095] Among them, the linear fitting can use the least square method to calculate the regression line of n centers, and the regression line is the center line.
[0096] Referring to the figure, step S105 specifically includes:
[0097] Step S1051: obtaining a preset parallel line having the same slope and length as the center line according to the slope and length of the center line;
[0098] Step S1052: Starting from the center line, parallel lines are translated to both sides of the center line in a direction perpendicular to the center line;
[0099] There are two preset parallel lines, and each parallel line is used to determine an edge line.
[0100] As an implementation method of parallel line translation, the parallel lines are translated equidistantly according to a preset movement distance.
[0101] Step S1053: Each time the translation is performed, the number of intersecting pixels between the parallel line and the valid steel pipe area in the pixel classification map is recorded;
[0102] Among them, the parallel lines pass through the valid steel pipe area and the non-steel pipe area on the pixel classification map, and the number of pixels in the valid steel pipe area passed by the parallel lines is counted, that is, the number of intersecting pixels. Therefore, each movement of the parallel lines corresponds to a set of intersecting pixels.
[0103] Step S1054: Determine whether the number of intersecting pixels meets the preset conditions. If so, execute step S1055.
[0104] Step S1055: Use the corresponding parallel lines as edge lines.
[0105] When the number of intersecting pixels that meets the preset conditions appears, the parallel lines stop translating.
[0106] In the above implementation, the effective steel pipe area is divided into n parts, and the center of each sub-effective steel pipe area is obtained. A linear fit is performed on all the obtained centers to obtain the centerline of the effective steel pipe area, thereby preliminarily locating the position of the steel pipe. Parallel lines are then preset based on the slope and length of the centerline. These parallel lines are then moved perpendicular to the centerline. The number of intersecting pixels is recorded each time the parallel lines move. When the number of intersecting pixels meets the preset conditions, the parallel lines corresponding to this number of intersecting pixels are used as the steel pipe edge lines, thus achieving the effect of steel pipe edge detection.
[0107] As an implementation of step S1054, step S1054 specifically includes:
[0108] It is determined whether the number of intersecting pixels in the latter of two consecutive records is less than a first preset percentage of the number of intersecting pixels in the former record. If so, the parallel line corresponding to the latter record is used as the edge line.
[0109] Among them, the first preset percentage can be set to 65%, 70%, 75% or other percentage values. For example, when the number of intersecting pixels in the latter record is less than 70% of the previous record, the parallel line corresponding to the latter record is used as the edge line.
[0110] In the above embodiment, the number of intersecting pixels is compared with the number of intersecting pixels recorded last time. When it is less than a first preset percentage of the number of intersecting pixels recorded last time, the parallel line corresponding to the latter record is used as the edge line. By comparing the numbers of two consecutive intersecting pixels, the change in the number of intersecting pixels can be obtained more accurately. When the change is large, it is considered that the edge of the effective steel pipe area has been reached. In particular, for the case where the edge lines are not parallel, the range of the steel pipe can be determined more accurately.
[0111] As another implementation of step S1054, step S1054 specifically includes:
[0112] Obtain the number of reference pixels where the center line intersects the valid steel pipe area in the pixel classification map;
[0113] It is determined whether the number of intersecting pixels is less than a second preset percentage of the number of reference pixels. If so, the corresponding parallel lines are taken as edge lines.
[0114] Among them, the second preset percentage can be set to 20%, 25%, 30% or other percentage values. For example, when the number of reference pixels is m and the number of intersecting pixels is less than 0.2m, the parallel lines corresponding to the number of intersecting pixels are considered to be edge lines.
[0115] In the above embodiment, since the number of reference pixels is the number of intersections between the center line and the effective steel pipe area, the number of reference pixels in each effective steel pipe area is fixed. By comparing the number of intersecting pixels with the number of reference pixels, the edge line detection result can be obtained more stably, and most of the effective steel pipe area can be covered between the two edge lines, and the result is more accurate.
[0116] The implementation principle of a steel pipe edge detection method in an embodiment of the present application is as follows: an image to be detected is input into a trained detection model, a pixel classification map marked with steel pipe areas and non-steel pipe areas is generated, and then a valid steel pipe area is screened out from the steel pipe area, the center line of the valid steel pipe area is calculated, and the edge line of the steel pipe is calculated based on the center line, thereby realizing the detection of the steel pipe edge.
[0117] The embodiment of the present application discloses a steel pipe edge detection device.
[0118] Reference Figure 1 , a steel pipe edge detection device comprising:
[0119] Image acquisition module 1, used to acquire the image to be detected;
[0120] The image acquisition module 1 may use a camera to collect construction monitoring images of the steel pipe construction site.
[0121] Pixel map generation module 2, used to input the image to be detected into the trained detection model and generate a pixel classification map marked with steel pipe areas and non-steel pipe areas;
[0122] The pixel map screening module 3 screens the steel pipe area in the pixel classification map to obtain the valid steel pipe area of the pixel classification map;
[0123] The steel pipe edge detection module 4 is used to calculate the center line of the effective steel pipe area in the pixel classification map, and obtain the steel pipe edge line based on the center line of the effective steel pipe area in the pixel classification map.
[0124] Among them, the image acquisition module 1, the pixel map generation module 2, the pixel map screening module 3 and the steel pipe edge detection module 4 are connected in sequence.
[0125] The implementation principle of a steel pipe edge detection device in an embodiment of the present application is as follows: an image acquisition module is used to collect an image to be detected, a pixel map generation module is used to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas, the pixel map screening module then screens the steel pipe areas to obtain effective steel pipe areas, and the steel pipe edge detection module calculates the center line of the effective steel pipe area. Finally, the edge line of the effective steel pipe area is calculated based on the center line, thereby realizing the detection of the steel pipe edge.
[0126] The steel pipe edge detection device of the present application can implement any of the above-mentioned steel pipe edge detection methods, and the specific working process of the steel pipe edge detection device can refer to the corresponding process in the above-mentioned method embodiment.
[0127] It should be noted that, in the above embodiments, the description of each embodiment has different emphases. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] An embodiment of the present application discloses a computer-readable storage medium.
[0129] A computer-readable storage medium stores a computer program that can be loaded by a processor and executed by any one of the above-mentioned steel pipe edge detection methods.
[0130] Among them, the computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in combination with an instruction execution system, apparatus or device; the program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0131] The above are all preferred embodiments of the present application and are not intended to limit the scope of protection of this application. Unless otherwise specified, any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features. In other words, unless otherwise specified, each feature is merely an example of a series of equivalent or similar features.
Claims
1. A steel pipe edge detection method, characterized in that: include: Obtain the image to be detected; Input the image to be detected into the trained detection model to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas; wherein the detection model adopts the semantic segmentation model of Deeplabv3+; Screening the steel pipe area in the pixel classification map to obtain a valid steel pipe area in the pixel classification map; Calculate the center line of the effective steel pipe area in the pixel classification map; Calculate the edge line of the steel pipe according to the center line of the effective steel pipe area in the pixel classification map; The calculation of the center line of the effective steel pipe area in the pixel classification map specifically includes: Dividing the effective steel pipe area in the pixel classification map into n sub-effective steel pipe areas; respectively obtaining the center of each of the effective sub-steel pipe areas; Performing linear fitting on the centers of the n sub-effective steel pipe areas to obtain the center line of the effective steel pipe area in the pixel classification map; The step of calculating the edge line of the steel pipe according to the center line of the effective steel pipe area in the pixel classification map specifically includes: According to the slope and length of the center line, a preset parallel line having the same slope and length as the center line is obtained; Taking the center line as a starting point, the parallel lines are translated to both sides of the center line along a direction perpendicular to the center line; Each time the parallel line is translated once, the number of intersecting pixels of the effective steel pipe area in the pixel classification map is recorded; It is determined whether the number of intersecting pixels meets a preset condition, and if so, the corresponding parallel lines are used as edge lines.
2. A steel pipe edge detection method according to claim 1, characterized in that: The screening of the steel pipe area in the pixel classification map to obtain the valid steel pipe area in the pixel classification map specifically includes: Performing denoising processing on the steel pipe region in the pixel classification map to obtain a first steel pipe region; It is determined whether the area of the first steel pipe region is greater than a preset area screening threshold. If so, the first steel pipe region is determined as the valid steel pipe region; if not, the first steel pipe region is determined as the non-steel pipe region.
3. The steel pipe edge detection method according to claim 2, characterized in that: The denoising process for the steel pipe area in the pixel classification map specifically includes: performing one or more morphological opening operations on the steel pipe region in the pixel classification map to obtain a second steel pipe region; Perform one or more morphological closing operations on the second steel pipe region to obtain the steel pipe region after denoising.
4. A steel pipe edge detection method according to claim 1, characterized in that: The parallel lines are translated equidistantly according to a preset moving distance.
5. The steel pipe edge detection method according to claim 1, characterized in that: The determining whether the number of intersecting pixels meets a preset condition, and if so, taking the corresponding parallel lines as edge lines specifically includes: It is determined whether the number of intersecting pixels in the latter record of two consecutive records is less than a first preset percentage of the number of intersecting pixels in the former record; if so, the parallel line corresponding to the latter record is used as an edge line.
6. The steel pipe edge detection method according to claim 1, characterized in that: The determining whether the number of intersecting pixels meets a preset condition, and if so, taking the corresponding parallel lines as edge lines specifically includes: Obtain the number of reference pixels where the center line intersects the valid steel pipe area in the pixel classification map; It is determined whether the number of the intersecting pixels is less than a second preset percentage of the number of the reference pixels; if so, the corresponding parallel lines are used as edge lines.
7. A steel pipe edge detection device, characterized in that: A method for detecting a steel pipe edge according to any one of claims 1 to 6, comprising: An image acquisition module (1) is used to acquire an image to be detected; A pixel map generation module (2) is used to input the image to be detected into the trained detection model to generate a pixel classification map marked with steel pipe areas and non-steel pipe areas; The pixel map screening module (3) screens the steel pipe area in the pixel classification map to obtain the effective steel pipe area of the pixel classification map; The steel pipe edge detection module (4) is used to calculate the center line of the effective steel pipe area in the pixel classification map, and obtain the steel pipe edge line based on the center line of the effective steel pipe area in the pixel classification map.
8. A computer-readable storage medium, characterized in that: The device comprises a computer program which can be loaded by a processor and executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Quality detection method and device for ring device
CN112435210A
Component connection detection method based on image recognition and data simulation
CN112945107A