Missing character detection and missing character detection model establishing method and device

文档序号:1545151 发布日期:2020-01-17 浏览:10次 中文

阅读说明:本技术 缺失字符检测、缺失字符检测模型的建立方法及装置 (Missing character detection and missing character detection model establishing method and device ) 是由 肖航 张子昊 于 2019-09-29 设计创作,主要内容包括:本申请公开一种缺失字符检测、缺失字符检测模型的建立方法及装置,属于图像处理技术领域,该方法包括:获取待检测图像,将待检测图像输入缺失字符检测模型中,根据缺失字符检测模型输出的待检测图像中各像素的概率信息生成第一目标图像,对第一目标图像进行轮廓提取,根据提取的轮廓信息确定待检测图像中喷码字符的个数,若喷码字符的个数小于预设个数,则确定待检测图像中的喷码字符有缺失,其中,缺失字符检测模型输出的各像素的概率信息包括每个像素属于喷码字符的概率,这样,以像素为单位对喷码字符进行缺失检测,检测的准确度较高,且待检测图像在尺寸上的变化也不易对检测效果产生影响。(The application discloses missing character detection and missing character detection model establishing methods and devices, belongs to the technical field of image processing, and comprises the following steps: the method comprises the steps of obtaining an image to be detected, inputting the image to be detected into a missing character detection model, generating a first target image according to probability information of each pixel in the image to be detected, which is output by the missing character detection model, extracting the outline of the first target image, determining the number of code-spraying characters in the image to be detected according to the extracted outline information, and determining that the code-spraying characters in the image to be detected are missing if the number of the code-spraying characters is smaller than a preset number, wherein the probability information of each pixel output by the missing character detection model comprises the probability that each pixel belongs to the code-spraying characters.)

1. A missing character detection method, comprising:

acquiring an image to be detected;

inputting the image to be detected into an established missing character detection model to determine probability information of each pixel in the image to be detected, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to code-spraying characters;

generating a first target image according to first probability information of each pixel in the image to be detected, which is output by the missing character detection model;

extracting the outline of the first target image, and determining code spraying character information in the image to be detected according to the extracted outline information, wherein the code spraying character information comprises the number of code spraying characters;

and if the number of the code spraying characters is smaller than the preset number, determining that the code spraying characters in the image to be detected are missing.

2. The method of claim 1, wherein generating a first target image based on the first probability information of each pixel in the image to be detected output by the missing character detection model comprises:

for each pixel in the image to be detected, determining the size relation between the probability that the pixel belongs to the code spraying character and a preset probability;

generating a first target image according to the size relation between the probability that each pixel in the image to be detected belongs to the code spraying character and a preset probability; for each pixel in the image to be detected, if the probability that the pixel belongs to the code-spraying character is greater than the preset probability, the pixel corresponding to the pixel in the first target image is a mark value of the code-spraying character; otherwise, the pixel corresponding to the pixel in the first target image is a preset value representing the background.

3. The method of claim 1, wherein when each code-sprayed character in the image to be detected is not missing, N types of code-sprayed dots are included, the probability information of each pixel further includes second probability information, the second probability information includes a probability that the pixel belongs to each type of code-sprayed dot and a probability that the pixel belongs to a background, the code-sprayed character information further includes position information of each code-sprayed character, N is an integer greater than 1, and the method further includes:

if the number of the code-spraying characters is determined to be not smaller than the preset number, generating a second target image according to second probability information of each pixel in the image to be detected, which is output by the missing character detection model; and

and determining whether the code spraying points of the code spraying characters in the image to be detected are missing or not according to the position information of the code spraying characters and the second target image.

4. The method of claim 3, wherein generating a second target image according to the second probability information of each pixel in the image to be detected output by the missing character detection model comprises:

for each pixel in the image to be detected, taking the class with the highest probability in the second probability information of the pixel as the class to which the pixel belongs;

generating a second target image according to the category of each pixel in the image to be detected; for each pixel in the image to be detected, if the type of the pixel is a background, the pixel corresponding to the pixel in the second target image is a preset value representing the background; if the type of the pixel belongs to the ith type code spraying point, the pixel corresponding to the pixel in the second target image is the label value of the ith type code spraying point, i is more than or equal to 1 and less than or equal to N, and i is an integer.

5. The method as claimed in claim 3 or 4, wherein determining whether the code-sprayed dots of each code-sprayed character in the image to be detected are missing according to the position information of each code-sprayed character and the second target image comprises:

determining a pixel area corresponding to each code-spraying character in the second target image according to the position information of each code-spraying character;

if the type of the code spraying points of each pixel in the pixel area is smaller than N, determining that the code spraying points of the code spraying character in the image to be detected are missing;

and if the type of the code spraying points of each pixel in the pixel area is not less than N, determining that the code spraying points of the code spraying characters in the image to be detected are not missing.

6. A method for establishing a missing character detection model is characterized by comprising the following steps:

acquiring an image sample, wherein the image sample comprises at least one code spraying character;

