CN111079823B - Verification code image generation method and system - Google Patents
Verification code image generation method and system Download PDFInfo
- Publication number
- CN111079823B CN111079823B CN201911274461.7A CN201911274461A CN111079823B CN 111079823 B CN111079823 B CN 111079823B CN 201911274461 A CN201911274461 A CN 201911274461A CN 111079823 B CN111079823 B CN 111079823B
- Authority
- CN
- China
- Prior art keywords
- image
- images
- group
- characteristic
- image group
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012795 verification Methods 0.000 title claims abstract description 134
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000013528 artificial neural network Methods 0.000 claims abstract description 47
- 238000005070 sampling Methods 0.000 claims description 35
- 238000012163 sequencing technique Methods 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 6
- 238000003860 storage Methods 0.000 claims description 6
- 230000006870 function Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 238000005336 cracking Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000011176 pooling Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/30—Noise filtering
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computational Linguistics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
Abstract
The invention provides a verification code image generation method, which comprises the following steps: acquiring at least one image group; respectively extracting characteristic images of a source image and a guide image on a preset network layer of the neural network through the neural network; taking the characteristic image of the guide image as a parameter of a source image at a preset network layer, and restoring the source image through a neural network to generate a noise image; judging whether the similarity between the noise image and the source image is smaller than a similarity threshold value, and if so, judging that the noise image is a sub verification code image; and splicing the sub verification code images corresponding to each image group to obtain the verification code images. According to the invention, the noise image with the similarity smaller than the similarity threshold value with the source image in the image group is used as the sub verification code image, so that the obtained verification code image has the same information as the source image in vision, but has the same classification as the guide image when being identified by the neural network, and the risk of being cracked is reduced.
Description
Technical Field
The invention relates to the technical field of verification code image generation, in particular to a verification code image generation method and system.
Background
Verification codes are an automatic response program used to distinguish between humans and machines to prevent computer malware. In the past decade, cracking of verification codes has also been the subject of research by many researchers. To address this challenge, various solutions for verification code generation have also been proposed by jeremey Elson et al. However, due to the development of artificial intelligence, particularly the wide use of deep neural networks, the function of the verification code to improve website security is becoming smaller and smaller.
The types of verification codes commonly used at present mainly comprise: text-based captchas and image-based captchas. Text-based captchas are an image generated from a plurality of characters, requiring the user to recognize the characters in the image. Image-based captchas are another popular approach that typically require a user to select a picture from one or more candidate images that has particular semantics. To some extent, image-based captchas are more secure than text-based captchas. The image carries much more information and more space to change than a string of characters. Meanwhile, in the perception and interpretation of images, especially in noisy environments, there are still many open problems that are difficult to solve. In recent years, many variations have been proposed for image-based verification codes, such as sliding-based verification codes, which ask the user to slide the puzzle to the right of the picture, click-based verification codes require the user to click on a specific semantic region of the picture at the time of verification, etc.
In addition to the two types of verification codes above, there are video-based verification codes, voice-based verification codes, game-based verification codes, inference-based verification codes, and the like. But these types of captchas have not been widely used due to security issues, accessibility restrictions, and performance issues.
With the introduction of deep learning algorithms, both text-based and image-based captchas, their security role is becoming smaller and smaller. To cope with these problems, the current captcha generation schemes are mainly from two aspects: 1. interference information is added, so that safety is improved; 2. the interaction of the user is added, however, the user friendliness of the verification code interface is continuously reduced by the two methods, and the user experience is reduced.
Disclosure of Invention
In order to solve the defects in the prior art, the invention provides a verification code image generation method, which reduces the difficulty of user identification and reduces the risk of cracking.
The specific technical scheme provided by the invention is as follows: provided is a verification code image generation method, comprising the steps of:
acquiring at least one image group, each image group comprising a source image and a guide image;
respectively extracting a source image and a feature image of a guide image in a preset network layer of the neural network from each image group through the neural network;
the characteristic image of the guide image in each image group at the preset network layer is used as a parameter of the source image in the image group at the preset network layer, and the source image in the image group is restored through the neural network to generate a noise image corresponding to the image group;
judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold value, the noise image is a sub verification code image corresponding to the image group;
and splicing the sub verification code images corresponding to each image group to obtain the verification code images.
Further, the step of restoring the source image in the image group by the neural network to generate a noise image corresponding to the image group by using the feature image of the guide image in each image group at the predetermined network layer as a parameter of the source image in the image group at the predetermined network layer specifically includes:
sampling the feature images of the guide images in each image group in the preset network layer for a plurality of times to obtain a plurality of sampling point groups;
replacing the value of the source image in each image group at the sampling position corresponding to each sampling point group in the characteristic image of the preset network layer with the value of the sampling point group to obtain a plurality of first characteristic images corresponding to the image groups;
respectively calculating the similarity of a plurality of first characteristic images corresponding to each image group and the characteristic images of the guide images in the image group at the preset network layer, and taking the first characteristic images, which are smaller in similarity with the characteristic images of the guide images in the image group at the preset network layer and are smaller in similarity with the characteristic images of the source images in the image group at the preset network layer, and the guide images in the image group at the preset network layer, as the second characteristic images of the image group;
calculating the similarity between a second characteristic image corresponding to each image group and the characteristic image of the guiding image in the image group in the preset network layer, and taking the second characteristic image with the minimum similarity between the second characteristic image and the characteristic image of the guiding image in the image group in the preset network layer as a noise characteristic image;
and taking the noise characteristic image as a characteristic image of a source image in the image group at the preset network layer, and restoring the source image in the image group through the neural network to generate a noise image corresponding to the image group.
Further, the similarity is euclidean distance.
Further, the sub verification code image corresponding to each image group is spliced, and the verification code image is obtained specifically includes the steps of:
splicing the sub verification code images corresponding to each image group to obtain spliced images;
and adding an interference image to the spliced image to obtain a verification code image.
Further, adding an interference image to the stitched image, and obtaining the verification code image specifically includes:
randomly generating an ordering sequence of the sub verification code images corresponding to each image group;
and connecting the sub verification images corresponding to each image group by using interference lines in sequence of the sorting sequence to obtain verification code images.
Further, the sequence for randomly generating the sub-verification code image corresponding to each image group specifically includes:
numbering the sub verification code images corresponding to each image group in sequence to obtain a numbering sequence;
and randomly sequencing the numbers in the number sequence to obtain a sequencing sequence.
Further, connecting the sub verification images corresponding to each image group with interference lines in sequence according to the sequence of the sorting sequence, and obtaining the verification code image specifically includes:
sequentially connecting the sub-verification images corresponding to each image group by using interference lines according to the sequence of the sequencing sequence to obtain interference images;
adding a random line into the interference image to obtain a verification code image, wherein the width of the random line is equal to that of the interference line.
Further, the interference line is an arrow.
The invention also provides a verification code image generation system, which comprises:
an image acquisition module for acquiring at least one image group, each image group comprising a source image and a guide image;
the neural network module is used for respectively extracting a source image in each image group and a characteristic image of a guide image in a preset network layer of the neural network, and reducing the source image in the image group to generate a noise image corresponding to the image group by taking the characteristic image of the guide image in each image group in the preset network layer as a parameter of the source image in the image group in the preset network layer;
the judging module is used for judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, and if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold value, the noise image is a sub verification code image corresponding to the image group;
and the splicing module is used for splicing the sub-verification code images corresponding to each image group to obtain the verification code images.
The invention also provides a computer readable storage medium in which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the verification code image generation method as described in any one of the above.
According to the verification code image generation method, the noise image with the similarity smaller than the similarity threshold value with the source image in the image group is used as the sub verification code image, so that the obtained verification code image has the same information as the source image in vision, but has the same classification as the guide image when being identified through the neural network, and therefore the difficulty of user identification is reduced, and meanwhile the risk of being cracked is reduced.
Drawings
The technical solution and other advantageous effects of the present invention will be made apparent by the following detailed description of the specific embodiments of the present invention with reference to the accompanying drawings.
FIG. 1 is a flowchart of a verification code image generation method in a first embodiment;
FIG. 2 is a flowchart of obtaining a noise image in the first embodiment;
FIG. 3 is a diagram showing an example of a verification code image generation method in the first embodiment;
FIG. 4 is an exemplary diagram of a neutron verification code image according to an embodiment;
FIG. 5 is a flowchart of a verification code image generation method in a second embodiment;
fig. 6 is a flowchart of adding an interference image to a stitched image in the second embodiment;
FIG. 7 is a diagram showing an example of a verification code image generation method in the second embodiment;
FIG. 8 is a flowchart of a verification code image generation method in a third embodiment;
FIG. 9 is a diagram showing an example of a verification code image generation method in the third embodiment;
fig. 10 is a block diagram of a verification code image generation system in the fourth embodiment.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the specific embodiments set forth herein. Rather, these embodiments are provided to explain the principles of the invention and its practical application so that others skilled in the art will be able to understand the invention for various embodiments and with various modifications as are suited to the particular use contemplated. In the drawings, like numbers will be used to indicate like elements throughout.
The verification code image generation method provided by the application comprises the following steps:
acquiring at least one image group, wherein each image group comprises a source image and a guide image, the number of the image groups can be one or more, the guide image is used as a source of interference noise, the source image is used as a foreground image, namely a main identification image of a user, and the guide image is used as a background image, namely an image interfering with user identification;
respectively extracting a source image and a feature image of a guide image in a preset network layer of the neural network from each image group through the neural network;
the characteristic image of the guide image in each image group at a preset network layer is used as a parameter of the source image in the image group at the preset network layer, and the source image in the image group is restored through a neural network to generate a noise image corresponding to the image group;
judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value or not;
if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, the noise image is a sub verification code image corresponding to the image group;
and splicing the sub verification code images corresponding to each image group to obtain the verification code images.
According to the method and the device, the noise image with the similarity smaller than the similarity threshold value with the source image in the image group is used as the sub verification code image, so that the obtained verification code image has the same information as the source image in vision, but has the same classification as the guide image during recognition through the neural network, and therefore the difficulty of user recognition is reduced, and meanwhile the risk of being broken is reduced.
The verification code image generation method in the present application will be described in detail below by means of several specific embodiments in combination with the accompanying drawings.
Example 1
Referring to fig. 1, the verification code image generating method provided in the present embodiment includes the following steps:
s1, at least one image group is obtained, each image group comprises a source image and a guide image, wherein the source image and the guide image are selected from the existing image sets, for example, the source image is selected from an image set Mnist image set or a Cifar10 image set, the guide image is selected from an LSVRC_2012 image set, the number of the image groups can be one or more, the guide image is used as a source of interference noise, the source image is used as a foreground image which is a main identification image of a user, and the guide image is used as a background image which is an image interfering with the identification of the user.
S2, extracting characteristic images of a source image and a guide image in each image group in a preset network layer of the neural network respectively through the neural network, wherein the neural network in the embodiment is selected from the existing neural network model, the network layer can be a convolution layer or a pooling layer or a full-connection layer of the neural network, the preset network layer can be one or more layers, the number of the preset network layers can be set according to actual needs, for example, the preset network layer is one layer in order to improve the generation speed of the verification code, and the preset network layer is multiple layers in order to improve the cracking difficulty of the verification code.
S3, the characteristic image of the guide image in each image group at the preset network layer is used as a parameter of the source image in the image group at the preset network layer, and the source image in the image group is restored through the neural network to generate a noise image corresponding to the image group, namely, the characteristic of the guide image is added into the source image.
Referring to fig. 2, in step S3, using a feature image of a guide image in each image group at a predetermined network layer as a parameter of a source image in the image group at the predetermined network layer, restoring the source image in the image group through a neural network to generate a noise image corresponding to the image group specifically includes:
s31, sampling the feature image of the guide image in each image group in a preset network layer for a plurality of times to obtain a plurality of sampling point groups, wherein each sampling point group is different, for example, the feature image of the guide image in the preset network layer is:
sampling the 2 nd, 3 rd, 5 th, 7 th, 8 th, 11 th and 13 th pixels of the characteristic image of the guide image at a preset network layer, wherein the obtained sampling point group is {1,3,1,2,2,8,1};
s32, replacing a value of a source image in each image group at a sampling position corresponding to each sampling point group in a characteristic image of a preset network layer with a value of the sampling point group to obtain a plurality of first characteristic images corresponding to the image groups, for example, the sampling point group is {1,3,1,2,2,8,1}, and the characteristic image of the source image in the preset network layer is:
the first feature image corresponding to the sampling point group is:
s33, calculating the similarity between a plurality of first characteristic images corresponding to each image group and the characteristic images of the guide images in the image group in a preset network layer respectively, and taking the first characteristic images, which are smaller in similarity between the plurality of first characteristic images and the characteristic images of the guide images in the image group in the preset network layer and are smaller in similarity between the source images in the image group in the preset network layer and the characteristic images of the guide images in the image group in the preset network layer, as the second characteristic images of the image group;
s34, calculating the similarity between a second characteristic image corresponding to each image group and the characteristic image of the guiding image in the image group on the preset network layer, and taking the second characteristic image with the minimum similarity between the second characteristic image and the characteristic image of the guiding image in the image group on the preset network layer as a noise characteristic image;
s35, the noise characteristic image in the step S34 is used as a characteristic image of a source image in the image group at a preset network layer, and the source image in the image group is restored through a neural network to generate a noise image corresponding to the image group.
Preferably, the similarity in the present embodiment is the euclidean distance, specifically, in step S33, the second feature image is obtained by the following equation:
wherein phi is k Representing the mapping relation of a k-layer network layer, I s Representing source images in the group of images, I g Representing the leading image in the group of images, phi k (I′ is ) Representing the ith first feature image, phi k (I g ) Characteristic images phi representing the leading images in the image group at the k-th network layer k (I s ) Characteristic image phi representing source image in the image group at k-th network layer k (I g ) Characteristic images representing the leading image in the image group at the k-th network layer, if phi k (I′ is ) Satisfying the above formula, phi k (I′ is ) Is one of the second feature images of the image set.
In step S34, the noise feature image is obtained by the following equation:
wherein phi is k (I′ s ) Representing a noise characteristic image, n representing a secondThe number of characteristic images phi k (I″ js ) Representing the j-th second feature image.
In step S35, specifically, the noise feature image obtained in step S34 is taken as a feature image of the source image in the image group at a predetermined network layer, the feature image of the source image in the image group at other network layers except the predetermined network layer is unchanged, and then the noise feature image and the feature image of the other network layers are taken as parameters, and the source image in the image group is restored through the neural network, thereby generating a noise image corresponding to the image group.
S4, judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold value, the noise image is the sub verification code image corresponding to the image group, wherein the value of the similarity threshold value can be set according to actual needs, and the larger the value of the similarity threshold value is, the larger the noise is.
In step S4, the sub-captcha image is obtained by the following equation:
wherein I' s Representing the noise image corresponding to the image group, if I' s Satisfying the above formula, then I' s For the corresponding sub-captcha image of the group of images, δ represents a similarity threshold, which is used to define the noise image I' s With source image I s The distance between them, i.e. to limit the extent to which the noise image affects the human eye's vision.
And S5, splicing the sub verification code images corresponding to each image group to obtain verification code images.
In step S4, if the similarity between the noise image corresponding to each image group and the source image in the image group is not less than the similarity threshold, steps S1 to S3 are repeated until a noise image satisfying that the similarity between the noise image and the source image in the image group is less than the similarity threshold is found, and the noise image is used as the sub-verification code image corresponding to the image group, and the process proceeds to step S5.
In step S5, the method adopted for stitching the sub-captcha images corresponding to each image group is a general image stitching method, for example, the captcha image includes 5 sub-captcha images { X } 1 ,X 2 ,X 3 ,X 4 ,X 5 5 sub verification code images { X } 1 ,X 2 ,X 3 ,X 4 ,X 5 The verification code image obtained after splicing is:
referring to fig. 3 and 4, the verification code image generating method of the present embodiment is exemplified by 5 image groups, where the sequence numbers of the 5 image groups are sequentially 1 to 5, and each image group of the 5 image groups includes a source image and a guide image, the source image is selected from an image set Mnist image set or a Cifar10 image set, and the guide image is selected from an lsvrc_2012 image set.
Firstly, respectively inputting 5 images into a neural network to extract characteristic images, and then, using the characteristic images of the guide images as parameters of source images, and restoring the source images through the neural network to generate noise images as shown in fig. 3.
FIG. 4 shows the same source image I s (source image in group 5), different guide image I g Noise images I 'generated at different similarity thresholds (δ=10, 20), different depths, and different classes of network layers (layer 2, layer 4, layer 7)' s 。The feature image obtained by adding the feature information of the guidance image to the 2 nd full connection layer of the neural network is shown. />The feature image obtained by adding the feature information of the guidance image to the 4 th full connection layer of the neural network is shown. />The 7 th convolution layer of the neural network is shown as a feature image after the feature information of the guide image is added. As can be seen from fig. 4, the greater the similarity threshold δ, the deeper the depth of the network layer, and the lower the accuracy with which the noise image is identified.
According to the embodiment, the noise image with the similarity smaller than the similarity threshold value with the source image is used as the sub-verification code image, so that the obtained verification code image has the same information as the source image in vision, but has the same classification as the guide image during recognition through the neural network, so that the difficulty of user recognition is reduced, the risk of being cracked is reduced, the arrangement sequence of the sub-verification code images in the embodiment is different from the conventional arrangement sequence from left to right, but is arranged randomly, and the recognition accuracy is further reduced.
Example two
Referring to fig. 5 to 7, the difference between the present embodiment and the first embodiment is that in this embodiment, after the sub-verification code images corresponding to each image group are spliced to obtain a spliced image, interference noise needs to be added to the spliced image, and finally a verification image is obtained, that is, the verification code image generating method further includes:
as shown in fig. 5, the verification code image production method in this embodiment further includes the steps of, on the basis of the first embodiment:
s6, adding an interference image for the spliced image to obtain a verification code image.
As shown in fig. 6, specifically, in step S6, adding an interference image to the stitched image, obtaining a verification code image includes:
s61, randomly generating an ordering sequence of the sub-verification code images corresponding to each image group;
in step S61, specifically, the method includes:
numbering the sub-verification code images corresponding to each image group in turn to obtain a numbering sequence, for example, taking 5 image groups as an example, numbering the sub-verification code images corresponding to the 5 image groups in turn to obtain a numbering sequence {1,2,3,4,5};
the numbers in the sequence of numbers are randomly ordered to obtain an ordered sequence, e.g., a random function is used to randomly generate an ordered sequence {4,1,5,3,2}.
S62, sequentially connecting the sub-verification images corresponding to each image group by using interference lines according to the sequence of the sequencing sequence to obtain verification code images, as shown in fig. 7.
Preferably, the interference line in the embodiment is an arrow, and in order to increase the recognition difficulty, parameters such as the line type, the line type width, the color and the like of the arrow can be set according to actual needs.
According to the embodiment, the interference line is added on the basis of the first embodiment, so that the sequence information is added in the verification code image, and the recognition accuracy is further reduced.
Example III
Referring to fig. 8 to 9, the difference between the present embodiment and the second embodiment is that in this embodiment, after the sub verification images corresponding to each image group are sequentially connected by using the interference lines according to the order of the sorting sequence to obtain the interference image, random lines are further required to be added in the interference image, and finally, a verification image is obtained, that is, the verification code image generating method further includes:
s7, adding random lines for the interference image to obtain a verification code image, as shown in FIG. 9.
Preferably, the shape of the random line is similar to that of the interference line, and the width of the random line is equal to that of the interference line, so that the interference line can be removed while the random line is removed during the identification of the neural network, thereby causing the loss of identification information and reducing the accuracy of the identification. As an example, if the plurality of disturbance lines are arrows, the random lines may be arrows or straight lines, and of course, in order to increase the recognition difficulty, parameters such as the line type and the color of the random lines may be set according to actual needs, that is, the higher the similarity between the random lines and the disturbance lines is, the better.
According to the embodiment, on the basis of the second embodiment, the random lines are added to add the interference information similar to the sequence information into the verification code image, so that the random lines are removed during the neural network identification, meanwhile, the interference lines are removed, the identification information is lost, and the identification accuracy is further reduced.
The following table shows the recognition rates of different types of neural networks on the verification code image generated by the verification code image generation method in the embodiment:
list one
Data set | Vgg19 | Resnet 17 | Resnet 34 | Inception-v3 | Inception-v4 |
Mnist | 99.67% | 99.82% | 99.82% | 99.32% | 99.74% |
Cifar10 | 98.40% | 99.2% | 99.43% | 99.27% | 99.64% |
Mnist+ad | 37.8% | 46.2% | 57.87% | 45.9% | 37.2% |
Cifar10+ad | 27.4% | 32.8% | 39.7% | 54.8% | 39.1% |
The first row in the table one represents different types of neural networks, the first columns Mnist and Cifar10 represent two different image sets, and mnist+ad and Cifar10+ad represent verification code images generated by the verification code image generating method in the embodiment.
Example IV
Referring to fig. 10, the present embodiment provides a verification code image generation system, which includes an image acquisition module 1, a neural network module 2, a judgment module 3, and a stitching module 4.
The image acquisition module 1 is configured to acquire at least one image group, each image group including a source image and a guide image. The neural network module 2 is configured to extract a source image in each image group, a feature image of a guide image at a predetermined network layer of the neural network, and restore the source image in the image group to generate a noise image corresponding to the image group, where the feature image of the guide image in each image group at the predetermined network layer is used as a parameter of the source image in the image group at the predetermined network layer. The judging module 3 is configured to judge whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold, and if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold, then use the noise image as the sub verification code image corresponding to the image group. The stitching module 4 is configured to stitch the sub-verification code images corresponding to each image group to obtain a verification code image.
The judging module 3 is specifically further configured to:
sampling the feature image of the guide image in each image group at the predetermined network layer for a plurality of times to obtain a plurality of sampling point groups, wherein each sampling point group is different, for example, the feature image of the guide image at the predetermined network layer is:
sampling the 2 nd, 3 rd, 5 th, 7 th, 8 th, 11 th and 13 th pixels of the characteristic image of the guide image at a preset network layer, wherein the obtained sampling point group is {1,3,1,2,2,8,1};
replacing a value of a source image in each image group at a sampling position corresponding to each sampling point group in a characteristic image of a preset network layer with a value of the sampling point group to obtain a plurality of first characteristic images corresponding to the image groups, for example, the sampling point group is {1,3,1,2,2,8,1}, and the characteristic image of the source image in the preset network layer is:
the first feature image corresponding to the sampling point group is:
respectively calculating the similarity between a plurality of first characteristic images corresponding to each image group and the characteristic images of the guide images in the image group at a preset network layer, and taking the first characteristic images, which are smaller than the similarity between the source images in the image group and the characteristic images of the guide images in the image group at the preset network layer, in the plurality of first characteristic images as the second characteristic images of the image group;
calculating the similarity between a second characteristic image corresponding to each image group and the characteristic image of the guiding image in the image group in the preset network layer, and taking the second characteristic image with the minimum similarity between the second characteristic image and the characteristic image of the guiding image in the image group in the preset network layer as a noise characteristic image;
and taking the noise characteristic image as a characteristic image of a source image in the image group at a preset network layer, and restoring the source image in the image group through a neural network to generate a noise image corresponding to the image group.
It should be noted that the foregoing explanation of the embodiment of the verification code image generating method is also applicable to the verification code image generating system of this embodiment, and will not be repeated here.
In order to achieve the above-described embodiments, the present embodiment also proposes a computer-readable storage medium that, when instructions in the storage medium are executed by a processor, enables execution of the verification code image generation methods shown in embodiments one to three.
In order to implement the above-described embodiments, the present embodiment also proposes a computer program product that, when executed by an instruction processor in the computer program product, performs the verification code image generation methods shown in embodiments one to three.
In the description of this specification, any process or method description in a flowchart or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing logical functions or steps of the process, and additional implementations are included within the scope of the preferred embodiments of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or part of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, and the program may be stored in a computer readable storage medium, where the program when executed includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented as software functional modules and sold or used as a stand-alone product.
The foregoing is merely exemplary of the application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the application and are intended to be comprehended within the scope of the application.
Claims (9)
1. The verification code image generation method is characterized by comprising the following steps of:
acquiring at least one image group, each image group comprising a source image and a guide image;
respectively extracting a source image and a feature image of a guide image in a preset network layer of the neural network from each image group through the neural network;
the characteristic image of the guide image in each image group at the preset network layer is used as a parameter of the source image in the image group at the preset network layer, and the source image in the image group is restored through the neural network to generate a noise image corresponding to the image group;
judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold value, the noise image is a sub verification code image corresponding to the image group;
splicing the sub verification code images corresponding to each image group to obtain a verification code image;
the step of restoring the source image in the image group through the neural network to generate a noise image corresponding to the image group specifically includes:
sampling the feature images of the guide images in each image group in the preset network layer for a plurality of times to obtain a plurality of sampling point groups;
replacing the value of the source image in each image group at the sampling position corresponding to each sampling point group in the characteristic image of the preset network layer with the value of the sampling point group to obtain a plurality of first characteristic images corresponding to the image groups;
respectively calculating the similarity of a plurality of first characteristic images corresponding to each image group and the characteristic images of the guide images in the image group at the preset network layer, and taking the first characteristic images, which are smaller in similarity with the characteristic images of the guide images in the image group at the preset network layer and are smaller in similarity with the characteristic images of the source images in the image group at the preset network layer, and the guide images in the image group at the preset network layer, as the second characteristic images of the image group;
calculating the similarity between a second characteristic image corresponding to each image group and the characteristic image of the guiding image in the image group in the preset network layer, and taking the second characteristic image with the minimum similarity between the second characteristic image and the characteristic image of the guiding image in the image group in the preset network layer as a noise characteristic image;
and taking the noise characteristic image as a characteristic image of a source image in the image group at the preset network layer, and restoring the source image in the image group through the neural network to generate a noise image corresponding to the image group.
2. The authentication code image generation method according to claim 1, wherein the similarity is euclidean distance.
3. The method for generating a verification code image according to claim 1, wherein the step of stitching sub-verification code images corresponding to each image group to obtain a verification code image comprises the steps of:
splicing the sub verification code images corresponding to each image group to obtain spliced images;
and adding an interference image to the spliced image to obtain a verification code image.
4. A method of generating a verification code image according to claim 3, wherein adding an interference image to the stitched image, the obtaining a verification code image specifically comprises:
randomly generating an ordering sequence of the sub verification code images corresponding to each image group;
and connecting the sub verification images corresponding to each image group by using interference lines in sequence of the sorting sequence to obtain verification code images.
5. The method of claim 4, wherein randomly generating the ordered sequence of sub-captcha images for each image group comprises:
numbering the sub verification code images corresponding to each image group in sequence to obtain a numbering sequence;
and randomly sequencing the numbers in the number sequence to obtain a sequencing sequence.
6. The method for generating a verification code image according to claim 4, wherein the step of sequentially connecting the sub-verification images corresponding to each image group with an interference line in the order of the sorting sequence, and the step of obtaining the verification code image specifically comprises:
sequentially connecting the sub-verification images corresponding to each image group by using interference lines according to the sequence of the sequencing sequence to obtain interference images;
adding a random line into the interference image to obtain a verification code image, wherein the width of the random line is equal to that of the interference line.
7. The verification code image generation method according to any one of claims 4 to 6, wherein the interference line is an arrow.
8. A captcha image generation system, the captcha image generation system comprising:
an image acquisition module for acquiring at least one image group, each image group comprising a source image and a guide image;
the neural network module is used for respectively extracting the source images in each image group and the characteristic images of the guide images in a preset network layer of the neural network, and reducing the source images in the image groups to generate noise images corresponding to the image groups by taking the characteristic images of the guide images in each image group in the preset network layer as parameters of the source images in the image groups in the preset network layer;
the judging module is used for judging whether the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than a similarity threshold value, and if the similarity between the noise image corresponding to each image group and the source image in the image group is smaller than the similarity threshold value, the noise image is a sub verification code image corresponding to the image group;
the splicing module is used for splicing the sub-verification code images corresponding to each image group to obtain verification code images;
wherein, the judging module is further used for: sampling the feature images of the guide images in each image group in the preset network layer for a plurality of times to obtain a plurality of sampling point groups; replacing the value of the source image in each image group at the sampling position corresponding to each sampling point group in the characteristic image of the preset network layer with the value of the sampling point group to obtain a plurality of first characteristic images corresponding to the image groups; respectively calculating the similarity of a plurality of first characteristic images corresponding to each image group and the characteristic images of the guide images in the image group at the preset network layer, and taking the first characteristic images, which are smaller in similarity with the characteristic images of the guide images in the image group at the preset network layer and are smaller in similarity with the characteristic images of the source images in the image group at the preset network layer, and the guide images in the image group at the preset network layer, as the second characteristic images of the image group; calculating the similarity between a second characteristic image corresponding to each image group and the characteristic image of the guiding image in the image group in the preset network layer, and taking the second characteristic image with the minimum similarity between the second characteristic image and the characteristic image of the guiding image in the image group in the preset network layer as a noise characteristic image; and taking the noise characteristic image as a characteristic image of a source image in the image group at the preset network layer, and restoring the source image in the image group through the neural network to generate a noise image corresponding to the image group.
9. A computer readable storage medium having a computer program stored therein, wherein the computer program when executed by a processor implements the verification code image generation method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911274461.7A CN111079823B (en) | 2019-12-12 | 2019-12-12 | Verification code image generation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911274461.7A CN111079823B (en) | 2019-12-12 | 2019-12-12 | Verification code image generation method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111079823A CN111079823A (en) | 2020-04-28 |
CN111079823B true CN111079823B (en) | 2024-01-19 |
Family
ID=70314208
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911274461.7A Active CN111079823B (en) | 2019-12-12 | 2019-12-12 | Verification code image generation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111079823B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111695106B (en) * | 2020-05-29 | 2022-06-28 | 北京字节跳动网络技术有限公司 | Verification method and device and electronic equipment |
CN113010873B (en) * | 2021-03-31 | 2022-09-09 | 山石网科通信技术股份有限公司 | Image processing method, image processing device, nonvolatile storage medium and processor |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108717550A (en) * | 2018-04-28 | 2018-10-30 | 浙江大学 | A kind of image confrontation verification code generation method and system based on confrontation study |
CN110008680A (en) * | 2019-04-03 | 2019-07-12 | 华南师范大学 | System and method is generated based on the identifying code to resisting sample |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106034029A (en) * | 2015-03-20 | 2016-10-19 | 阿里巴巴集团控股有限公司 | Verification method and apparatus based on image verification codes |
-
2019
- 2019-12-12 CN CN201911274461.7A patent/CN111079823B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108717550A (en) * | 2018-04-28 | 2018-10-30 | 浙江大学 | A kind of image confrontation verification code generation method and system based on confrontation study |
CN110008680A (en) * | 2019-04-03 | 2019-07-12 | 华南师范大学 | System and method is generated based on the identifying code to resisting sample |
Also Published As
Publication number | Publication date |
---|---|
CN111079823A (en) | 2020-04-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Piao et al. | Depth-induced multi-scale recurrent attention network for saliency detection | |
CN110728330A (en) | Object identification method, device, equipment and storage medium based on artificial intelligence | |
CN110009057B (en) | Graphic verification code identification method based on deep learning | |
CN109190531B (en) | Feature extraction and matching and template update for biometric authentication | |
US9852510B2 (en) | Method and apparatus for dividing image area | |
DE102018115440A1 (en) | Techniques for training deep neural networks | |
CN109684469A (en) | Filtering sensitive words method, apparatus, computer equipment and storage medium | |
CN111079823B (en) | Verification code image generation method and system | |
CN110084238B (en) | Finger vein image segmentation method and device based on LadderNet network and storage medium | |
CN112966685B (en) | Attack network training method and device for scene text recognition and related equipment | |
KR102127571B1 (en) | Method and apparatus for removing hidden data based on auto-regressive generative model | |
CN105404885B (en) | A kind of two dimension character graphics identifying code complex background noise jamming minimizing technology | |
CN112561053B (en) | Image processing method, training method and device of pre-training model and electronic equipment | |
CN110023989A (en) | A kind of generation method and device of sketch image | |
CN110610117A (en) | Face recognition method, face recognition device and storage medium | |
CN114266894A (en) | Image segmentation method and device, electronic equipment and storage medium | |
RU2019141908A (en) | IDENTIFICATION OF RELATED WORD BLOCKS IN DOCUMENTS OF A COMPLEX STRUCTURE | |
CN114549698A (en) | Text synthesis method and device and electronic equipment | |
CN117454187A (en) | Integrated model training method based on frequency domain limiting target attack | |
CN103257954B (en) | The proofreading method of word, system and check and correction server in ancient books | |
CN113361567A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN117459649A (en) | High-capacity information hiding method and system based on image style migration | |
CN111931148A (en) | Image processing method and device and electronic equipment | |
Emeršič et al. | Towards accessories-aware ear recognition | |
CN110321883A (en) | Method for recognizing verification code and device, readable storage medium storing program for executing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |