WO2023087741A1 - Defect detection method and apparatus, and electronic device, storage medium and computer program product - Google Patents
Defect detection method and apparatus, and electronic device, storage medium and computer program product Download PDFInfo
- Publication number
- WO2023087741A1 WO2023087741A1 PCT/CN2022/104206 CN2022104206W WO2023087741A1 WO 2023087741 A1 WO2023087741 A1 WO 2023087741A1 CN 2022104206 W CN2022104206 W CN 2022104206W WO 2023087741 A1 WO2023087741 A1 WO 2023087741A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- detected
- defect
- defect detection
- detection result
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
- G06T7/0008—Industrial image inspection checking presence/absence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/12—Edge-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/70—Determining position or orientation of objects or cameras
- G06T7/73—Determining position or orientation of objects or cameras using feature-based methods
Definitions
- the embodiment of the present disclosure is based on the Chinese patent application with the application number 202111371813.8, the application date is November 18, 2021, and the application name is "Defect detection method and device, electronic equipment and storage medium", and the priority of the Chinese patent application is required Right, the entire content of this Chinese patent application is hereby incorporated into this disclosure by way of introduction.
- Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a defect detection method and device, electronic equipment, storage media, and computer program products.
- Battery defect detection is an important problem in computer vision and industrial vision inspection.
- Battery defect inspection includes a variety of applications, such as roof weld inspection, sealing nail defect inspection, battery tab deformation defect inspection, and coated surface inspection. Since the structure on the battery is relatively complex and the defects are often small, false detection or missed detection usually occurs during defect detection. At the same time, since the images collected during battery inspection are usually high-resolution industrial images, the amount of calculation in the defect detection process is large and the detection speed is slow.
- Embodiments of the present disclosure propose a defect detection method and device, electronic equipment, storage media, and computer program products, aiming at improving the efficiency of the defect detection process and the accuracy of defect detection results.
- an embodiment of the present disclosure provides a defect detection method, the method comprising:
- An image detection result is determined based on each of the defect detection results.
- an embodiment of the present disclosure provides a defect detection device, the device comprising:
- An area extraction module configured to extract an area to be detected in the image to be detected
- An image division module configured to divide the region to be detected into a plurality of image blocks to be detected
- the defect detection module is configured to perform defect detection on each of the image blocks to be detected, and obtain a defect detection result corresponding to each of the defect detection image blocks, and the defect detection result is used to represent the defects in the corresponding image block to be detected whether there are defects;
- a result determination module configured to determine an image detection result according to each of the defect detection results.
- an embodiment of the present disclosure provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
- an embodiment of the present disclosure provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
- an embodiment of the present disclosure provides a computer program product, including a computer-readable storage medium storing program code, and when instructions included in the program code are executed by a processor of a computer device, the steps in the above method are implemented. .
- the interference region in the image is eliminated by extracting the region to be detected, and the region to be detected is detected, thereby improving the accuracy of defect detection.
- the second aspect by dividing the area to be detected into a plurality of image blocks to be detected, and then obtaining the position information of the image blocks, the location of the defect is realized; in the third aspect, by Defect detection is performed on the detected image blocks, which reduces the missed detection rate and false detection rate; in the fourth aspect, the efficiency of the detection process is improved by performing defect detection on multiple image blocks to be detected in parallel.
- FIG. 1 shows a flowchart of a defect detection method provided by an embodiment of the present disclosure
- FIG. 2 shows a schematic diagram of an image to be detected provided by an embodiment of the present disclosure
- FIG. 3 shows a schematic diagram of extracting a region to be detected provided by an embodiment of the present disclosure
- Fig. 4 shows a schematic flow chart of extracting a region to be detected provided by an embodiment of the present disclosure
- FIG. 5 shows a schematic diagram of determining an image block to be detected provided by an embodiment of the present disclosure
- FIG. 6A shows a schematic diagram of determining an image detection result provided by an embodiment of the present disclosure
- FIG. 6B shows a flow chart of another defect detection method provided by an embodiment of the present disclosure
- FIG. 6C shows a schematic diagram of the process of an image preprocessing method provided by an embodiment of the present disclosure
- FIG. 6D shows a schematic diagram of the process of a model classification method provided by an embodiment of the present disclosure
- FIG. 7 shows a schematic diagram of a defect detection device provided by an embodiment of the present disclosure
- FIG. 8 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure
- Fig. 9 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
- FIG. 1 shows a flowchart of a defect detection method provided by an embodiment of the present disclosure.
- the defect detection method in the embodiment of the present disclosure may be executed by an electronic device such as a terminal device or a server.
- the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA), handheld device, computing device, vehicle-mounted device, Mobile or fixed terminal devices such as wearable devices.
- the terminal device can implement the defect detection method by calling the computer-readable instructions stored in the memory by the processor.
- the defect detection method of the embodiments of the present disclosure can also be executed by a server, and the server can be a single server or a server cluster composed of multiple servers.
- the embodiments of the present disclosure may be applied, for example, to the scene of initial detection of items such as batteries and product packaging shells. When testing the battery, it can also be used for roof weld detection, sealing nail defect detection, battery tab deformation defect detection, and coating surface detection. The embodiments of the present disclosure do not limit the application scenarios of defect detection. .
- a defect detection method provided by an embodiment of the present disclosure may include the following steps:
- Step S10 extracting the region to be detected in the image to be detected.
- the defect detection method in the embodiment of the present disclosure is used to detect a defect of a target object, and the image to be detected is an image obtained by collecting the target object.
- the target audience is different.
- the target object may be a battery, that is, the defect detection method is used to detect the battery.
- the product shell defect detection is performed in the embodiment of the present disclosure
- the target object may be the product shell.
- the content of the image to be detected can also be determined according to the type of defect to be detected. For example, when the defect to be detected is a weld defect of a battery, the image to be detected needs to include the weld of the battery, and the image to be detected may be an image of the battery top cover obtained by collecting the battery top cover.
- the area to be inspected refers to an area that may have defects that need to be inspected.
- the region to be inspected may include a roof weld region in the battery image. Because the image to be detected usually includes not only the region to be detected, but also some interference regions that do not need to be detected. In order to avoid increasing the amount of calculation and increasing the possibility of false detection due to the detection of the interference area that does not need to be detected, the interference area can be excluded by extracting the area to be detected in the image to be detected.
- Fig. 2 shows a schematic diagram of an image to be detected provided by an embodiment of the present disclosure.
- the target object to be detected in the embodiment of the present disclosure is a battery
- the image 20 to be detected is a battery image obtained by collecting a top cover of the battery.
- the image of the battery includes the roof weld area that needs to be detected and may have the weld defect 21 , and other areas where the weld defect 21 may not exist. Therefore, the region to be detected can be obtained by extracting the roof weld region of the image to be detected.
- the embodiments of the present disclosure can obtain the image to be detected by extracting the edge of the image to be detected area.
- Fig. 3 shows a schematic diagram of extracting a region to be detected provided by an embodiment of the present disclosure.
- the image 30 to be detected is an image of the battery top cover, where the weld 31 is located at the edge of the battery top cover.
- the image to be detected 30 also includes the inner area of the battery top cover that is far away from the welding seam 31 .
- the interference area inside the battery top cover can be removed by means of edge extraction, and the welding seam area of the top cover can be obtained as the area 32 to be detected.
- the region to be detected may be obtained by performing binarization processing and maximum contour extraction on the image to be detected. That is to say, the image to be detected may be binarized first by using a preset threshold parameter (for example, the threshold parameter may be 50), so as to highlight contour edges in the image to be detected.
- a contour extraction function such as findContours is used to extract the maximum contour, remove regions other than the extracted maximum contour, and retain the extracted maximum contour region as the region to be detected.
- the collected image to be detected may have problems such as deformation
- other processing processes such as size conversion may also be added before extracting the region to be detected.
- the image to be detected can be resized by dimension transformation method to restore its original size.
- Fig. 4 shows a schematic flow chart of extracting a region to be detected provided by an embodiment of the present disclosure.
- the process of determining the area to be processed by image processing can be to first perform size transformation 41 on the image to be detected 40 through a dimension transformation method (for example, the height of the image to be detected to be collected is elongated by 5 times, and the width does not change, then The height of the image to be processed can be reduced by 1/5 through the dimension transformation method, and the width remains unchanged to obtain the image to be detected after the size transformation); after obtaining the image to be detected after the size transformation, the preset threshold parameter Perform binarization 42 on the size-changed image to be detected to highlight the contour edge to obtain the maximum contour; finally remove the interference area of the non-detected region in the to-be-detected image 40 by means of maximum contour extraction 43 to obtain the to-be-detected region 44 .
- a dimension transformation method for example, the height of the image to be detected to be collected is elongated by 5 times, and the width does not change, then The height of the image to be processed can be reduced by 1/5 through the dimension transformation method, and the width remains
- Step S20 dividing the region to be detected into a plurality of image blocks to be detected.
- the region to be detected is divided to obtain multiple image blocks to be detected, and then defect detection is performed on each image block to be detected to improve detection efficiency.
- the manner of dividing the region to be detected may be, for example, dividing the region to be inspected evenly into a preset number of regions with the same size as image blocks to be detected.
- a plurality of image blocks to be detected may be determined by sliding on the region to be detected through a preset sliding window, and the width of the sliding window is the same as the width of the region to be detected.
- the width of the sliding window may be the width of the rectangle.
- the width of the sliding window may be the width of the ring.
- the preset sliding step size and the sliding window with the same width as the area to be detected can be used to specify the position in the upper left corner, lower right corner, etc. of the area to be detected Start to slide to the preset direction with the sliding step as the unit, and each sliding process determines an image block to be detected.
- there is an undetermined area after the last sliding that is, when the length of the remaining area is less than the length of the sliding window, it can be directly determined that this area is also an image block to be detected.
- the manner of detecting the region is not limited.
- Fig. 5 shows a schematic diagram of determining an image block to be detected provided by an embodiment of the present disclosure.
- the width of the region to be detected 50 can be set as the width of the sliding window according to the width of the sliding window is the same as the width of the region to be detected 50, starting from the upper left corner in a clockwise direction slide. After each sliding, determine the area inside the current sliding window as an image block to be detected 51 , and determine the coordinates of the central point of the image block to be detected as the coordinates of the image block to be detected.
- the coordinates of the upper left corner of the area to be detected can be defined as (0,0), and the coordinates of the center point of the image block to be detected can be determined according to the size of the sliding window and the sliding step, and then the image to be detected can be obtained
- the coordinates of the block for example, the coordinates of the central point of the image block to be detected are (40, 50), then the coordinates of the image block to be detected are (40, 50).
- by dividing the area to be detected into multiple image blocks it is convenient to obtain the position information corresponding to the defect classification result obtained after the classification processing after the image classification processing is performed on the image block to be detected.
- Step S30 performing defect detection on each of the image blocks to be detected, and obtaining a defect detection result corresponding to each of the image blocks to be detected.
- each defect detection result is used to represent whether there is a defect of the target object in the corresponding image block to be detected.
- the defect detection result is used to indicate whether there is a battery weld defect in the corresponding image block to be detected.
- the manner of performing defect detection on the image block to be detected may be: for example, the defect detection may be performed by means of image processing, or the defect detection may also be performed by using a trained defect detection model.
- the image processing method may be to determine a standard image block, that is, a standard image block with the same position as the image block to be detected in an image without defects, and obtain a defect detection result by comparing the difference between the standard image block and the image block to be detected.
- each image block to be detected may be input into the defect detection model, and a corresponding defect detection result may be output.
- the defect detection result of the image block to be detected may include a position attribute, at least one defect category, and a confidence level of each defect category.
- the position attribute is used to represent the position of the image block to be detected corresponding to the defect detection result in the image to be detected
- the defect category is used to represent the possible defect types in the image block to be detected
- the confidence level represents the corresponding The probability of a defect class defect.
- the defect detection result obtained from the detection includes at least one weld defect category and the corresponding confidence level, as well as the location attribute.
- the position attribute is used to characterize the position of the corresponding image block to be detected in the battery image, and the confidence degree is used to characterize the probability of welding seam defects including the corresponding defect category in the figure, wherein the position attribute can be the to-be-detected position obtained after step S20 The coordinates of the image block.
- the embodiment of the present disclosure detects the obtained image block to be detected by extracting the region to be detected and dividing the region to be detected, so that the defect detection process of an image to be detected with a relatively large resolution can be converted into a defect detection process for multiple resolutions.
- the process of performing defect detection on smaller image blocks to be detected reduces the calculation amount of the defect detection process.
- the detection process of each image block to be detected can also be executed in parallel, thereby increasing the detection speed.
- Step S40 determining an image detection result according to each defect detection result.
- the image detection result of the image to be detected may be determined according to each defect detection result.
- the image detection result may be determined by determining the image confidence level according to the confidence level of each defect category, and then determining the defect detection result whose image confidence level is greater than the first threshold as the image detection result.
- Image confidence is used to characterize the possibility of defects in the image to be detected.
- the image detection result is used to indicate whether there is a defect of the target object in the image to be detected. For example, when the image to be detected is an image of the battery top cover, the image detection result is used to indicate whether there is a weld defect of the top cover in the image to be detected.
- the image detection result indicates that there is a defect in the image to be detected, it may also include the type of defect and the position information of the defect.
- FIG. 6A shows a schematic diagram of determining an image detection result provided by an embodiment of the present disclosure.
- the image detection result 63 is determined according to N defect detection results (including defect detection result 1, defect detection result 2 . . . defect detection result N) 62 corresponding to N image blocks 60 to be detected.
- the image detection result 63 may be determined based on the defect category and confidence included in each defect detection result 62 .
- the process of determining the image confidence of the corresponding image block to be detected according to each defect detection result may be: determine the confidence of the target defect category as the target confidence, and may respond to the target confidence being less than
- the second threshold is to determine the image confidence level according to the confidence level of each defect category other than the target defect category, or determine that the image confidence level is 0 in response to the target confidence level being not less than the second threshold value. That is, when there is a defect that needs to be ignored, the defect category of the defect is set as the target defect category.
- the target defect category can be set according to actual application scenarios.
- the starting point position is often misrecognized as a defect during the detection of weld defects on the battery top cover, so the starting point can be set as the target defect category, so that when the defect type is detected as the starting point Ignore the defect detection result and determine the image confidence as 0.
- the manner of determining the image confidence level according to the confidence level of each defect category except the target defect category may be to calculate the sum of the confidence levels of each defect category to obtain the image confidence level.
- the confidence of each defect category can also be input into a logistic regression function (softmax function) to obtain the image confidence.
- the confidence of each defect category can be input into the softamx function and then summed to obtain the image confidence representing the possibility of defects in the image to be detected.
- the target defect category that is likely to cause false detection results is preset, and the image confidence is determined according to the confidence of the target defect category.
- the above method can reduce the frequency of false detection results and improve the accuracy of the finally obtained image detection results.
- the image detection result is determined according to the defect detection results whose image confidence is greater than a first threshold.
- the defect detection result whose image confidence is greater than the first threshold is the target detection result, and the defect category with the highest confidence in the target detection result is determined as the target category.
- the position attribute and Object classes determine image detection results.
- the target category is screened according to the confidence of each defect category in the target detection result, and finally an image detection result including multiple position attributes and target categories corresponding to each position attribute is obtained.
- the image confidence indicates the possibility of defects in the image to be detected, and the greater the image confidence, the higher the possibility of defects.
- the image confidence is not greater than the first threshold, it can be directly determined that the image detection result is no defect.
- the interference region in the image is eliminated by extracting the region to be detected, and the region to be detected is detected, thereby improving the accuracy of defect detection.
- the second aspect by dividing the area to be detected into a plurality of image blocks to be detected, and then obtaining the position information of the image blocks, the location of the defect is realized; in the third aspect, by Defect detection is performed on the detected image blocks, which reduces the missed detection rate and false detection rate; in the fourth aspect, the efficiency of the detection process is improved by performing defect detection on multiple image blocks to be detected in parallel.
- the embodiment of the present disclosure also provides a defect detection method, which is applied to the defect detection of the battery welding position, as shown in FIG. 6B , the method includes the following steps:
- Step 201 Obtain the original image of the battery sample (that is, the image to be detected);
- Step 202 Perform image preprocessing on the original image of the battery sample, wherein, as shown in Figure 6C, the input of step 202 is the original image of the battery sample 301, and the output is the image block to be detected (image block to be detected) 302 of the weld seam and the corresponding The location coordinates of (that is, the location attribute).
- step 202 includes:
- the implementation of locating the ROI by means of edge extraction may include:
- the size of the image block to be detected is selected as 1500x1500, and the step size is 700.
- Step 203 Use the network model to classify the image blocks to be detected.
- the implementation of step 203 may include the following steps 2031 and 2032:
- Step 2031 labeling the extracted image block set to be detected with a category label, for example, labeling can be done manually;
- Step 2032 As shown in FIG. 6D , input the image block set 401 to be detected as a training set into the ResNet18 network 402 for training.
- the key parameters used in training the ResNet18 network model are as follows:
- Loss and weight Cross-entropy loss is used, where the weight of the classification type pinhole and starting point is 1.1, and the weight of other classification types is 1; here, the weight of each type can be set according to the degree of detection and importance.
- Input size 250x250.
- Step 204 Result output (that is, the defect detection result).
- the input of step 204 is the set of image blocks to be detected extracted in step 202 and the category labels manually marked in step 203, and the output is the category and confidence level of each image block to be detected.
- the detection frame 403 is an output result, and the output result includes the category, confidence level and location information of the image block to be detected, wherein the location information can be obtained through step 202 .
- Step 205 Outputting the category and position of the image block to be detected for defects (ie the image detection result).
- the input of step 205 is the category, position and confidence level of each image block to be detected, and the output is the category and position of the image block to be detected containing defects screened by the threshold.
- the implementation of step 205 includes the following steps 2051 and 2052:
- Step 2051 According to the confidence of all the image blocks to be detected, filter out the image blocks to be detected that contain defects (the starting point is non-defective, which is divided into one category separately), wherein:
- the starting point (that is, the target defect category) and the non-defective category are not output (a total of seven categories, five types of defects after removing the starting point and the non-defective category), only the image blocks to be detected containing defects need to be output.
- Confidence degree of defect the confidence degree of the defect in the image block to be detected (that is, the image confidence degree), which is the normalized function of the image block to be detected corresponding to each category output by the model. For example: after softmax, five types of defects The sum of the probabilities, the confidence threshold range of the defect-containing image block to be detected is ⁇ 0.6-0.7 (ie, the first threshold), that is, when the calculated sum of the probabilities of the five types of defects is greater than or equal to the threshold range, It is considered that the image block to be detected contains defects.
- Confidence of the starting point the confidence that the image block to be detected is the starting point, which is the confidence of the starting point category after the scores of the corresponding categories of the image block to be detected output by the model are normalized by a function such as softmax.
- the confidence of the starting point category is less than 0.1
- the confidence that the image block to be detected is the starting point is less than 0.1 (that is, the second threshold)
- the image block to be detected is considered not to be Starting point: when the confidence degree of the starting point category is greater than or equal to 0.1, the image block to be detected is considered as the starting point, and the confidence degree of determining that the image block to be detected contains defects is 0. Since the starting point position is often misidentified as a defect, the defect detection result is ignored when the defect category is detected as the starting point, thereby reducing the probability of misjudgment.
- Step 2052 Output the category and position coordinates of the image block containing defects to be detected.
- the embodiments of the present disclosure also provide a defect detection device, electronic equipment, computer-readable storage media, and computer program products, all of which can be used to implement any defect detection method provided by the embodiments of the present disclosure, corresponding technical solutions and The description can be found in the corresponding notes in the Methods section.
- FIG. 7 shows a schematic diagram of a defect detection device provided by an embodiment of the present disclosure.
- the device includes an area extraction module 70 , an image division module 71 , a defect detection module 72 and a result determination module 73 .
- the area extraction module 70 is configured to extract the area to be detected in the image to be detected
- the image division module 71 is configured to divide the region to be detected into a plurality of image blocks to be detected;
- the defect detection module 72 is configured to perform defect detection on each of the image blocks to be detected, and obtain a defect detection result corresponding to each of the defect detection image blocks, and the defect detection result is used to represent the corresponding image block to be detected whether there are defects in
- the result determination module 73 is configured to determine an image detection result according to each of the defect detection results.
- the region extraction module 70 includes:
- the edge extraction sub-module is configured to perform edge extraction on the image to be detected to obtain a region to be detected.
- the edge extraction submodule includes:
- the region extraction unit is configured to obtain the region to be detected by performing binarization processing and maximum contour extraction on the image to be detected.
- the image division module 71 includes:
- the sliding division sub-module is configured to determine a plurality of image blocks to be detected by sliding on the region to be detected through a preset sliding window, and the width of the sliding window is the same as the width of the region to be detected.
- the defect detection result includes a position attribute and a defect category
- the position attribute is used to characterize the position of the image block to be detected corresponding to the defect detection result in the image to be detected.
- the defect detection result further includes the confidence level of each defect category
- the result determination module 73 includes:
- a confidence degree determination submodule configured to determine an image confidence degree according to the confidence degree of each of the defect categories, the image confidence degree being configured to characterize the possibility of a defect in the image to be detected;
- the detection result determining sub-module is configured to determine the image detection result according to the defect detection result whose image confidence is greater than a first threshold.
- the confidence determination submodule includes:
- the first confidence degree determination unit is configured to determine the confidence degree of the target defect category as the target confidence degree
- the second confidence level determination unit is configured to determine the image confidence level by at least one of the following: in response to the target confidence level being less than a second threshold, according to each of the defect categories other than the target defect category The confidence level determines the image confidence level; in response to the target confidence level being not less than a second threshold, it is determined that the image confidence level is 0.
- the detection result determining submodule includes:
- the first result determining unit is configured to determine the defect detection result whose image confidence is greater than the first threshold as the target detection result
- a category screening unit configured to determine the defect category with the highest confidence in the target detection result as the target category
- the second result determining unit is configured to determine the image detection result according to the position attribute and the target category in each of the target detection results.
- the defect detection device is used to detect a battery
- the image to be inspected includes a battery image
- the area to be inspected includes a top cover weld area in the battery image.
- the functions or modules included in the apparatus provided by the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments, and the implementation manner may refer to the descriptions of the above method embodiments.
- Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned method is implemented when the computer program instructions are executed by a processor.
- Computer readable storage media may be volatile or nonvolatile computer readable storage media.
- An embodiment of the present disclosure also proposes an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
- An embodiment of the present disclosure also provides a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device When running in the electronic device, the processor in the electronic device executes the above method.
- Electronic devices may be provided as terminals, servers, or other forms of devices.
- FIG. 8 shows a schematic diagram of an electronic device 800 according to an embodiment of the present disclosure.
- the electronic device 800 may be a terminal such as a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, or a personal digital assistant.
- electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and a communication component 816 .
- the processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations.
- the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
- the memory 804 is configured to store various types of data to support operations at the electronic device 800 . Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like.
- the memory 804 can be realized by any type of volatile or non-volatile storage device or their combination, such as Static Random-Access Memory (Static Random-Access Memory, SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically -Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-only Memory (PROM), Read-Only Memory (Read- only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
- Static Random-Access Memory SRAM
- Electrically Erasable Programmable Read-Only Memory Electrically Erasable Programmable Read-Only Memory (Electrically -Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read
- the power supply component 806 provides power to various components of the electronic device 800 .
- Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
- the multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user.
- the screen may include a liquid crystal display (Liquid Crystal Display, LCD) and a touch panel (Touch Panel, TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
- the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action.
- the multimedia component 808 includes at least one of the following: a front camera; a rear camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, at least one of the front camera and the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
- the audio component 810 is configured to be at least one of the following: outputting, inputting an audio signal.
- the audio component 810 includes a microphone (Microphone, MIC), and when the electronic device 800 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode, the microphone is configured to receive an external audio signal. Received audio signals may be stored in memory 804 or transmitted by communication component 816 .
- the audio component 810 also includes a speaker for outputting audio signals.
- the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
- Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 .
- the sensor component 814 can detect the open/closed state of the electronic device 800, the relative positioning of components, such as the display and the keypad of the electronic device 800, the sensor component 814 can also detect the electronic device 800 or a Changes in position of components, presence or absence of user contact with electronic device 800 , electronic device 800 orientation or acceleration/deceleration and temperature changes in electronic device 800 .
- Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
- the sensor assembly 814 may also include an optical sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge-Coupled Device (CCD) image sensor, for use in imaging applications.
- CMOS Complementary Metal Oxide Semiconductor
- CCD Charge-Coupled Device
- the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
- the communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
- the electronic device 800 can access a wireless network based on a communication standard, such as a wireless network (WiFi), a second generation mobile communication technology (2G) or a third generation mobile communication technology (3G), or a combination thereof.
- a communication standard such as a wireless network (WiFi), a second generation mobile communication technology (2G) or a third generation mobile communication technology (3G), or a combination thereof.
- the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
- the communication component 816 also includes a Near Field Communication (NFC) module to facilitate short-range communication.
- NFC Near Field Communication
- the NFC module can be based on Radio Frequency Identification (RFID) technology, Infrared Data Association (Infrared Data Association, IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BlueTooth, BT) technology and other technology to achieve.
- RFID Radio Frequency Identification
- IrDA Infrared Data Association
- UWB Ultra Wide Band
- Bluetooth Bluetooth, BT
- the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (Application Specific Integrated Circuit, ASIC), Digital Signal Processor (Digital Signal Processor, DSP), Digital Signal Processing Device (Digital Signal Process Device , DSPD), Programmable Logic Device (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), controller, microcontroller, microprocessor or other electronic components for implementation the above method.
- ASIC Application Specific Integrated Circuits
- DSP Digital Signal Processor
- DSPD Digital Signal Processing Device
- PLD Programmable Logic Device
- Field-Programmable Gate Array Field-Programmable Gate Array
- FPGA Field-Programmable Gate Array
- a non-volatile computer-readable storage medium such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to implement the above method.
- FIG. 9 shows a schematic diagram of an electronic device 1900 provided by an embodiment of the present disclosure.
- electronic device 1900 may be a server.
- electronic device 1900 includes processing component 1922 , which includes one or more processors, and memory resources represented by memory 1932 for storing instructions executable by processing component 1922 , such as application programs.
- the application program stored in the memory 1932 may include one or more modules, wherein each module corresponds to a set of instructions.
- the processing component 1922 is configured to execute instructions to perform the above method.
- Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input-output (I/O) Interface 1958.
- the electronic device 1900 can operate based on the operating system stored in the memory 1932, such as the Microsoft server operating system (Windows Server TM ), the operating system based on the graphical user interface (Mac OS X TM ) introduced by Apple Inc., multi-user multi-process computer operation system (Unix TM ), a free and open-source Unix-like operating system (Linux TM ), an open-source Unix-like operating system (FreeBSD TM ), or the like.
- Microsoft server operating system Windows Server TM
- Mac OS X TM graphical user interface
- Unix TM free and open-source Unix-like operating system
- FreeBSD TM open-source Unix-like operating system
- a non-transitory computer-readable storage medium such as the memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to implement the above method.
- An embodiment of the present disclosure may be a computer program product.
- a computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of embodiments of the present disclosure.
- a computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device.
- a computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
- Computer-readable storage media include: portable computer disk, hard disk, Random Access Memory (RAM), ROM, EPROM, SRAM, portable compact disk read-only memory ( Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD), memory stick, floppy disk, mechanically encoded devices such as punched cards or raised structures in grooves on which instructions are stored , and any suitable combination of the above.
- Computer-readable storage media as used herein is not to be interpreted as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., pulses of light through fiber optic cables), or transmitted electrical signals.
- the computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over at least one of a network, such as the Internet, a local area network, a wide area network, and a wireless network.
- the network may include at least one of copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and edge servers.
- a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
- Computer program instructions for performing operations of embodiments of the present disclosure may be assembly instructions, instruction set architecture (Instruction Set Architecture, ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or in the form of a or any combination of programming languages, including object-oriented programming languages—such as Smalltalk, C++, etc., and conventional procedural programming languages—such as “C” or similar programming languages language.
- Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
- the remote computer can be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer such as use an Internet service provider to connect via the Internet).
- LAN Local Area Network
- WAN Wide Area Network
- the electronic circuits can execute computer-readable Read program instructions, thereby implementing various aspects of the present disclosure.
- These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing a device for realizing the functions/actions specified in one or more blocks of at least one of the flowchart and the block diagram.
- These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause at least one of computers, programmable data processing devices and other devices to work in a specific way, so that the computer-readable medium storing the instructions
- An article of manufacture is then included, which includes instructions for implementing various aspects of the functions/actions specified in one or more blocks of at least one of the flowcharts and block diagrams.
- each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block of at least one of the block diagrams and flowcharts, and combinations of blocks of at least one of the block diagrams and flowcharts may be implemented with dedicated hardware-based devices that perform specified functions or actions. system, or it may be implemented by a combination of special purpose hardware and computer instructions.
- the computer program product can be specifically realized by means of hardware, software or a combination thereof.
- the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.
- the products applying the disclosed technical solution have clearly notified the personal information processing rules and obtained the individual's independent consent before processing personal information.
- the disclosed technical solution involves sensitive personal information the products applying the disclosed technical solution have obtained individual consent before processing sensitive personal information, and at the same time meet the requirement of "express consent". For example, at a personal information collection device such as a camera, a clear and prominent sign is set up to inform that it has entered the scope of personal information collection, and personal information will be collected.
- the personal information processing rules may include Information processor, purpose of personal information processing, processing method, type of personal information processed and other information.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The present disclosure relates to a defect detection method and apparatus, and an electronic device, a storage medium and a computer program product. The method comprises: extracting an area to be subjected to detection from an image to be subjected to detection; dividing said area into a plurality of image blocks to be subjected to detection; respectively performing defect detection on each of said image blocks, so as to obtain a corresponding defect detection result, which is used for representing whether there is a defect in the corresponding one of said image blocks; and finally, determining an image detection result on the basis of each defect detection result. By means of the embodiments of the present disclosure, during defect detection, an interference area in an image is removed by means of extracting an area to be subjected to detection, and an area requiring detection is detected, thereby improving the precision of the defect detection. Moreover, the defect detection is performed in parallel by means of dividing the area to be subjected to detection into a plurality of image blocks to be subjected to detection, thereby improving the efficiency of a detection process.
Description
相关申请的交叉引用Cross References to Related Applications
本公开实施例基于申请号为202111371813.8、申请日为2021年11月18日、申请名称为“缺陷检测方法及装置、电子设备和存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本公开。The embodiment of the present disclosure is based on the Chinese patent application with the application number 202111371813.8, the application date is November 18, 2021, and the application name is "Defect detection method and device, electronic equipment and storage medium", and the priority of the Chinese patent application is required Right, the entire content of this Chinese patent application is hereby incorporated into this disclosure by way of introduction.
本公开实施例涉及计算机技术领域,尤其涉及一种缺陷检测方法及装置、电子设备、存储介质及计算机程序产品。Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a defect detection method and device, electronic equipment, storage media, and computer program products.
电池缺陷检测是计算机视觉以及工业视觉检测的重要问题。电池缺陷检测包括多种应用,例如顶盖焊缝检测,密封钉缺陷检测,电池极耳形变缺陷检测以及涂布表面检测等。由于电池上的结构比较复杂且缺陷往往较小,在缺陷检测时通常会发生误检或者漏检的情况。同时,由于电池检测时采集的图像通常为分辨率较高的工业图像,缺陷检测过程中计算量较大,检测速度较慢。Battery defect detection is an important problem in computer vision and industrial vision inspection. Battery defect inspection includes a variety of applications, such as roof weld inspection, sealing nail defect inspection, battery tab deformation defect inspection, and coated surface inspection. Since the structure on the battery is relatively complex and the defects are often small, false detection or missed detection usually occurs during defect detection. At the same time, since the images collected during battery inspection are usually high-resolution industrial images, the amount of calculation in the defect detection process is large and the detection speed is slow.
发明内容Contents of the invention
本公开实施例提出了一种缺陷检测方法及装置、电子设备、存储介质及计算机程序产品,旨在提高缺陷检测过程的效率,以及缺陷检测结果的准确程度。Embodiments of the present disclosure propose a defect detection method and device, electronic equipment, storage media, and computer program products, aiming at improving the efficiency of the defect detection process and the accuracy of defect detection results.
第一方面,本公开实施例提供了一种缺陷检测方法,所述方法包括:In a first aspect, an embodiment of the present disclosure provides a defect detection method, the method comprising:
提取待检测图像中的待检测区域;Extract the region to be detected in the image to be detected;
将所述待检测区域划分为多个待检测图像块;dividing the region to be detected into a plurality of image blocks to be detected;
对每个所述待检测图像块分别进行缺陷检测,得到每个所述待检测图像块对应的缺陷检测结果,所述缺陷检测结果用于表征对应的待检测图像块中是否存在缺陷;performing defect detection on each of the image blocks to be detected, to obtain a defect detection result corresponding to each of the image blocks to be detected, and the defect detection results are used to indicate whether there is a defect in the corresponding image block to be detected;
根据每个所述缺陷检测结果确定图像检测结果。An image detection result is determined based on each of the defect detection results.
第二方面,本公开实施例提供了一种缺陷检测装置,所述装置包括:In a second aspect, an embodiment of the present disclosure provides a defect detection device, the device comprising:
区域提取模块,配置为提取待检测图像中的待检测区域;An area extraction module configured to extract an area to be detected in the image to be detected;
图像划分模块,配置为将所述待检测区域划分为多个待检测图像块;An image division module configured to divide the region to be detected into a plurality of image blocks to be detected;
缺陷检测模块,配置为对每个所述待检测图像块分别进行缺陷检测,得到每个所述缺陷检测图像块对应的缺陷检测结果,所述缺陷检测结果用于表征对应的待检测图像块中是否存在缺陷;The defect detection module is configured to perform defect detection on each of the image blocks to be detected, and obtain a defect detection result corresponding to each of the defect detection image blocks, and the defect detection result is used to represent the defects in the corresponding image block to be detected whether there are defects;
结果确定模块,配置为根据每个所述缺陷检测结果确定图像检测结果。A result determination module configured to determine an image detection result according to each of the defect detection results.
第三方面,本公开实施例提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
第四方面,本公开实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
第五方面,本公开实施例提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现上述方法中的步骤。In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer-readable storage medium storing program code, and when instructions included in the program code are executed by a processor of a computer device, the steps in the above method are implemented. .
本公开实施例在进行缺陷检测时,第一方面,通过提取待检测区域的方式将图像中干扰区域剔除,对需要检测的区域进行检测,提高了缺陷检测的精度。第二方面,通过 将待检测区域分割为多个待检测图像块,进而获取图像块的位置信息,实现了对缺陷的定位;第三方面,通过对多个待检测图像块中的每个待检测图像块进行缺陷检测,降低了漏检率和误检率;第四方面,通过对多个待检测图像块并行进行缺陷检测,提高了检测过程的效率。In the embodiment of the present disclosure, when performing defect detection, firstly, the interference region in the image is eliminated by extracting the region to be detected, and the region to be detected is detected, thereby improving the accuracy of defect detection. In the second aspect, by dividing the area to be detected into a plurality of image blocks to be detected, and then obtaining the position information of the image blocks, the location of the defect is realized; in the third aspect, by Defect detection is performed on the detected image blocks, which reduces the missed detection rate and false detection rate; in the fourth aspect, the efficiency of the detection process is improved by performing defect detection on multiple image blocks to be detected in parallel.
应当理解的是,以上的一般描述和后文的细节描述是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory in nature and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings.
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings here are incorporated into the description and constitute a part of the present description. These drawings show embodiments consistent with the present disclosure, and are used together with the description to explain the technical solution of the present disclosure.
图1示出本公开实施例提供的一种缺陷检测方法的流程图;FIG. 1 shows a flowchart of a defect detection method provided by an embodiment of the present disclosure;
图2示出本公开实施例提供的一种待检测图像的示意图;FIG. 2 shows a schematic diagram of an image to be detected provided by an embodiment of the present disclosure;
图3示出本公开实施例提供的一种提取待检测区域的示意图;FIG. 3 shows a schematic diagram of extracting a region to be detected provided by an embodiment of the present disclosure;
图4示出本公开实施例提供的一种提取待检测区域的流程示意图;Fig. 4 shows a schematic flow chart of extracting a region to be detected provided by an embodiment of the present disclosure;
图5示出本公开实施例提供的一种确定待检测图像块的示意图;FIG. 5 shows a schematic diagram of determining an image block to be detected provided by an embodiment of the present disclosure;
图6A示出本公开实施例提供的一种确定图像检测结果的示意图;FIG. 6A shows a schematic diagram of determining an image detection result provided by an embodiment of the present disclosure;
图6B示出本公开实施例提供的另一种缺陷检测方法的流程图;FIG. 6B shows a flow chart of another defect detection method provided by an embodiment of the present disclosure;
图6C示出本公开实施例提供的一种图像预处理方法的过程示意图;FIG. 6C shows a schematic diagram of the process of an image preprocessing method provided by an embodiment of the present disclosure;
图6D示出本公开实施例提供的一种模型分类方法的过程示意图;FIG. 6D shows a schematic diagram of the process of a model classification method provided by an embodiment of the present disclosure;
图7示出本公开实施例提供的一种缺陷检测装置的示意图;FIG. 7 shows a schematic diagram of a defect detection device provided by an embodiment of the present disclosure;
图8示出本公开实施例提供的一种电子设备的示意图;FIG. 8 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure;
图9示出本公开实施例提供的一种电子设备的示意图。Fig. 9 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures indicate functionally identical or similar elements. While various aspects of the embodiments are shown in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as superior or better than other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist simultaneously, and there exists alone B these three situations. In addition, the term "at least one" herein means any one of a variety or any combination of at least two of the more, for example, including at least one of A, B, and C, which may mean including from A, Any one or more elements selected from the set formed by B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific implementation manners. It will be understood by those skilled in the art that the present disclosure may be practiced without some of the specific details. In some instances, methods, means, components and circuits that are well known to those skilled in the art have not been described in detail so as to obscure the gist of the present disclosure.
图1示出本公开实施例提供的一种缺陷检测方法的流程图。在一种可能的实现方式中,本公开实施例的缺陷检测方法可以通过终端设备或服务器等电子设备执行。其中,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等移动或固定的终端设备。终端设备可以通过处理器调用存储器中存储的计算机可读指令的方式来实现缺陷检测方法。在一些实施例中,还可以通过服务器执行本公开实施例的缺陷检测方法,该服务器可以为单独服务器或者多个服务器组成 的服务器集群。FIG. 1 shows a flowchart of a defect detection method provided by an embodiment of the present disclosure. In a possible implementation manner, the defect detection method in the embodiment of the present disclosure may be executed by an electronic device such as a terminal device or a server. Wherein, the terminal device may be user equipment (User Equipment, UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA), handheld device, computing device, vehicle-mounted device, Mobile or fixed terminal devices such as wearable devices. The terminal device can implement the defect detection method by calling the computer-readable instructions stored in the memory by the processor. In some embodiments, the defect detection method of the embodiments of the present disclosure can also be executed by a server, and the server can be a single server or a server cluster composed of multiple servers.
本公开实施例可以应用于例如对电池、产品包装外壳等物品进行初始检测的场景。在对电池进行检测时,还可以用于进行顶盖焊缝检测,密封钉缺陷检测,电池极耳形变缺陷检测以及涂布表面检测等检测,本公开实施例对缺陷检测的应用场景不做限定。The embodiments of the present disclosure may be applied, for example, to the scene of initial detection of items such as batteries and product packaging shells. When testing the battery, it can also be used for roof weld detection, sealing nail defect detection, battery tab deformation defect detection, and coating surface detection. The embodiments of the present disclosure do not limit the application scenarios of defect detection. .
如图1所示,本公开实施例提供的一种缺陷检测方法可以包括以下步骤:As shown in Figure 1, a defect detection method provided by an embodiment of the present disclosure may include the following steps:
步骤S10、提取待检测图像中的待检测区域。Step S10, extracting the region to be detected in the image to be detected.
在一种可能的实现方式中,本公开实施例的缺陷检测方法用于检测目标对象的缺陷,待检测图像为采集目标对象得到的图像。在不同的应用场景下,目标对象不同。例如,在本公开实施例进行电池缺陷检测时,目标对象可以为电池,即缺陷检测方法用于检测电池。在本公开实施例进行产品外壳缺陷检测时,目标对象可以为产品外壳。在一些实施例中,待检测图像的内容还可以根据需要检测的缺陷类型确定。例如,在需要检测的缺陷为电池的焊缝缺陷时,待检测图像中需要包括电池的焊缝,待检测图像可以为采集电池顶盖得到的电池顶盖图像。In a possible implementation manner, the defect detection method in the embodiment of the present disclosure is used to detect a defect of a target object, and the image to be detected is an image obtained by collecting the target object. In different application scenarios, the target audience is different. For example, when performing battery defect detection in the embodiment of the present disclosure, the target object may be a battery, that is, the defect detection method is used to detect the battery. When the product shell defect detection is performed in the embodiment of the present disclosure, the target object may be the product shell. In some embodiments, the content of the image to be detected can also be determined according to the type of defect to be detected. For example, when the defect to be detected is a weld defect of a battery, the image to be detected needs to include the weld of the battery, and the image to be detected may be an image of the battery top cover obtained by collecting the battery top cover.
待检测区域指可能存在缺陷需要检测的区域。在一些实施例中,待检测区域可以包括电池图像中的顶盖焊缝区域。由于待检测图像中通常包括除了需要检测的区域以外,还包括部分不需要检测的干扰区域。为避免因对不需要检测的干扰区域进行检测增加计算量,以及增大误检可能性,可以通过提取待检测图像中的待检测区域排除干扰区域。The area to be inspected refers to an area that may have defects that need to be inspected. In some embodiments, the region to be inspected may include a roof weld region in the battery image. Because the image to be detected usually includes not only the region to be detected, but also some interference regions that do not need to be detected. In order to avoid increasing the amount of calculation and increasing the possibility of false detection due to the detection of the interference area that does not need to be detected, the interference area can be excluded by extracting the area to be detected in the image to be detected.
图2示出本公开实施例提供的一种待检测图像的示意图。如图2所示,在对电池的焊缝缺陷进行检测的应用场景下,本公开实施例需要检测的目标对象为电池,待检测图像20为采集电池顶盖得到的电池图像。电池图像中包括需要进行检测的,且可能存在焊缝缺陷21的顶盖焊缝区域,以及不可能存在焊缝缺陷21的其他区域。因此,可以通过提取待检测图像的顶盖焊缝区域得到待检测区域。Fig. 2 shows a schematic diagram of an image to be detected provided by an embodiment of the present disclosure. As shown in FIG. 2 , in the application scenario of detecting a weld defect of a battery, the target object to be detected in the embodiment of the present disclosure is a battery, and the image 20 to be detected is a battery image obtained by collecting a top cover of the battery. The image of the battery includes the roof weld area that needs to be detected and may have the weld defect 21 , and other areas where the weld defect 21 may not exist. Therefore, the region to be detected can be obtained by extracting the roof weld region of the image to be detected.
在一种可能的实现方式中,由于电池的焊缝所在的区域位于电池的顶盖边缘,在对电池的焊缝进行缺陷检测时,本公开实施例可以通过对待检测图像进行边缘提取得到待检测区域。In a possible implementation, since the area where the weld seam of the battery is located is located at the edge of the top cover of the battery, when performing defect detection on the weld seam of the battery, the embodiments of the present disclosure can obtain the image to be detected by extracting the edge of the image to be detected area.
图3示出本公开实施例提供的一种提取待检测区域的示意图。如图3所示,待检测图像30为电池顶盖图像,其中焊缝31位于电池顶盖的边缘。在一些实施例中,待检测图像30中还包括距离焊缝31较远的电池顶盖内部区域。为了避免电池顶盖内部区域影响检测效率以及干扰检测结果,可以通过边缘提取的方式去除电池顶盖内部的干扰区域,获取顶盖焊缝区域作为待检测区域32。Fig. 3 shows a schematic diagram of extracting a region to be detected provided by an embodiment of the present disclosure. As shown in FIG. 3 , the image 30 to be detected is an image of the battery top cover, where the weld 31 is located at the edge of the battery top cover. In some embodiments, the image to be detected 30 also includes the inner area of the battery top cover that is far away from the welding seam 31 . In order to prevent the internal area of the battery top cover from affecting the detection efficiency and interfering with the detection results, the interference area inside the battery top cover can be removed by means of edge extraction, and the welding seam area of the top cover can be obtained as the area 32 to be detected.
在一种可能的实现方式中,可以通过对待检测图像进行二值化处理以及最大轮廓提取得到待检测区域。也就是说,可以先通过预设的阈值参数(例如,阈值参数可以为50)对待检测图像进行二值化处理,以突出待检测图像中的轮廓边缘。在一些实施例中,再通过轮廓跟踪(findContours)等轮廓提取函数进行最大轮廓提取,去除提取到的最大轮廓以外的区域,并保留提取到的最大轮廓区域作为待检测区域。In a possible implementation manner, the region to be detected may be obtained by performing binarization processing and maximum contour extraction on the image to be detected. That is to say, the image to be detected may be binarized first by using a preset threshold parameter (for example, the threshold parameter may be 50), so as to highlight contour edges in the image to be detected. In some embodiments, a contour extraction function such as findContours is used to extract the maximum contour, remove regions other than the extracted maximum contour, and retain the extracted maximum contour region as the region to be detected.
在一些实施例中,由于采集的待检测图像可能存在变形等问题,为了提高图像的处理效果,还可以在提取待检测区域之前加入尺寸变换等其他处理过程。例如,在采集的待检测图像存在变形问题的情况下,在对待处理图像进行二值化处理之前,可以先通过维度变换方法对待检测图像进行尺寸变换,使其恢复原始尺寸。图4示出本公开实施例提供的一种提取待检测区域的流程示意图。如图4所示,通过图像处理确定待处理区域的过程可以为通过维度变换方法先对待检测图像40进行尺寸变换41(例如采集的待检测图像的高度被拉长5倍,宽度没变,则可以通过维度变换方法将采集的待处理图像的高度缩小1/5,宽度不变,得到变换尺寸后的待检测图像);在得到变换尺寸后的待检测图像之后,再通过预设的阈值参数对变换尺寸后的待检测图像进行二值化处理42以突出轮廓边缘, 得到最大轮廓;最终通过最大轮廓提取43的方式去除待检测图像40中非检测区域的干扰区域,得到待检测区域44。In some embodiments, since the collected image to be detected may have problems such as deformation, in order to improve the image processing effect, other processing processes such as size conversion may also be added before extracting the region to be detected. For example, if there is a deformation problem in the collected image to be detected, before binarizing the image to be processed, the image to be detected can be resized by dimension transformation method to restore its original size. Fig. 4 shows a schematic flow chart of extracting a region to be detected provided by an embodiment of the present disclosure. As shown in Figure 4, the process of determining the area to be processed by image processing can be to first perform size transformation 41 on the image to be detected 40 through a dimension transformation method (for example, the height of the image to be detected to be collected is elongated by 5 times, and the width does not change, then The height of the image to be processed can be reduced by 1/5 through the dimension transformation method, and the width remains unchanged to obtain the image to be detected after the size transformation); after obtaining the image to be detected after the size transformation, the preset threshold parameter Perform binarization 42 on the size-changed image to be detected to highlight the contour edge to obtain the maximum contour; finally remove the interference area of the non-detected region in the to-be-detected image 40 by means of maximum contour extraction 43 to obtain the to-be-detected region 44 .
步骤S20、将所述待检测区域划分为多个待检测图像块。Step S20, dividing the region to be detected into a plurality of image blocks to be detected.
在一种可能的实现方式中,提取待检测图像中的待检测区域后,划分待检测区域得到多个待检测图像块,然后分别对每个待检测图像块进行缺陷检测,提高检测效率。在一些实施例中,划分待检测区域的方式可以为例如将待检查区域平均划分为预设数量个尺寸相同的区域作为待检测图像块。或者,还可以为通过预设的滑动窗在待检测区域上滑动确定多个待检测图像块,滑动窗的宽度与待检测区域的宽度相同。其中,当待检测区域为长方形时,滑动窗的宽度可以为长方形的宽度。当待检测区域为长方环形时,滑动窗的宽度可以为环形的宽度。In a possible implementation manner, after the region to be detected in the image to be detected is extracted, the region to be detected is divided to obtain multiple image blocks to be detected, and then defect detection is performed on each image block to be detected to improve detection efficiency. In some embodiments, the manner of dividing the region to be detected may be, for example, dividing the region to be inspected evenly into a preset number of regions with the same size as image blocks to be detected. Alternatively, a plurality of image blocks to be detected may be determined by sliding on the region to be detected through a preset sliding window, and the width of the sliding window is the same as the width of the region to be detected. Wherein, when the region to be detected is a rectangle, the width of the sliding window may be the width of the rectangle. When the area to be detected is a rectangular ring, the width of the sliding window may be the width of the ring.
也就是说,在一种可能的实现方式中,确定待检测区域后可以通过预设的滑动步长和与待检测区域宽度相同的滑动窗,在待检测区域的左上角、右下角等指定位置开始以滑动步长为单位向预设方向滑动,每一次滑动过程确定一个待检测图像块。在一些实施例中,在最后一次滑动结束后还有未被确定区域,即剩余区域的长度小于滑动窗长度时,可以直接确定该区域也为一个待检测图像块,本公开实施例对划分待检测区域的方式不做限定。That is to say, in a possible implementation, after the area to be detected is determined, the preset sliding step size and the sliding window with the same width as the area to be detected can be used to specify the position in the upper left corner, lower right corner, etc. of the area to be detected Start to slide to the preset direction with the sliding step as the unit, and each sliding process determines an image block to be detected. In some embodiments, there is an undetermined area after the last sliding, that is, when the length of the remaining area is less than the length of the sliding window, it can be directly determined that this area is also an image block to be detected. The manner of detecting the region is not limited.
图5示出本公开实施例提供的一种确定待检测图像块的示意图。如图5所示,对于待检测区域50,可以根据滑动窗的宽度与待检测区域50的宽度相同,将待检测区域50的宽度设置为滑动窗的宽度,从左上角开始沿顺时针方向依次滑动。在每一次滑动后,确定当前滑动窗内部的区域为一个待检测图像块51,并将该待检测图像块的中心点坐标确定为该待检测图像块的坐标。在一些实施例中,可以将待检测区域左上角点的坐标定义为(0,0),根据滑动窗的大小和滑动步长确定出待检测图像块的中心点坐标,进而得出待检测图像块的坐标,例如待检测图像块的中心点坐标为(40,50),则该待检测图像块的坐标为(40,50)。本公开实施例中,通过将待检测区域分割为多个图像块,可以方便在将该待检测图像块进行图像分类处理之后,获取分类处理之后得到的缺陷分类结果对应的位置信息。Fig. 5 shows a schematic diagram of determining an image block to be detected provided by an embodiment of the present disclosure. As shown in Figure 5, for the region to be detected 50, the width of the region to be detected 50 can be set as the width of the sliding window according to the width of the sliding window is the same as the width of the region to be detected 50, starting from the upper left corner in a clockwise direction slide. After each sliding, determine the area inside the current sliding window as an image block to be detected 51 , and determine the coordinates of the central point of the image block to be detected as the coordinates of the image block to be detected. In some embodiments, the coordinates of the upper left corner of the area to be detected can be defined as (0,0), and the coordinates of the center point of the image block to be detected can be determined according to the size of the sliding window and the sliding step, and then the image to be detected can be obtained The coordinates of the block, for example, the coordinates of the central point of the image block to be detected are (40, 50), then the coordinates of the image block to be detected are (40, 50). In the embodiment of the present disclosure, by dividing the area to be detected into multiple image blocks, it is convenient to obtain the position information corresponding to the defect classification result obtained after the classification processing after the image classification processing is performed on the image block to be detected.
步骤S30、对每个所述待检测图像块分别进行缺陷检测,得到每个所述待检测图像块对应的缺陷检测结果。Step S30 , performing defect detection on each of the image blocks to be detected, and obtaining a defect detection result corresponding to each of the image blocks to be detected.
在一种可能的实现方式中,确定待检测图像中至少一个可能存在缺陷的待检测图像块后,分别对每个待检测图像块进行缺陷检测,得到每一个待检测图像块的缺陷检测结果。其中,每个缺陷检测结果用于表征对应的待检测图像块中是否存在目标对象的缺陷。例如,当本公开实施例用于进行检测电池焊缝缺陷时,缺陷检测结果用于表征对应的待检测图像块中是否存在电池的焊缝缺陷。In a possible implementation manner, after determining at least one image block to be detected that may have a defect in the image to be detected, defect detection is performed on each image block to be detected to obtain a defect detection result of each image block to be detected. Wherein, each defect detection result is used to represent whether there is a defect of the target object in the corresponding image block to be detected. For example, when the embodiment of the present disclosure is used to detect a battery weld defect, the defect detection result is used to indicate whether there is a battery weld defect in the corresponding image block to be detected.
在一些实施例中,对待检测图像块进行缺陷检测的方式可以为:例如,可以通过图像处理的方式进行缺陷检测,或者还可以通过训练得到的缺陷检测模型进行缺陷检测。其中,图像处理的方式可以为确定标准图像块,即没有缺陷的图像中与待检测图像块位置相同的标准图像块,通过对比标准图像块和待检测图像块的差异得到缺陷检测结果。在通过训练得到的缺陷检测模型进行缺陷检测时,可以将每个待检测图像块分别输入缺陷检测模型中,输出对应的缺陷检测结果。In some embodiments, the manner of performing defect detection on the image block to be detected may be: for example, the defect detection may be performed by means of image processing, or the defect detection may also be performed by using a trained defect detection model. Wherein, the image processing method may be to determine a standard image block, that is, a standard image block with the same position as the image block to be detected in an image without defects, and obtain a defect detection result by comparing the difference between the standard image block and the image block to be detected. When performing defect detection through the defect detection model obtained through training, each image block to be detected may be input into the defect detection model, and a corresponding defect detection result may be output.
在一种可能的实现方式中,待检测图像块的缺陷检测结果中可以包括位置属性和至少一个缺陷类别,以及每个缺陷类别的置信度。其中,位置属性用于表征缺陷检测结果对应的待检测图像块在待检测图像中的位置,缺陷类别用于表征待检测图像块中可能存在的缺陷种类,置信度表征待检测图像块中包括对应缺陷类别缺陷的可能性。例如,当待检测图像为电池图像,用于检测电池顶盖焊缝缺陷时,检测得到的缺陷检测结果中包 括至少一个焊缝缺陷类别和对应的置信度,以及位置属性。位置属性用于表征对应的待检测图像块在电池图像中的位置,置信度用于表征图中包括对应缺陷类别的焊缝缺陷的概率,其中,位置属性可以为经过步骤S20之后得到的待检测图像块的坐标。In a possible implementation manner, the defect detection result of the image block to be detected may include a position attribute, at least one defect category, and a confidence level of each defect category. Among them, the position attribute is used to represent the position of the image block to be detected corresponding to the defect detection result in the image to be detected, the defect category is used to represent the possible defect types in the image block to be detected, and the confidence level represents the corresponding The probability of a defect class defect. For example, when the image to be detected is a battery image and is used to detect the weld defect of the battery top cover, the defect detection result obtained from the detection includes at least one weld defect category and the corresponding confidence level, as well as the location attribute. The position attribute is used to characterize the position of the corresponding image block to be detected in the battery image, and the confidence degree is used to characterize the probability of welding seam defects including the corresponding defect category in the figure, wherein the position attribute can be the to-be-detected position obtained after step S20 The coordinates of the image block.
本公开实施例通过提取待检测区域以及分割待检测区域,对得到的待检测图像块进行检测的方式,使得对一个分辨率较大的待检测图像的缺陷检测过程,转换为对多个分辨率较小的待检测图像块进行缺陷检测的过程,减小了缺陷检测过程的计算量。在一些实施例中,每一个待检测图像块的检测过程还可以并行执行,从而提高检测速度。The embodiment of the present disclosure detects the obtained image block to be detected by extracting the region to be detected and dividing the region to be detected, so that the defect detection process of an image to be detected with a relatively large resolution can be converted into a defect detection process for multiple resolutions. The process of performing defect detection on smaller image blocks to be detected reduces the calculation amount of the defect detection process. In some embodiments, the detection process of each image block to be detected can also be executed in parallel, thereby increasing the detection speed.
步骤S40、根据每个所述缺陷检测结果确定图像检测结果。Step S40, determining an image detection result according to each defect detection result.
在一种可能的实现方式中,可以在确定每个待检测图像块对应的缺陷检测结果后,根据每个缺陷检测结果确定待检测图像的图像检测结果。在一些实施例中,图像检测结果的确定方式可以为根据每个缺陷类别的置信度确定图像置信度,再将图像置信度大于第一阈值的缺陷检测结果确定为图像检测结果。图像置信度用于表征待检测图像中存在缺陷的可能性。图像检测结果用于表征待检测图像中是否存在目标对象的缺陷,例如,当待检测图像为电池顶盖的图像时,图像检测结果用于表征待检测图像中是否存在顶盖焊缝缺陷。在一些实施例中,在图像检测结果表征待检测图像中存在缺陷时,还可以包括存在的缺陷类别和缺陷的位置信息。In a possible implementation manner, after determining the defect detection result corresponding to each image block to be detected, the image detection result of the image to be detected may be determined according to each defect detection result. In some embodiments, the image detection result may be determined by determining the image confidence level according to the confidence level of each defect category, and then determining the defect detection result whose image confidence level is greater than the first threshold as the image detection result. Image confidence is used to characterize the possibility of defects in the image to be detected. The image detection result is used to indicate whether there is a defect of the target object in the image to be detected. For example, when the image to be detected is an image of the battery top cover, the image detection result is used to indicate whether there is a weld defect of the top cover in the image to be detected. In some embodiments, when the image detection result indicates that there is a defect in the image to be detected, it may also include the type of defect and the position information of the defect.
图6A示出本公开实施例提供的一种确定图像检测结果的示意图。如图6A所示,在一种可能的实现方式中,在确定待检测图像中的N个待检测图像块(包括待检测图像块1、待检测图像块2……待检测图像块N)60后,通过检测模型61分别对每个待检测图像块60进行缺陷检测,得到每个待检测图像块60对应的缺陷检测结果。在一些实施例中,再根据N个待检测图像块60对应的N个缺陷检测结果(包括缺陷检测结果1、缺陷检测结果2……缺陷检测结果N)62确定图像检测结果63。其中,图像检测结果63可以基于每个缺陷检测结果62中包括的缺陷类别和置信度确定。FIG. 6A shows a schematic diagram of determining an image detection result provided by an embodiment of the present disclosure. As shown in FIG. 6A, in a possible implementation, after determining the N image blocks to be detected (including the image block to be detected 1, the image block to be detected 2...the image block to be detected N) 60 Afterwards, defect detection is performed on each image block 60 to be detected through the detection model 61 , and a defect detection result corresponding to each image block 60 to be detected is obtained. In some embodiments, the image detection result 63 is determined according to N defect detection results (including defect detection result 1, defect detection result 2 . . . defect detection result N) 62 corresponding to N image blocks 60 to be detected. Wherein, the image detection result 63 may be determined based on the defect category and confidence included in each defect detection result 62 .
在一种可能的实现方式中,根据每个缺陷检测结果确定对应的待检测图像块的图像置信度的过程可以为:确定目标缺陷类别的置信度为目标置信度,可以响应于目标置信度小于第二阈值,根据目标缺陷类别以外的每个缺陷类别的置信度确定图像置信度,或者响应于目标置信度不小于第二阈值,确定图像置信度为0。也就是说,当存在一种需要被忽略的缺陷时,设定该缺陷的缺陷类别为目标缺陷类别。在目标缺陷类别的置信度小于预先设定的第二阈值时,认为对应的待检测图像块具有的缺陷是该目标缺陷类别的概率较小,因此可以根据目标缺陷类别以外的每个缺陷类别的置信度确定图像置信度。在目标缺陷类别的置信度不小于预先设定的第二阈值时,认为对应的待检测图像块具有的缺陷是该目标缺陷类别的概率较大,因此需要忽略该缺陷检测结果,直接确定图像置信度为0。在一些实施例中,该目标缺陷类别可以根据实际应用场景设定。例如,在进行电池顶盖焊缝缺陷检测时起始点位置经常被误识别为缺陷,因此可以设定起始点为目标缺陷类别,以在进行焊缝缺陷检测时,检测到缺陷类别为起始点时忽略该缺陷检测结果,确定图像置信度为0。In a possible implementation manner, the process of determining the image confidence of the corresponding image block to be detected according to each defect detection result may be: determine the confidence of the target defect category as the target confidence, and may respond to the target confidence being less than The second threshold is to determine the image confidence level according to the confidence level of each defect category other than the target defect category, or determine that the image confidence level is 0 in response to the target confidence level being not less than the second threshold value. That is, when there is a defect that needs to be ignored, the defect category of the defect is set as the target defect category. When the confidence of the target defect category is less than the preset second threshold, it is considered that the corresponding defect in the image block to be detected has a small probability of the target defect category, so it can be based on the Confidence determines the image confidence. When the confidence degree of the target defect category is not less than the preset second threshold, it is considered that the defect of the corresponding image block to be detected has a higher probability of the target defect category, so it is necessary to ignore the defect detection result and directly determine the image confidence degree is 0. In some embodiments, the target defect category can be set according to actual application scenarios. For example, the starting point position is often misrecognized as a defect during the detection of weld defects on the battery top cover, so the starting point can be set as the target defect category, so that when the defect type is detected as the starting point Ignore the defect detection result and determine the image confidence as 0.
在一些实施例中,根据除了目标缺陷类别以外的每个缺陷类别置信度确定图像置信度的方式可以为计算各缺陷类别置信度的和,得到图像置信度。或者,还可以将各缺陷类别置信度输入逻辑回归函数(softmax函数),得到图像置信度。例如,可以将每个缺陷类别置信度分别输入softamx函数后求和,得到表征待检测图像中存在缺陷可能性的图像置信度。In some embodiments, the manner of determining the image confidence level according to the confidence level of each defect category except the target defect category may be to calculate the sum of the confidence levels of each defect category to obtain the image confidence level. Alternatively, the confidence of each defect category can also be input into a logistic regression function (softmax function) to obtain the image confidence. For example, the confidence of each defect category can be input into the softamx function and then summed to obtain the image confidence representing the possibility of defects in the image to be detected.
本公开实施例在确定图像置信度时,通过预先设定表征容易产生误检结果的目标缺陷类别,并根据该目标缺陷类别的置信度确定图像置信度。上述方式能够降低误检结果发生的频率,提高最终得到的图像检测结果的准确度。In the embodiments of the present disclosure, when determining the image confidence, the target defect category that is likely to cause false detection results is preset, and the image confidence is determined according to the confidence of the target defect category. The above method can reduce the frequency of false detection results and improve the accuracy of the finally obtained image detection results.
在一种可能的实现方式中,在确定每个待检测图像块的图像置信度后,根据图像置信度大于第一阈值的缺陷检测结果确定图像检测结果。在一些实施例中,可以确定图像置信度大于第一阈值的缺陷检测结果为目标检测结果,确定目标检测结果中置信度最大的缺陷类别为目标类别,根据每个目标检测结果中的位置属性和目标类别确定图像检测结果。其中,目标类别可以为一个或多个,即根据置信度由小到大的顺序对缺陷类别排序后,获取前N个缺陷类别作为目标类别。也就是说,根据目标检测结果中各缺陷类别的置信度筛选得到目标类别,最终得到包括多个位置属性和各位置属性对应的目标类别的图像检测结果。在一些实施例中,图像置信度表征待检测图像中存在缺陷的可能性,图像置信度越大则存在缺陷的可能性越高。在图像置信度不大于第一阈值时,可以直接确定图像检测结果为无缺陷。In a possible implementation manner, after determining the image confidence of each image block to be detected, the image detection result is determined according to the defect detection results whose image confidence is greater than a first threshold. In some embodiments, it may be determined that the defect detection result whose image confidence is greater than the first threshold is the target detection result, and the defect category with the highest confidence in the target detection result is determined as the target category. According to the position attribute and Object classes determine image detection results. Wherein, there may be one or more target categories, that is, after the defect categories are sorted in descending order of confidence, the top N defect categories are obtained as target categories. That is to say, the target category is screened according to the confidence of each defect category in the target detection result, and finally an image detection result including multiple position attributes and target categories corresponding to each position attribute is obtained. In some embodiments, the image confidence indicates the possibility of defects in the image to be detected, and the greater the image confidence, the higher the possibility of defects. When the image confidence is not greater than the first threshold, it can be directly determined that the image detection result is no defect.
本公开实施例在进行缺陷检测时,第一方面,通过提取待检测区域的方式将图像中干扰区域剔除,对需要检测的区域进行检测,提高了缺陷检测的精度。第二方面,通过将待检测区域分割为多个待检测图像块,进而获取图像块的位置信息,实现了对缺陷的定位;第三方面,通过对多个待检测图像块中的每个待检测图像块进行缺陷检测,降低了漏检率和误检率;第四方面,通过对多个待检测图像块并行进行缺陷检测,提高了检测过程的效率。In the embodiment of the present disclosure, when performing defect detection, firstly, the interference region in the image is eliminated by extracting the region to be detected, and the region to be detected is detected, thereby improving the accuracy of defect detection. In the second aspect, by dividing the area to be detected into a plurality of image blocks to be detected, and then obtaining the position information of the image blocks, the location of the defect is realized; in the third aspect, by Defect detection is performed on the detected image blocks, which reduces the missed detection rate and false detection rate; in the fourth aspect, the efficiency of the detection process is improved by performing defect detection on multiple image blocks to be detected in parallel.
本公开实施例还提供一种缺陷检测方法,应用于电池焊接位置的缺陷检测,如图6B所示,所述方法包括如下步骤:The embodiment of the present disclosure also provides a defect detection method, which is applied to the defect detection of the battery welding position, as shown in FIG. 6B , the method includes the following steps:
步骤201:获取电池样本原图(即所述待检测图像);Step 201: Obtain the original image of the battery sample (that is, the image to be detected);
步骤202:对电池样本原图进行图像预处理,其中,如图6C所示,步骤202的输入为电池样本原图301,输出为焊缝的待检测图像块(待检测图像块)302和对应的位置坐标(即所述位置属性)。Step 202: Perform image preprocessing on the original image of the battery sample, wherein, as shown in Figure 6C, the input of step 202 is the original image of the battery sample 301, and the output is the image block to be detected (image block to be detected) 302 of the weld seam and the corresponding The location coordinates of (that is, the location attribute).
在一些实施例中,步骤202的实施包括:In some embodiments, the implementation of step 202 includes:
首先:对电池样本原图进行焊缝边缘检测:由于感兴趣(Region Of Interest,ROI)区域(即待检测区域)为电池焊缝,而电池焊缝是电池的边缘区域,因此,可以通过边缘提取的方法定位ROI。在一些实施例中,通过边缘提取的方法定位ROI的实施可以包括:First: detect the edge of the weld seam on the original image of the battery sample: since the region of interest (Region Of Interest, ROI) (that is, the area to be detected) is the battery weld seam, and the battery seam is the edge area of the battery, therefore, it can pass the edge The extracted method locates the ROI. In some embodiments, the implementation of locating the ROI by means of edge extraction may include:
一、对电池样本原图进行图像尺寸变换,将电池样本原图的高度变为原来的1/5,宽度不变(由于电池样本原图采样时,为了加快速度,进行跳帧采样,在高度上有一些损失,为了还原原图,将电池样本原图的高度变为原来的1/5)。1. Transform the image size of the original image of the battery sample, change the height of the original image of the battery sample to 1/5 of the original, and keep the width unchanged (due to the sampling of the original image of the battery sample, in order to speed up the sampling, frame skipping sampling is performed, at the height There is some loss on the image, in order to restore the original image, the height of the original image of the battery sample is changed to 1/5 of the original).
二、对尺寸变换后的电池样本原图进行二值化处理,设置阈值参数为50。2. Binarize the original image of the battery sample after size transformation, and set the threshold parameter to 50.
三、对二值化处理之后的电池样本原图中的焊缝进行最大轮廓提取,得到如图6C所示的轮廓线303;通过findContours函数,确定焊缝一圈的边缘掩膜图(即所述待检测区域),从而得到ROI。3. Extract the maximum contour of the weld seam in the original image of the battery sample after binarization processing, and obtain the contour line 303 as shown in FIG. The area to be detected) to obtain the ROI.
其次:沿着边缘掩膜图,在原亮度图上以滑动窗口(即所述滑动窗)的方式等步长(即所述滑动步长)剪切焊缝,得到焊缝的待检测图像块,并保留每个待检测图像块的位置坐标(即所述位置属性),生成待检测图像块集合和对应的位置坐标列表。其中,待检测图像块的尺寸选用1500x1500,步长为700。Secondly: cut the weld seam along the edge mask map on the original brightness map with equal steps (i.e. the sliding step length) in the form of a sliding window (i.e. the sliding window), to obtain the image block to be detected of the welding seam, And retain the position coordinates (that is, the position attribute) of each image block to be detected, and generate a set of image blocks to be detected and a list of corresponding position coordinates. Among them, the size of the image block to be detected is selected as 1500x1500, and the step size is 700.
步骤203:采用网络模型对待检测图像块进行分类处理。步骤203的实施可以包括如下步骤2031和步骤2032:Step 203: Use the network model to classify the image blocks to be detected. The implementation of step 203 may include the following steps 2031 and 2032:
步骤2031:为提取得到的待检测图像块集合标注类别标签,例如可以采用人工的方式进行标注;Step 2031: labeling the extracted image block set to be detected with a category label, for example, labeling can be done manually;
步骤2032:如图6D所示,将待检测图像块集合401作为训练集输入到ResNet18网络402中进行训练。Step 2032: As shown in FIG. 6D , input the image block set 401 to be detected as a training set into the ResNet18 network 402 for training.
其中,训练ResNet18网络模型时采用的关键参数如下:Among them, the key parameters used in training the ResNet18 network model are as follows:
优化器:选用随机梯度下降法(Stochastic Gradient Descent,SGD),其中,学习率lr=0.001,momentum=0.9,权重衰减weight_decay=0.0005;Optimizer: use Stochastic Gradient Descent (SGD), where learning rate lr=0.001, momentum=0.9, weight decay weight_decay=0.0005;
调度器(Scheduler):采用等间隔调整学习率StepLR,其中,学习率下降间隔数step_size=16,学习率调整倍数gamma=0.9;Scheduler (Scheduler): Use equal intervals to adjust the learning rate StepLR, where the number of learning rate drop intervals step_size=16, learning rate adjustment multiple gamma=0.9;
损失与权重:采用交叉熵损失,其中,分类类型为针孔和起始点的权重为1.1,其他分类类型的权重为1;这里,可以根据检出度和重要性设置每一类型的权重。Loss and weight: Cross-entropy loss is used, where the weight of the classification type pinhole and starting point is 1.1, and the weight of other classification types is 1; here, the weight of each type can be set according to the degree of detection and importance.
输入尺寸:250x250。Input size: 250x250.
步骤204:结果输出(即所述缺陷检测结果)。其中,步骤204的输入为步骤202提取得到的待检测图像块集合以及步骤203人工标注的类别标签,输出为每一待检测图像块的类别与置信度。如图6D所示,检测框403为输出的结果,输出的结果包括待检测图像块的类别、置信度和位置信息,其中,位置信息可通过步骤202获取。Step 204: Result output (that is, the defect detection result). Wherein, the input of step 204 is the set of image blocks to be detected extracted in step 202 and the category labels manually marked in step 203, and the output is the category and confidence level of each image block to be detected. As shown in FIG. 6D , the detection frame 403 is an output result, and the output result includes the category, confidence level and location information of the image block to be detected, wherein the location information can be obtained through step 202 .
步骤205:输出缺陷待检测图像块的类别与位置(即所述图像检测结果)。其中,步骤205的输入为每一待检测图像块的类别、位置和置信度,输出为经阈值筛选的含缺陷的待检测图像块的类别和位置。步骤205的实施包括如下步骤2051和步骤2052:Step 205: Outputting the category and position of the image block to be detected for defects (ie the image detection result). Wherein, the input of step 205 is the category, position and confidence level of each image block to be detected, and the output is the category and position of the image block to be detected containing defects screened by the threshold. The implementation of step 205 includes the following steps 2051 and 2052:
步骤2051:根据所有待检测图像块的置信度筛选出含有缺陷的待检测图像块(起始点为非缺陷,单独划分为一类),其中:Step 2051: According to the confidence of all the image blocks to be detected, filter out the image blocks to be detected that contain defects (the starting point is non-defective, which is divided into one category separately), wherein:
1)起始点(即所述目标缺陷类别)和无缺陷类别不输出(共七种类别,除去起始点和无缺陷两类之后为五类缺陷),只有含缺陷的待检测图像块需要输出。1) The starting point (that is, the target defect category) and the non-defective category are not output (a total of seven categories, five types of defects after removing the starting point and the non-defective category), only the image blocks to be detected containing defects need to be output.
2)缺陷置信度:该待检测图像块含缺陷的置信度(即所述图像置信度),是模型输出的待检测图像块对应各类别得分经归一化函数例如:softmax后,五类缺陷的概率之和,该待检测图像块含缺陷的置信度阈值范围为≥0.6-0.7(即所述第一阈值),即计算得到的五类缺陷的概率之和大于等于阈值范围的情况下,认为该待检测图像块含缺陷。2) Confidence degree of defect: the confidence degree of the defect in the image block to be detected (that is, the image confidence degree), which is the normalized function of the image block to be detected corresponding to each category output by the model. For example: after softmax, five types of defects The sum of the probabilities, the confidence threshold range of the defect-containing image block to be detected is ≥0.6-0.7 (ie, the first threshold), that is, when the calculated sum of the probabilities of the five types of defects is greater than or equal to the threshold range, It is considered that the image block to be detected contains defects.
3)起始点置信度:该待检测图像块为起始点的置信度,是模型输出的待检测图像块对应各类别得分经归一化函数例如:softmax后,起始点类别的置信度。在一些实施例中,在起始点类别的置信度小于0.1的情况下,该待检测图像块为起始点的置信度小于0.1(即所述第二阈值),则认为该待检测图像块不为起始点;在起始点类别的置信度大于等于0.1的情况下,认为该待检测图像块为起始点,确定该待检测图像块含缺陷的置信度为0。由于起始点位置经常被误识别为缺陷,因此在检测到缺陷类别为起始点时忽略该缺陷检测结果,从而降低误判的概率。3) Confidence of the starting point: the confidence that the image block to be detected is the starting point, which is the confidence of the starting point category after the scores of the corresponding categories of the image block to be detected output by the model are normalized by a function such as softmax. In some embodiments, when the confidence of the starting point category is less than 0.1, the confidence that the image block to be detected is the starting point is less than 0.1 (that is, the second threshold), and the image block to be detected is considered not to be Starting point: when the confidence degree of the starting point category is greater than or equal to 0.1, the image block to be detected is considered as the starting point, and the confidence degree of determining that the image block to be detected contains defects is 0. Since the starting point position is often misidentified as a defect, the defect detection result is ignored when the defect category is detected as the starting point, thereby reducing the probability of misjudgment.
步骤2052:输出含有缺陷的待检测图像块的类别和位置坐标。Step 2052: Output the category and position coordinates of the image block containing defects to be detected.
可以理解的是,本公开实施例提及的上述各个方法,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的执行顺序应当以其功能和可能的内在逻辑确定。It can be understood that the above-mentioned methods mentioned in the embodiments of the present disclosure can be combined with each other to form a combined embodiment without violating the principle and logic. Those skilled in the art can understand that, in the above method in the specific implementation manner, the execution sequence of each step should be determined by its function and possible internal logic.
需要说明的是,上文对各个实施例的描述倾向于强调各个实施例之间的不同之处,其相同或相似之处可以互相参考。It should be noted that the above descriptions of the various embodiments tend to emphasize the differences between the various embodiments, and the same or similar points can refer to each other.
此外,本公开实施例还提供了一种缺陷检测装置、电子设备、计算机可读存储介质、计算机程序产品,上述均可用来实现本公开实施例提供的任一种缺陷检测方法,相应技术方案和描述可参见方法部分的相应记载。In addition, the embodiments of the present disclosure also provide a defect detection device, electronic equipment, computer-readable storage media, and computer program products, all of which can be used to implement any defect detection method provided by the embodiments of the present disclosure, corresponding technical solutions and The description can be found in the corresponding notes in the Methods section.
图7示出本公开实施例提供的一种缺陷检测装置的示意图,如图7所示,所述装置包括区域提取模块70、图像划分模块71、缺陷检测模块72和结果确定模块73。FIG. 7 shows a schematic diagram of a defect detection device provided by an embodiment of the present disclosure. As shown in FIG. 7 , the device includes an area extraction module 70 , an image division module 71 , a defect detection module 72 and a result determination module 73 .
区域提取模块70,配置为提取待检测图像中的待检测区域;The area extraction module 70 is configured to extract the area to be detected in the image to be detected;
图像划分模块71,配置为将所述待检测区域划分为多个待检测图像块;The image division module 71 is configured to divide the region to be detected into a plurality of image blocks to be detected;
缺陷检测模块72,配置为对每个所述待检测图像块分别进行缺陷检测,得到每个所述缺陷检测图像块对应的缺陷检测结果,所述缺陷检测结果用于表征对应的待检测图像 块中是否存在缺陷;The defect detection module 72 is configured to perform defect detection on each of the image blocks to be detected, and obtain a defect detection result corresponding to each of the defect detection image blocks, and the defect detection result is used to represent the corresponding image block to be detected whether there are defects in
结果确定模块73,配置为根据每个所述缺陷检测结果确定图像检测结果。The result determination module 73 is configured to determine an image detection result according to each of the defect detection results.
在一种可能的实现方式中,所述区域提取模块70包括:In a possible implementation manner, the region extraction module 70 includes:
边缘提取子模块,配置为对所述待检测图像进行边缘提取得到待检测区域。The edge extraction sub-module is configured to perform edge extraction on the image to be detected to obtain a region to be detected.
在一种可能的实现方式中,所述边缘提取子模块包括:In a possible implementation manner, the edge extraction submodule includes:
区域提取单元,配置为通过对所述待检测图像进行二值化处理以及最大轮廓提取得到待检测区域。The region extraction unit is configured to obtain the region to be detected by performing binarization processing and maximum contour extraction on the image to be detected.
在一种可能的实现方式中,所述图像划分模块71包括:In a possible implementation, the image division module 71 includes:
滑动划分子模块,配置为通过预设的滑动窗在所述待检测区域上滑动确定多个待检测图像块,所述滑动窗的宽度与所述待检测区域的宽度相同。The sliding division sub-module is configured to determine a plurality of image blocks to be detected by sliding on the region to be detected through a preset sliding window, and the width of the sliding window is the same as the width of the region to be detected.
在一种可能的实现方式中,所述缺陷检测结果中包括位置属性和缺陷类别,所述位置属性用于表征所述缺陷检测结果对应的待检测图像块在所述待检测图像中的位置。In a possible implementation manner, the defect detection result includes a position attribute and a defect category, and the position attribute is used to characterize the position of the image block to be detected corresponding to the defect detection result in the image to be detected.
在一种可能的实现方式中,所述缺陷检测结果还包括每个所述缺陷类别的置信度,所述结果确定模块73包括:In a possible implementation manner, the defect detection result further includes the confidence level of each defect category, and the result determination module 73 includes:
置信度确定子模块,配置为根据每个所述缺陷类别的置信度确定图像置信度,所述图像置信度配置为表征所述待检测图像中存在缺陷的可能性;a confidence degree determination submodule configured to determine an image confidence degree according to the confidence degree of each of the defect categories, the image confidence degree being configured to characterize the possibility of a defect in the image to be detected;
检测结果确定子模块,配置为根据所述图像置信度大于第一阈值的缺陷检测结果确定图像检测结果。The detection result determining sub-module is configured to determine the image detection result according to the defect detection result whose image confidence is greater than a first threshold.
在一种可能的实现方式中,所述置信度确定子模块包括:In a possible implementation manner, the confidence determination submodule includes:
第一置信度确定单元,配置为确定目标缺陷类别的置信度为目标置信度;The first confidence degree determination unit is configured to determine the confidence degree of the target defect category as the target confidence degree;
第二置信度确定单元,配置为确定所述图像置信度的方法至少包括以下之一:响应于所述目标置信度小于第二阈值,根据所述目标缺陷类别以外的每个所述缺陷类别的置信度确定图像置信度;响应于所述目标置信度不小于第二阈值,确定图像置信度为0。The second confidence level determination unit is configured to determine the image confidence level by at least one of the following: in response to the target confidence level being less than a second threshold, according to each of the defect categories other than the target defect category The confidence level determines the image confidence level; in response to the target confidence level being not less than a second threshold, it is determined that the image confidence level is 0.
在一种可能的实现方式中,所述检测结果确定子模块包括:In a possible implementation manner, the detection result determining submodule includes:
第一结果确定单元,配置为确定所述图像置信度大于第一阈值的缺陷检测结果为目标检测结果;The first result determining unit is configured to determine the defect detection result whose image confidence is greater than the first threshold as the target detection result;
类别筛选单元,配置为确定所述目标检测结果中所述置信度最大的缺陷类别为目标类别;A category screening unit configured to determine the defect category with the highest confidence in the target detection result as the target category;
第二结果确定单元,配置为根据每个所述目标检测结果中的位置属性和目标类别确定图像检测结果。The second result determining unit is configured to determine the image detection result according to the position attribute and the target category in each of the target detection results.
在一种可能的实现方式中,所述缺陷检测装置用于检测电池,所述待检测图像包括电池图像,所述待检测区域包括所述电池图像中的顶盖焊缝区域。In a possible implementation manner, the defect detection device is used to detect a battery, the image to be inspected includes a battery image, and the area to be inspected includes a top cover weld area in the battery image.
在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其实现方式可以参照上文方法实施例的描述。In some embodiments, the functions or modules included in the apparatus provided by the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments, and the implementation manner may refer to the descriptions of the above method embodiments.
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是易失性或非易失性计算机可读存储介质。Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned method is implemented when the computer program instructions are executed by a processor. Computer readable storage media may be volatile or nonvolatile computer readable storage media.
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。An embodiment of the present disclosure also proposes an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述方法。An embodiment of the present disclosure also provides a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium carrying computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device When running in the electronic device, the processor in the electronic device executes the above method.
电子设备可以被提供为终端、服务器或其它形态的设备。Electronic devices may be provided as terminals, servers, or other forms of devices.
图8示出根据本公开实施例的一种电子设备800的示意图。例如,电子设备800可以是 移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。FIG. 8 shows a schematic diagram of an electronic device 800 according to an embodiment of the present disclosure. For example, the electronic device 800 may be a terminal such as a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, or a personal digital assistant.
参照图8,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)接口812,传感器组件814,以及通信组件816。8, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and a communication component 816 .
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static Random-Access Memory,SRAM),电可擦除可编程只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM),可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM),可编程只读存储器(Programmable Read-only Memory,PROM),只读存储器(Read-only Memory,ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 804 is configured to store various types of data to support operations at the electronic device 800 . Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 can be realized by any type of volatile or non-volatile storage device or their combination, such as Static Random-Access Memory (Static Random-Access Memory, SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically -Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-only Memory (PROM), Read-Only Memory (Read- only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。The power supply component 806 provides power to various components of the electronic device 800 . Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(Liquid Crystal Display,LCD)和触摸面板(Touch Panel,TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808至少包括以下之一:一个前置摄像头;后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头、后置摄像头中的至少之一可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (Liquid Crystal Display, LCD) and a touch panel (Touch Panel, TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 808 includes at least one of the following: a front camera; a rear camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, at least one of the front camera and the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件810被配置为以下至少之一:输出、输入音频信号。例如,音频组件810包括一个麦克风(Microphone,MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被存储在存储器804或由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。The audio component 810 is configured to be at least one of the following: outputting, inputting an audio signal. For example, the audio component 810 includes a microphone (Microphone, MIC), and when the electronic device 800 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode, the microphone is configured to receive an external audio signal. Received audio signals may be stored in memory 804 or transmitted by communication component 816 . In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS) 或电荷耦合装置(Charge-Coupled Device,CCD)图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 . For example, the sensor component 814 can detect the open/closed state of the electronic device 800, the relative positioning of components, such as the display and the keypad of the electronic device 800, the sensor component 814 can also detect the electronic device 800 or a Changes in position of components, presence or absence of user contact with electronic device 800 , electronic device 800 orientation or acceleration/deceleration and temperature changes in electronic device 800 . Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 814 may also include an optical sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge-Coupled Device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如无线网络(WiFi),第二代移动通信技术(2G)或第三代移动通信技术(3G),或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(Near Field Communication,NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(Radio Frequency Identification,RFID)技术,红外数据协会(Infrared Data Association,IrDA)技术,超宽带(Ultra Wide Band,UWB)技术,蓝牙(BlueTooth,BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as a wireless network (WiFi), a second generation mobile communication technology (2G) or a third generation mobile communication technology (3G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be based on Radio Frequency Identification (RFID) technology, Infrared Data Association (Infrared Data Association, IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BlueTooth, BT) technology and other technology to achieve.
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理设备(Digital Signal Process Device,DSPD)、可编程逻辑器件(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (Application Specific Integrated Circuit, ASIC), Digital Signal Processor (Digital Signal Processor, DSP), Digital Signal Processing Device (Digital Signal Process Device , DSPD), Programmable Logic Device (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), controller, microcontroller, microprocessor or other electronic components for implementation the above method.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, there is also provided a non-volatile computer-readable storage medium, such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to implement the above method.
图9示出本公开实施例提供的一种电子设备1900的示意图。例如,电子设备1900可以为一服务器。参照图9,电子设备1900包括处理组件1922,其包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上模块,其中,每一个模块对应一组指令。此外,处理组件1922被配置为执行指令,以执行上述方法。FIG. 9 shows a schematic diagram of an electronic device 1900 provided by an embodiment of the present disclosure. For example, electronic device 1900 may be a server. Referring to FIG. 9 , electronic device 1900 includes processing component 1922 , which includes one or more processors, and memory resources represented by memory 1932 for storing instructions executable by processing component 1922 , such as application programs. The application program stored in the memory 1932 may include one or more modules, wherein each module corresponds to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
电子设备1900还可以包括一个电源组件1926,被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950,被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如微软服务器操作系统(Windows Server
TM),苹果公司推出的基于图形用户界面的操作系统(Mac OS X
TM),多用户多进程的计算机操作系统(Unix
TM),自由和开放原代码的类Unix操作系统(Linux
TM),开放原代码的类Unix操作系统(FreeBSD
TM)或类似。
Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input-output (I/O) Interface 1958. The electronic device 1900 can operate based on the operating system stored in the memory 1932, such as the Microsoft server operating system (Windows Server ™ ), the operating system based on the graphical user interface (Mac OS X ™ ) introduced by Apple Inc., multi-user multi-process computer operation system (Unix ™ ), a free and open-source Unix-like operating system (Linux ™ ), an open-source Unix-like operating system (FreeBSD ™ ), or the like.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium, such as the memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to implement the above method.
本公开实施例可以是计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开实施例的各个方面的计算机可读程序指令。An embodiment of the present disclosure may be a computer program product. A computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of embodiments of the present disclosure.
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是(但不限于)电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(Random Access Memory,RAM)、ROM、EPROM、SRAM、便携式压缩盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、数字多功能盘(Digital Versatile Disc,DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如, 通过光纤电缆的光脉冲)、或者通过电线传输的电信号。A computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disk, hard disk, Random Access Memory (RAM), ROM, EPROM, SRAM, portable compact disk read-only memory ( Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD), memory stick, floppy disk, mechanically encoded devices such as punched cards or raised structures in grooves on which instructions are stored , and any suitable combination of the above. Computer-readable storage media as used herein is not to be interpreted as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., pulses of light through fiber optic cables), or transmitted electrical signals.
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和无线网中至少之一下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和边缘服务器中至少之一。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over at least one of a network, such as the Internet, a local area network, a wide area network, and a wireless network. The network may include at least one of copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and edge servers. A network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
用于执行本公开实施例操作的计算机程序指令可以是汇编指令、指令集架构(Instruction Set Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、FPGA或可编程逻辑阵列(Programmable Logic Array,PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。Computer program instructions for performing operations of embodiments of the present disclosure may be assembly instructions, instruction set architecture (Instruction Set Architecture, ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or in the form of a or any combination of programming languages, including object-oriented programming languages—such as Smalltalk, C++, etc., and conventional procedural programming languages—such as “C” or similar programming languages language. Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement. In cases involving a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer such as use an Internet service provider to connect via the Internet). In some embodiments, by using the state information of computer-readable program instructions to personalize and customize electronic circuits, such as programmable logic circuits, FPGAs, or programmable logic arrays (Programmable Logic Array, PLA), the electronic circuits can execute computer-readable Read program instructions, thereby implementing various aspects of the present disclosure.
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和框图中的至少之一描述了本公开实施例的各个方面。应当理解,流程图和框图中至少之一的每个方框,以及流程图和框图中至少之一的各方框的组合,都可以由计算机可读程序指令实现。Aspects of embodiments of the present disclosure are described herein with reference to at least one of flowchart illustrations and block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of at least one of the flowchart and block diagrams, and combinations of blocks in at least one of the flowchart and block diagrams, can be implemented by computer readable program instructions.
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和框图中至少之一的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和其他设备中至少之一以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和框图中至少之一的一个或多个方框中规定的功能/动作的各个方面的指令。These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing a device for realizing the functions/actions specified in one or more blocks of at least one of the flowchart and the block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause at least one of computers, programmable data processing devices and other devices to work in a specific way, so that the computer-readable medium storing the instructions An article of manufacture is then included, which includes instructions for implementing various aspects of the functions/actions specified in one or more blocks of at least one of the flowcharts and block diagrams.
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和框图中至少之一的一个或多个方框中规定的功能/动作。It is also possible to load computer-readable program instructions into a computer, other programmable data processing device, or other equipment, so that a series of operational steps are performed on the computer, other programmable data processing device, or other equipment to produce a computer-implemented process , so that instructions executed on computers, other programmable data processing devices, or other devices implement the functions/actions specified in one or more blocks of at least one of the flowcharts and block diagrams.
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和流程图中的至少之一的每个方框、以及框图和流程图中的至少之一的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions. In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It is also to be noted that each block of at least one of the block diagrams and flowcharts, and combinations of blocks of at least one of the block diagrams and flowcharts, may be implemented with dedicated hardware-based devices that perform specified functions or actions. system, or it may be implemented by a combination of special purpose hardware and computer instructions.
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品体现为计算机存储介质,在另一个可选实施例中,计算机程序产品体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The computer program product can be specifically realized by means of hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.
若本公开技术方案涉及个人信息,应用本公开技术方案的产品在处理个人信息前,已明确告知个人信息处理规则,并取得个人自主同意。若本公开技术方案涉及敏感个人信息,应用本公开技术方案的产品在处理敏感个人信息前,已取得个人单独同意,并且同时满足“明示同意”的要求。例如,在摄像头等个人信息采集装置处,设置明确显著的标识告知已进入个人信息采集范围,将会对个人信息进行采集,若个人自愿进入采集范围即视为同意对其个人信息进行采集;或者在个人信息处理的装置上,利用明显的标识/信息告知个人信息处理规则的情况下,通过弹窗信息或请个人自行上传其个人信息等方式获得个人授权;其中,个人信息处理规则可包括个人信息处理者、个人信息处理目的、处理方式、处理的个人信息种类等信息。If the disclosed technical solution involves personal information, the products applying the disclosed technical solution have clearly notified the personal information processing rules and obtained the individual's independent consent before processing personal information. If the disclosed technical solution involves sensitive personal information, the products applying the disclosed technical solution have obtained individual consent before processing sensitive personal information, and at the same time meet the requirement of "express consent". For example, at a personal information collection device such as a camera, a clear and prominent sign is set up to inform that it has entered the scope of personal information collection, and personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed to agree to the collection of his personal information; or On the personal information processing device, when the personal information processing rules are informed with obvious signs/information, personal authorization is obtained through pop-up information or by asking individuals to upload their personal information; among them, the personal information processing rules may include Information processor, purpose of personal information processing, processing method, type of personal information processed and other information.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Having described various embodiments of the present disclosure above, the foregoing description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and alterations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principle of each embodiment, practical application or improvement of technology in the market, or to enable other ordinary skilled in the art to understand each embodiment disclosed herein.
Claims (13)
- 一种缺陷检测方法,所述方法包括:A defect detection method, the method comprising:提取待检测图像中的待检测区域;Extract the region to be detected in the image to be detected;将所述待检测区域划分为多个待检测图像块;dividing the region to be detected into a plurality of image blocks to be detected;对每个所述待检测图像块分别进行缺陷检测,得到每个所述待检测图像块对应的缺陷检测结果,所述缺陷检测结果用于表征对应的待检测图像块中是否存在缺陷;performing defect detection on each of the image blocks to be detected, to obtain a defect detection result corresponding to each of the image blocks to be detected, and the defect detection results are used to indicate whether there is a defect in the corresponding image block to be detected;根据每个所述缺陷检测结果确定图像检测结果。An image detection result is determined based on each of the defect detection results.
- 根据权利要求1所述的方法,其中,所述提取待检测图像中的待检测区域包括:The method according to claim 1, wherein said extracting the region to be detected in the image to be detected comprises:对所述待检测图像进行边缘提取得到待检测区域。Edge extraction is performed on the image to be detected to obtain a region to be detected.
- 根据权利要求2所述的方法,其中,所述对所述待检测图像进行边缘提取得到待检测区域包括:The method according to claim 2, wherein said performing edge extraction on the image to be detected to obtain the region to be detected comprises:通过对所述待检测图像进行二值化处理以及最大轮廓提取得到待检测区域。The region to be detected is obtained by performing binarization processing and maximum contour extraction on the image to be detected.
- 根据权利要求1至3中任意一项所述的方法,其中,所述将所述待检测区域划分为多个待检测图像块包括:The method according to any one of claims 1 to 3, wherein said dividing the region to be detected into a plurality of image blocks to be detected comprises:通过预设的滑动窗在所述待检测区域上滑动确定多个待检测图像块,所述滑动窗的宽度与所述待检测区域的宽度相同。A plurality of image blocks to be detected are determined by sliding on the region to be detected through a preset sliding window, and the width of the sliding window is the same as the width of the region to be detected.
- 根据权利要求1至4中任意一项所述的方法,其中,所述缺陷检测结果中包括位置属性和缺陷类别,所述位置属性用于表征所述缺陷检测结果对应的待检测图像块在所述待检测图像中的位置。The method according to any one of claims 1 to 4, wherein the defect detection result includes a position attribute and a defect category, and the position attribute is used to characterize the location of the image block to be detected corresponding to the defect detection result. Describe the position in the image to be detected.
- 根据权利要求5所述的方法,其中,所述缺陷检测结果还包括每个所述缺陷类别的置信度,所述根据每个所述缺陷检测结果确定图像检测结果包括:The method according to claim 5, wherein the defect detection result further includes a confidence level of each of the defect categories, and determining the image detection result according to each of the defect detection results comprises:根据每个所述缺陷类别的置信度确定图像置信度,所述图像置信度用于表征所述待检测图像中存在缺陷的可能性;determining an image confidence level according to the confidence level of each defect category, the image confidence level being used to characterize the possibility of a defect in the image to be detected;根据所述图像置信度大于第一阈值的缺陷检测结果确定图像检测结果。The image detection result is determined according to the defect detection result whose image confidence is greater than a first threshold.
- 根据权利要求6所述的方法,其中,所述根据每个所述缺陷类别的置信度确定图像置信度包括:The method according to claim 6, wherein said determining the image confidence level according to the confidence level of each said defect category comprises:确定目标缺陷类别的置信度为目标置信度;Determining the confidence level of the target defect category as the target confidence level;确定所述图像置信度的方法至少包括以下之一:响应于所述目标置信度小于第二阈值,根据所述目标缺陷类别以外的每个所述缺陷类别的置信度确定图像置信度;响应于所述目标置信度不小于第二阈值,确定图像置信度为0。The method for determining the image confidence includes at least one of the following: in response to the target confidence being less than a second threshold, determining the image confidence according to the confidence of each of the defect categories other than the target defect category; in response to The target confidence level is not less than the second threshold, and the image confidence level is determined to be 0.
- 根据权利要求6或7所述的方法,其中,所述根据所述图像置信度大于第一阈值的缺陷检测结果确定图像检测结果包括:The method according to claim 6 or 7, wherein said determining the image detection result according to the defect detection result whose image confidence is greater than a first threshold comprises:确定所述图像置信度大于第一阈值的缺陷检测结果为目标检测结果;Determining that a defect detection result whose image confidence is greater than a first threshold is a target detection result;确定所述目标检测结果中所述置信度最大的缺陷类别为目标类别;Determining the defect category with the highest confidence in the target detection result as the target category;根据每个所述目标检测结果中的位置属性和目标类别确定图像检测结果。The image detection result is determined according to the position attribute and the target category in each of the target detection results.
- 根据权利要求1至8中任意一项所述的方法,其中,所述缺陷检测方法用于检测电池,所述待检测图像包括电池图像,所述待检测区域包括所述电池图像中的顶盖焊缝区域。The method according to any one of claims 1 to 8, wherein the defect detection method is used to detect a battery, the image to be inspected includes a battery image, and the region to be inspected includes a top cover in the battery image Weld area.
- 一种缺陷检测装置,所述装置包括:A defect detection device, said device comprising:区域提取模块,配置为提取待检测图像中的待检测区域;An area extraction module configured to extract an area to be detected in the image to be detected;图像划分模块,配置为将所述待检测区域划分为多个待检测图像块;An image division module configured to divide the region to be detected into a plurality of image blocks to be detected;缺陷检测模块,配置为对每个所述待检测图像块分别进行缺陷检测,得到每个所述缺陷检测图像块对应的缺陷检测结果,所述缺陷检测结果用于表征对应的待检测图像块中是否存在缺陷;The defect detection module is configured to perform defect detection on each of the image blocks to be detected, and obtain a defect detection result corresponding to each of the defect detection image blocks, and the defect detection result is used to represent the defects in the corresponding image block to be detected whether there are defects;结果确定模块,配置为根据每个所述缺陷检测结果确定图像检测结果。A result determination module configured to determine an image detection result according to each of the defect detection results.
- 一种电子设备,包括:An electronic device comprising:处理器;processor;用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至9中任意一项所述的方法。Wherein, the processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1-9.
- 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现权利要求1至9中任意一项所述的方法。A computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
- 一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现权利要求1至9中任一项所述方法中的步骤。A computer program product, comprising a computer-readable storage medium storing program code, when the instructions included in the program code are executed by the processor of the computer device, the steps in the method described in any one of claims 1 to 9 are realized .
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111371813.8 | 2021-11-18 | ||
CN202111371813.8A CN114078118A (en) | 2021-11-18 | 2021-11-18 | Defect detection method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023087741A1 true WO2023087741A1 (en) | 2023-05-25 |
Family
ID=80283976
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/104206 WO2023087741A1 (en) | 2021-11-18 | 2022-07-06 | Defect detection method and apparatus, and electronic device, storage medium and computer program product |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114078118A (en) |
WO (1) | WO2023087741A1 (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116542984A (en) * | 2023-07-07 | 2023-08-04 | 浙江省北大信息技术高等研究院 | Hardware defect detection method, device, computer equipment and storage medium |
CN116571410A (en) * | 2023-07-14 | 2023-08-11 | 杭州百子尖科技股份有限公司 | Defect region repairing method, device, equipment and medium based on machine vision |
CN116596931A (en) * | 2023-07-18 | 2023-08-15 | 宁德时代新能源科技股份有限公司 | Image processing method, apparatus, device, storage medium, and program product |
CN116952958A (en) * | 2023-09-18 | 2023-10-27 | 杭州百子尖科技股份有限公司 | Defect detection method, device, electronic equipment and storage medium |
CN117058155A (en) * | 2023-10-13 | 2023-11-14 | 西安空天机电智能制造有限公司 | 3DP metal printing powder spreading defect detection method, device, equipment and medium |
CN117078677A (en) * | 2023-10-16 | 2023-11-17 | 江西天鑫冶金装备技术有限公司 | Defect detection method and system for starting sheet |
CN117252883A (en) * | 2023-11-20 | 2023-12-19 | 宁德时代新能源科技股份有限公司 | Welding defect detection method, device and storage medium |
CN117491287A (en) * | 2023-11-29 | 2024-02-02 | 长春汽车检测中心有限责任公司 | Battery tightness detection system |
CN117921270A (en) * | 2024-03-19 | 2024-04-26 | 宁德时代新能源科技股份有限公司 | Method, apparatus, device, storage medium and program product for controlling welding device |
CN117952926A (en) * | 2024-01-25 | 2024-04-30 | 邯郸市奥能电子股份有限公司 | Defect detection method and device for ceramic capacitor, terminal and storage medium |
CN118447019A (en) * | 2024-07-08 | 2024-08-06 | 南昌众力精密铸造有限公司 | Die casting defect detection method, device and equipment |
CN118505694A (en) * | 2024-07-18 | 2024-08-16 | 国网江西省电力有限公司电力科学研究院 | Alloy grounding material defect detection method and system |
CN118624625A (en) * | 2024-08-09 | 2024-09-10 | 东莞鹏龙光电有限公司 | Intelligent electrical measurement system and method for battery cover plate of new energy automobile |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114078118A (en) * | 2021-11-18 | 2022-02-22 | 深圳市商汤科技有限公司 | Defect detection method and device, electronic equipment and storage medium |
CN116228746B (en) * | 2022-12-29 | 2024-08-23 | 摩尔线程智能科技(北京)有限责任公司 | Defect detection method, device, electronic apparatus, storage medium, and program product |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109632808A (en) * | 2018-12-05 | 2019-04-16 | 深圳大学 | Seamed edge defect inspection method, device, electronic equipment and storage medium |
US20210174482A1 (en) * | 2019-12-09 | 2021-06-10 | International Business Machines Corporation | Visualization of inspection results |
CN113066051A (en) * | 2021-02-23 | 2021-07-02 | 湖南大学 | Groove defect detection method, computing equipment and readable storage medium |
CN114078118A (en) * | 2021-11-18 | 2022-02-22 | 深圳市商汤科技有限公司 | Defect detection method and device, electronic equipment and storage medium |
-
2021
- 2021-11-18 CN CN202111371813.8A patent/CN114078118A/en not_active Withdrawn
-
2022
- 2022-07-06 WO PCT/CN2022/104206 patent/WO2023087741A1/en unknown
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109632808A (en) * | 2018-12-05 | 2019-04-16 | 深圳大学 | Seamed edge defect inspection method, device, electronic equipment and storage medium |
US20210174482A1 (en) * | 2019-12-09 | 2021-06-10 | International Business Machines Corporation | Visualization of inspection results |
CN113066051A (en) * | 2021-02-23 | 2021-07-02 | 湖南大学 | Groove defect detection method, computing equipment and readable storage medium |
CN114078118A (en) * | 2021-11-18 | 2022-02-22 | 深圳市商汤科技有限公司 | Defect detection method and device, electronic equipment and storage medium |
Cited By (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116542984A (en) * | 2023-07-07 | 2023-08-04 | 浙江省北大信息技术高等研究院 | Hardware defect detection method, device, computer equipment and storage medium |
CN116571410A (en) * | 2023-07-14 | 2023-08-11 | 杭州百子尖科技股份有限公司 | Defect region repairing method, device, equipment and medium based on machine vision |
CN116571410B (en) * | 2023-07-14 | 2023-09-26 | 杭州百子尖科技股份有限公司 | Defect region repairing method, device, equipment and medium based on machine vision |
CN116596931A (en) * | 2023-07-18 | 2023-08-15 | 宁德时代新能源科技股份有限公司 | Image processing method, apparatus, device, storage medium, and program product |
CN116596931B (en) * | 2023-07-18 | 2023-11-17 | 宁德时代新能源科技股份有限公司 | Image processing method, apparatus, device, storage medium, and program product |
CN116952958B (en) * | 2023-09-18 | 2023-12-29 | 杭州百子尖科技股份有限公司 | Defect detection method, device, electronic equipment and storage medium |
CN116952958A (en) * | 2023-09-18 | 2023-10-27 | 杭州百子尖科技股份有限公司 | Defect detection method, device, electronic equipment and storage medium |
CN117058155A (en) * | 2023-10-13 | 2023-11-14 | 西安空天机电智能制造有限公司 | 3DP metal printing powder spreading defect detection method, device, equipment and medium |
CN117058155B (en) * | 2023-10-13 | 2024-03-12 | 西安空天机电智能制造有限公司 | 3DP metal printing powder spreading defect detection method, device, equipment and medium |
CN117078677B (en) * | 2023-10-16 | 2024-01-30 | 江西天鑫冶金装备技术有限公司 | Defect detection method and system for starting sheet |
CN117078677A (en) * | 2023-10-16 | 2023-11-17 | 江西天鑫冶金装备技术有限公司 | Defect detection method and system for starting sheet |
CN117252883A (en) * | 2023-11-20 | 2023-12-19 | 宁德时代新能源科技股份有限公司 | Welding defect detection method, device and storage medium |
CN117252883B (en) * | 2023-11-20 | 2024-04-02 | 宁德时代新能源科技股份有限公司 | Welding defect detection method, device and storage medium |
CN117491287A (en) * | 2023-11-29 | 2024-02-02 | 长春汽车检测中心有限责任公司 | Battery tightness detection system |
CN117491287B (en) * | 2023-11-29 | 2024-06-07 | 长春汽车检测中心有限责任公司 | Battery tightness detection system |
CN117952926A (en) * | 2024-01-25 | 2024-04-30 | 邯郸市奥能电子股份有限公司 | Defect detection method and device for ceramic capacitor, terminal and storage medium |
CN117921270A (en) * | 2024-03-19 | 2024-04-26 | 宁德时代新能源科技股份有限公司 | Method, apparatus, device, storage medium and program product for controlling welding device |
CN118447019A (en) * | 2024-07-08 | 2024-08-06 | 南昌众力精密铸造有限公司 | Die casting defect detection method, device and equipment |
CN118505694A (en) * | 2024-07-18 | 2024-08-16 | 国网江西省电力有限公司电力科学研究院 | Alloy grounding material defect detection method and system |
CN118624625A (en) * | 2024-08-09 | 2024-09-10 | 东莞鹏龙光电有限公司 | Intelligent electrical measurement system and method for battery cover plate of new energy automobile |
Also Published As
Publication number | Publication date |
---|---|
CN114078118A (en) | 2022-02-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023087741A1 (en) | Defect detection method and apparatus, and electronic device, storage medium and computer program product | |
CN109829501B (en) | Image processing method and device, electronic equipment and storage medium | |
CN110889469B (en) | Image processing method and device, electronic equipment and storage medium | |
TWI747325B (en) | Target object matching method, target object matching device, electronic equipment and computer readable storage medium | |
CN113344901B (en) | Glue spreading defect detection method and device, storage medium and electronic equipment | |
CN108629354B (en) | Target detection method and device | |
CN110009090B (en) | Neural network training and image processing method and device | |
US11455491B2 (en) | Method and device for training image recognition model, and storage medium | |
CN106228556B (en) | image quality analysis method and device | |
CN109446961B (en) | Gesture detection method, device, equipment and storage medium | |
CN110619350B (en) | Image detection method, device and storage medium | |
CN105678242B (en) | Focusing method and device under hand-held certificate mode | |
CN114240882A (en) | Defect detection method and device, electronic equipment and storage medium | |
CN110990801B (en) | Information verification method and device, electronic equipment and storage medium | |
CN108717542B (en) | Method and device for recognizing character area and computer readable storage medium | |
CN113313115B (en) | License plate attribute identification method and device, electronic equipment and storage medium | |
CN112967264A (en) | Defect detection method and device, electronic equipment and storage medium | |
CN110569835A (en) | Image identification method and device and electronic equipment | |
CN112926510A (en) | Abnormal driving behavior recognition method and device, electronic equipment and storage medium | |
CN109344703B (en) | Object detection method and device, electronic equipment and storage medium | |
CN111523599B (en) | Target detection method and device, electronic equipment and storage medium | |
CN114332149A (en) | Image segmentation method and device, electronic equipment and storage medium | |
CN112200040A (en) | Occlusion image detection method, device and medium | |
CN111062401A (en) | Stacked object identification method and device, electronic device and storage medium | |
CN112036507B (en) | Training method and device of image recognition model, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22894284 Country of ref document: EP Kind code of ref document: A1 |