inputting the image sample into a deep learning network model to determine probability information of each pixel in the image sample, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to a code-sprayed character;

determining a first loss value of the deep learning network model according to first probability information of each pixel in the image sample output by the deep learning network model and a first label image generated in advance;

and adjusting parameters of the deep learning network model according to the first loss value, and establishing a missing character detection model.

7. A missing character detection apparatus, comprising:

the acquisition module is used for acquiring an image to be detected;

the determining module is used for inputting the image to be detected into the established missing character detection model so as to determine probability information of each pixel in the image to be detected, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to code-spraying characters;

the generating module is used for generating a first target image according to first probability information of each pixel in the image to be detected, which is output by the missing character detection model;

and the processing module is used for extracting the outline of the first target image, determining code spraying character information in the image to be detected according to the extracted outline information, wherein the code spraying character information comprises the number of code spraying characters, and determining that the code spraying characters in the image to be detected are missing if the number of the code spraying characters is determined to be smaller than the preset number.

8. An apparatus for building a missing character detection model, comprising:

the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an image sample which comprises at least one code spraying character;

a probability determining module, configured to input the image sample into a deep learning network model to determine probability information of each pixel in the image sample, where the probability information of each pixel includes first probability information, and the first probability information includes a probability that the pixel belongs to a code-sprayed character;

a loss value determining module, configured to determine a first loss value of the deep learning network model according to first probability information of each pixel in the image sample output by the deep learning network model and a first label image generated in advance;

and the adjusting module is used for adjusting the parameters of the deep learning network model according to the first loss value and establishing a missing character detection model.

9. An electronic device, comprising: at least one processor, and a memory communicatively coupled to the at least one processor, wherein:

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6.

10. A computer-readable medium having stored thereon computer-executable instructions for performing the method of any one of claims 1 to 6.

Technical Field

The application relates to the technical field of image processing, in particular to missing character detection and a method and a device for establishing a missing character detection model.

Background

In industrial production, before products are shipped out, character information such as production date or batch number is printed on outer packages of the products, and the characters are generally generated by an ink-jet printer.

At present, the scheme adopted for detecting the missing of code-spraying characters is as follows: after the image is obtained, calculating the pixel area of the code spraying character in the image, and if the pixel area of the code spraying character is determined to be smaller than a preset threshold value, determining that the code spraying character in the image is lost; and if the pixel area of the code spraying character is not smaller than the preset threshold value, the code spraying character in the image is considered to be not lost. In this scheme, the image can not have the change in size, because the pixel area of spouting the code character also can change after the image size changes, it will no longer be effective to predetermine the threshold value to, predetermine that the threshold value sets up and causes the hourglass to examine easily, predetermine that the threshold value sets up and causes the false positive detection easily excessively, the rate of accuracy that detects also is difficult to guarantee.

Disclosure of Invention

The embodiment of the application provides a missing character detection method and a missing character detection model establishing method and device, and aims to solve the problems that in the prior art, the size requirement of an image to be detected is strict and the accuracy rate is difficult to guarantee when missing character detection is carried out.

In a first aspect, a missing character detection method provided in an embodiment of the present application includes:

acquiring an image to be detected;

inputting the image to be detected into an established missing character detection model to determine probability information of each pixel in the image to be detected, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to code-spraying characters;

generating a first target image according to first probability information of each pixel in the image to be detected, which is output by the missing character detection model;

extracting the outline of the first target image, and determining code spraying character information in the image to be detected according to the extracted outline information, wherein the code spraying character information comprises the number of code spraying characters;

and if the number of the code spraying characters is smaller than the preset number, determining that the code spraying characters in the image to be detected are missing.

In a second aspect, a method for building a missing character detection model provided in an embodiment of the present application includes:

acquiring an image sample, wherein the image sample comprises at least one code spraying character;

inputting the image sample into a deep learning network model to determine probability information of each pixel in the image sample, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to a code-sprayed character;

determining a first loss value of the deep learning network model according to first probability information of each pixel in the image sample output by the deep learning network model and a first label image generated in advance;

and adjusting parameters of the deep learning network model according to the first loss value, and establishing a missing character detection model.

In a third aspect, an apparatus for detecting missing characters provided in an embodiment of the present application includes:

the acquisition module is used for acquiring an image to be detected;

the determining module is used for inputting the image to be detected into the established missing character detection model so as to determine probability information of each pixel in the image to be detected, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to code-spraying characters;

the generating module is used for generating a first target image according to first probability information of each pixel in the image to be detected, which is output by the missing character detection model;

and the processing module is used for extracting the outline of the first target image, determining code spraying character information in the image to be detected according to the extracted outline information, wherein the code spraying character information comprises the number of code spraying characters, and determining that the code spraying characters in the image to be detected are missing if the number of the code spraying characters is determined to be smaller than the preset number.

In a fourth aspect, an apparatus for building a missing character detection model provided in an embodiment of the present application includes:

the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an image sample which comprises at least one code spraying character;

a probability determining module, configured to input the image sample into a deep learning network model to determine probability information of each pixel in the image sample, where the probability information of each pixel includes first probability information, and the first probability information includes a probability that the pixel belongs to a code-sprayed character;

a loss value determining module, configured to determine a first loss value of the deep learning network model according to first probability information of each pixel in the image sample output by the deep learning network model and a first label image generated in advance;

and the adjusting module is used for adjusting the parameters of the deep learning network model according to the first loss value and establishing a missing character detection model.

In a fifth aspect, an electronic device provided in an embodiment of the present application includes: at least one processor, and a memory communicatively coupled to the at least one processor, wherein:

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the methods described above.

In a sixth aspect, embodiments of the present application provide a computer-readable medium storing computer-executable instructions for performing any one of the methods described above.

In the embodiment of the application, after an image to be detected is obtained, the image to be detected is input into an established missing character detection model to determine probability information of each pixel in the image to be detected, a first target image is generated according to the probability that each pixel in the image to be detected output by the missing character detection model belongs to a code-spraying character, then the first target image is subjected to contour extraction, code-spraying character information in the image to be detected is determined according to the extracted contour information, such as the number of the code-spraying characters, and if the number of the code-spraying characters is determined to be smaller than a preset number, the code-spraying characters in the image to be detected are determined to be missing, wherein the probability information output by the missing character detection model comprises the probability that each pixel belongs to the code-spraying character, so that the missing detection is performed on the code-spraying characters by taking the pixels as a unit, the detection granularity can be refined to a pixel level, and the detection accuracy is, and the change of the size of the image to be detected is not easy to influence the detection effect.

Drawings

The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:

fig. 1 is a flowchart of a missing character detection method according to an embodiment of the present disclosure;

fig. 2 is a flowchart of another missing character detection method according to an embodiment of the present disclosure;

fig. 3 is a flowchart of a method for establishing a missing character detection model according to an embodiment of the present disclosure;

FIG. 4 is a flowchart of determining a first loss value of a deep learning network model according to an embodiment of the present disclosure;

fig. 5 is a flowchart of a method for building a missing character detection model according to an embodiment of the present application;

FIG. 6 is a schematic diagram of an image sample provided by an embodiment of the present application;

FIG. 7 is a schematic diagram of an initial image provided by an embodiment of the present application;

FIG. 8 is a schematic diagram of an image sample generated from an initial image according to an embodiment of the present application;

FIG. 9 is a schematic diagram of an embodiment of the present application for labeling an image sample;

FIG. 10 is a schematic diagram of a first label image provided by an embodiment of the present application;

FIG. 11 is a schematic diagram of a second label image provided in an embodiment of the present application;

fig. 12 is a schematic structural diagram of a deep learning network model according to an embodiment of the present disclosure;

FIG. 13 is a diagram illustrating a process for detecting missing characters according to an embodiment of the present disclosure;

fig. 14 is a schematic diagram of a missing character detection result according to an embodiment of the present disclosure;

FIG. 15 is a diagram illustrating another missing character detection result according to an embodiment of the present disclosure;

fig. 16 is a schematic hardware structural diagram of an electronic device for implementing a missing character detection method and/or a missing character detection model building method according to an embodiment of the present disclosure;

fig. 17 is a schematic structural diagram of a missing character detection apparatus according to an embodiment of the present application;

fig. 18 is a schematic structural diagram of a missing character detection model building apparatus according to an embodiment of the present application.

Detailed Description

In order to solve the problems that the size requirement of an image to be detected is strict and the accuracy rate is difficult to guarantee when missing character detection is performed in the prior art, the embodiment of the application provides a method and a device for establishing a missing character detection model and a missing character detection model.

The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it should be understood that the preferred embodiments described herein are merely for illustrating and explaining the present application, and are not intended to limit the present application, and that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.

Referring to fig. 1, fig. 1 is a flowchart of a missing character detection method provided in an embodiment of the present application, where the method includes the following steps:

s101: and acquiring an image to be detected.

In practical application, the character information of the product such as production date, production batch and the like is generally sprayed at a fixed position, so that the image to be detected can be obtained only by carrying out image acquisition on the fixed position of the product.

S102: inputting an image to be detected into the established missing character detection model to determine probability information of each pixel in the image to be detected, wherein the probability information of each pixel comprises first probability information, and the first probability information comprises the probability that the pixel belongs to the code-spraying character.

The missing character detection model established in the embodiment of the application can determine the probability that each pixel in the image to be detected belongs to the code-spraying character, so that whether the code-spraying character is missing or not can be distinguished from the pixel level, and the detection accuracy is improved.

S103: and generating a first target image according to the first probability information of each pixel in the image to be detected, which is output by the missing character detection model.

The first target image corresponds to pixels in the image to be detected one by one, and the first target image comprises information whether each pixel in the image to be detected belongs to code spraying characters.

30页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种识别翻拍图像的方法、装置及设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!