CN107330470B - Method and device for identifying picture - Google Patents

Method and device for identifying picture Download PDF

Info

Publication number
CN107330470B
CN107330470B CN201710537368.5A CN201710537368A CN107330470B CN 107330470 B CN107330470 B CN 107330470B CN 201710537368 A CN201710537368 A CN 201710537368A CN 107330470 B CN107330470 B CN 107330470B
Authority
CN
China
Prior art keywords
picture
sub
pictures
classifier
model
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
Application number
CN201710537368.5A
Other languages
Chinese (zh)
Other versions
CN107330470A (en
Inventor
强晶晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710537368.5A priority Critical patent/CN107330470B/en
Publication of CN107330470A publication Critical patent/CN107330470A/en
Application granted granted Critical
Publication of CN107330470B publication Critical patent/CN107330470B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method and a device for identifying pictures, and relates to the technical field of computers. One embodiment of the method comprises: receiving a picture to be identified; cutting the picture into one or more sub-pictures; and inputting the sub-picture into a classifier, and labeling the sub-picture by the classifier based on a first model obtained by pre-training so as to identify the picture. The embodiment can improve the identification efficiency and the identification accuracy of the fuzzy picture.

Description

Method and device for identifying picture
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for recognizing a picture.
Background
The picture verification code is one of effective means for intercepting invalid requests by a program, and is commonly used in a web system as a means for assisting security. The picture identifying code identifying technology is greatly helpful for safety monitoring, and a test engineer can bypass identifying code limitation by automatically identifying the picture identifying code of the web system, so that automatic pressure test can be performed on the web system in a high-concurrency environment.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: in the existing automatic identification method of the picture verification code, the analysis of the picture is performed through the traditional analysis of picture points and lines and the analysis of gray level and color, the extraction, denoising and identification are performed on the characters of the picture verification code by adopting the analysis method, and the identification efficiency and the identification accuracy are lower for the picture verification code with higher fuzzy degree.
Therefore, a method and an apparatus for recognizing a picture, which can improve the recognition efficiency and the recognition accuracy of a blurred picture, are needed.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for recognizing a picture, which can improve recognition efficiency and recognition accuracy of a blurred picture.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of recognizing a picture, including:
receiving a picture to be identified;
cutting the picture into one or more sub-pictures;
and inputting the sub-picture into a classifier, and labeling the sub-picture by the classifier based on a first model obtained by pre-training so as to identify the picture.
Further, the step of cutting the picture into one or more sub-pictures comprises the step of carrying out binarization and denoising processing on the sub-pictures.
Further, the first model is obtained by the following model training steps:
acquiring a picture set;
cutting each picture in the picture set to obtain a sub-picture set of the picture;
selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking a label for each sub-picture in the first sub-picture set;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, comparing pixels of the sub-pictures in the second sub-picture set with pixels of each sub-picture in the first sub-picture set, and marking labels for each sub-picture in the second sub-picture set according to pixel efficiency obtained by comparison;
inputting each sub-picture in the second sub-picture set into a classifier, and training the classifier based on the second sub-picture set to obtain a second model;
inputting each sub-picture in all sub-picture sets into a classifier, the classifier tagging each sub-picture based on the second model;
and inputting each sub-picture in all the sub-picture sets into a classifier, and training the classifier to obtain the first model based on all the sub-picture sets.
The method for identifying the picture provided by the embodiment of the invention further comprises the following steps:
and if the picture identification is wrong, storing the picture so as to add the picture into the picture set, and obtaining a new first model by executing the model training step.
Further, cutting the picture includes:
scanning the picture column by column from left to right, taking the abscissa of the pixel as the left boundary of the first sub-picture when the first effective pixel is found, then continuing to scan column by column, taking the abscissa of the column as the right boundary of the first sub-picture when the first completely ineffective pixel column is found,
scanning line by line from top to bottom between the left boundary and the right boundary of the first sub-picture, taking the ordinate of the pixel as the upper boundary of the first sub-picture when the first effective pixel is found, then continuing to scan line by line, taking the ordinate of the line as the lower boundary of the first sub-picture when the first all-ineffective pixel line is found,
and repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture.
Further, denoising the sub-picture comprises:
when the number of other effective pixel points around the effective pixel point in the sub-picture does not exceed a threshold value, determining the effective pixel point as a noise point, wherein when the number of the effective pixel points in the sub-picture is less than a preset number, the threshold value is a preset first threshold value, otherwise, the threshold value is a preset second threshold value;
the noise point is set to null.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an apparatus for recognizing a picture, including:
the receiving module is used for receiving the picture to be identified;
a picture processing module for cutting the picture into one or more sub-pictures;
and the picture identification module is used for inputting the sub-picture into a classifier, and the classifier marks a label for the sub-picture based on a first model obtained by pre-training so as to identify the picture.
Further, the image processing module is further configured to perform binarization and denoising processing on the sub-image.
The device for identifying the picture provided by the embodiment of the invention further comprises:
a picture training module, configured to obtain the first model through the following model training steps:
acquiring a picture set;
cutting each picture in the picture set to obtain a sub-picture set of the picture;
selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking a label for each sub-picture in the first sub-picture set;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, comparing pixels of the sub-pictures in the second sub-picture set with pixels of each sub-picture in the first sub-picture set, and marking labels for each sub-picture in the second sub-picture set according to pixel efficiency obtained by comparison;
inputting each sub-picture in the second sub-picture set into a classifier, and training the classifier based on the second sub-picture set to obtain a second model;
inputting each sub-picture in all sub-picture sets into a classifier, the classifier tagging each sub-picture based on the second model;
and inputting each sub-picture in all the sub-picture sets into a classifier, and training the classifier to obtain the first model based on all the sub-picture sets.
The device for identifying the picture provided by the embodiment of the invention further comprises:
and the iteration upgrading module is used for saving the picture if the picture is identified wrongly so as to add the picture into the picture set, and obtaining a new first model by executing the model training step.
Further, the image processing module is further configured to scan the image column by column from left to right, when a first valid pixel is found, take the abscissa of the pixel as the left boundary of a first sub-image, then continue to scan column by column, when a first completely invalid pixel column is found, take the abscissa of the column as the right boundary of the first sub-image,
scanning line by line from top to bottom between the left boundary and the right boundary of the first sub-picture, taking the ordinate of the pixel as the upper boundary of the first sub-picture when the first effective pixel is found, then continuing to scan line by line, taking the ordinate of the line as the lower boundary of the first sub-picture when the first all-ineffective pixel line is found,
and repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture.
Further, the picture processing module is further configured to determine that the effective pixel point is a noise point when the number of other effective pixel points around the effective pixel point in the sub-picture does not exceed a threshold, where the threshold is a preset first threshold when the number of effective pixel points in the sub-picture is smaller than a preset number, and otherwise, the threshold is a preset second threshold, and then the noise point is set to be invalid.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided an electronic device for recognizing a picture, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for identifying pictures provided by the embodiment of the invention.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a computer readable medium having a computer program stored thereon, where the computer program is executed by a processor to implement the method for recognizing pictures provided by the embodiments of the present invention.
According to the method and the device for identifying the picture, the picture is cut into the sub-pictures, then the sub-pictures are classified and labeled through a machine learning classification algorithm, and the information of the sub-pictures is obtained according to the labels, so that the content of the whole picture is identified, and the problems of low identification accuracy and low identification efficiency of the existing picture identification method for the fuzzy picture are solved. Moreover, the classification model of the classification algorithm can be continuously iteratively upgraded through continuous collection and analysis of the error pictures, and the accuracy of fuzzy picture identification is linearly improved. The noise data of the blurred picture can be effectively ignored after the error pictures are continuously accumulated.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a flowchart of a method for identifying a picture according to an embodiment of the present invention;
fig. 2 is a schematic application flow diagram of a method for recognizing a picture according to an embodiment of the present invention;
FIG. 3 is a flow chart of picture processing according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an apparatus for recognizing pictures according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a computer system suitable for use with the electronic device to implement an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
An embodiment of the present invention provides a method for identifying a picture, as shown in fig. 1, the method includes: step S101 to step S103.
In step S101, a picture to be recognized is received. Then, in step S102, the picture is cut into one or more sub-pictures, and the method for identifying a picture provided by the present invention may be applied to identify a text-type picture, for example, a sub-picture corresponding to a single character in a picture may be obtained by cutting the picture, and then, in a subsequent step, the character content is identified for the sub-picture in the picture.
In step S103, a sub-picture of the picture to be recognized is input into the classifier, the classifier labels the sub-picture based on the first model obtained by pre-training, and content information of the sub-picture is obtained according to the label, so as to recognize the content of the whole picture. In the present invention, the sub-picture is identified by the classifier, and the classifier may be a supervised machine learning classifier, for example, in the present invention, the sub-picture may be identified by using a classifier of a support Vector machine (svm) (support Vector machine), and of course, other supervised machine learning classification algorithms may also be used as a substitute for identifying the sub-picture in the present invention.
The method for identifying the picture cuts the picture into the sub-pictures, classifies the sub-pictures and marks the labels through the classification algorithm of machine learning, obtains the content information of the sub-pictures according to the labels, thereby identifying the content of the whole picture, and solving the problems of low accuracy and low identification efficiency of the existing picture identification method for identifying the fuzzy picture.
In the present invention, as shown in fig. 2 and 3, step S102 is a process of processing the picture, and is a basis for performing sub-picture recognition and model training in subsequent steps, where the picture may be used to train a model after being processed by the picture, or may be used as a picture to be recognized and input to a classifier for recognition after being processed by the picture. The picture processing procedure for the picture to be recognized is not shown in the figure.
The process of picture processing comprises the steps of cutting and converting the sub-picture, binarization, denoising processing, edge detection and compression processing.
For example, for a text picture to be recognized, pixel points of the picture are sequentially read, scanning is performed from top to bottom (the ordinate y of the pixel is 0y 1.. y.. n) from the left side of the picture, and if no valid pixel exists, the abscissa x coordinate of the scanned pixel is shifted to the right by one bit, and the scanning is continued. And when the effective pixel exists, recording the x coordinate of the current pixel column and interrupting scanning the current pixel column. And continuing to move right for scanning, recording the x coordinates of the current pixel column when a certain column has no effective pixels, taking the interval of two x coordinates as effective text information, and repeatedly operating and transversely scanning until the completion. And scanning transversely from top to bottom in the same way to mark the y coordinate, thereby obtaining the y coordinate interval of the effective text information. After the whole picture is scanned, a plurality of sub-pictures (sub-picture 1, sub-picture 2 …, sub-picture N) containing effective text information in the text picture are obtained.
In one embodiment of the present invention, for example, for a horizontally arranged verification code picture, the cutting may be performed by the following steps:
and scanning the picture column by column from left to right, taking the abscissa of the pixel as the left boundary of the first sub-picture when the first effective pixel is found, then continuing scanning column by column, and taking the abscissa of the column as the right boundary of the first sub-picture when the first completely invalid pixel column is found.
And scanning line by line from top to bottom between the left boundary and the right boundary of the first sub-picture, taking the vertical coordinate of the pixel as the upper boundary of the first sub-picture when the first effective pixel is found, then continuing to scan line by line, and taking the vertical coordinate of the line as the lower boundary of the first sub-picture when the first all-invalid pixel line is found.
And repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture, and finishing the cutting of the picture.
In the invention, the threshold value used for carrying out binarization on the sub-picture in the picture processing process is the intermediate value of all possible values.
In the invention, in the process of picture processing: the method comprises the steps of obtaining an intermediate result of sub-picture processing after binarization of a sub-picture, then carrying out denoising processing, carrying out statistics on effective pixel points of the sub-picture after binarization by the denoising processing, judging whether the number of other effective pixel points around the effective pixel points in the sub-picture exceeds a threshold value, and determining the effective pixel points as noise points when the number of other effective pixel points around the effective pixel points in the sub-picture does not exceed the threshold value, wherein when the number of the effective pixel points in the sub-picture is smaller than a preset number M, the threshold value is a preset first threshold value N1, otherwise, the threshold value is a preset second threshold value N2, and N2 is smaller than N1. In the invention, the reason for using different threshold processing in the denoising process is to prevent excessive denoising and loss of effective pixels, and in the practical application process, the value range of M is usually 1/20 to 1/4 of the total number of pixels, the value range of N1 is usually 4 to 8, and the value range of corresponding N2 is usually 2 to 6. In the present invention, the denoising process may further include other conventional denoising methods, such as performing gaussian blur processing on the sub-picture.
And after the noise point is determined, setting all the noise point values in the sub-picture as invalid, and further completing denoising to obtain a final result of sub-picture processing and outputting the final result.
In the present invention, in step S103, the classifier labels the sub-pictures based on a first model obtained by pre-training, where the first model is obtained by the following model training steps:
firstly, obtaining a picture set used for training a model, carrying out picture processing on each picture in the picture set, wherein the picture processing process is the same as that of the picture to be identified in the above, and carrying out cutting conversion, binaryzation, denoising processing, edge detection and compression processing on each picture in the picture set to obtain a sub-picture set of each picture after picture processing.
Selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking labels for each sub-picture in the first sub-picture set. The first sub-picture set is a small number of pictures in all sub-pictures, and taking a text-type picture as an example, the number of sub-pictures in the first sub-picture set is usually two to three times in the case of covering each text (for example, covering 10 arabic numerals and 26 letters for a verification code picture containing english and numerals), and the labeling manner may be a manual labeling manner, and each sub-picture corresponds to one label.
And then selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, wherein the second sub-picture set is a part of picture sets in all the sub-pictures, the number of the sub-pictures in the second sub-picture set is larger than that of the first sub-picture set, the number of the sub-pictures in the second sub-picture set can be determined by the difference degree of the pictures with the same information, and under the condition of lower difference, the number of the sub-pictures is usually about ten times that of the sub-pictures covered on each text.
And comparing pixels of each sub-picture in the first sub-picture set and the second sub-picture set, and marking a label for each sub-picture in the second sub-picture set in a pixel efficient mode obtained by calculating the comparison, namely comparing the sub-pictures in the second sub-picture set with each sub-picture in the first sub-picture set by one pixel, wherein the same pixels are marked as valid, and the different pixels are marked as invalid, and after the comparison is finished, the sub-pictures in the second sub-picture set take the label of the sub-picture in the first sub-picture set with the highest effective pixel number, so that the labeling of each sub-picture in the second sub-picture set is finished. After marking is completed, the specimen can be manually checked for correct labeling and the wrong labeling corrected.
Then, each sub-picture in the second sub-picture set is input into a classifier (such as a support vector machine classifier), and the picture is digitized into a pixel matrix through the support vector machine classifier, wherein each pixel point is a feature, and as the picture is processed into a fixed pixel size, a fixed high-dimensional matrix is formed and then feature analysis is performed. And the support vector machine classifier performs classification training based on the second sub-picture set to obtain a second model. And then, taking the second model as a primary training model, inputting each sub-picture in all the sub-picture sets into a classifier, and marking a label for each sub-picture by the classifier based on the second model. Likewise, after marking is completed, the specimen can be manually checked for proper labeling and the wrong label corrected.
And finally, inputting each sub-picture marked with the label in all the sub-picture sets into a support vector machine classifier, carrying out classification training on each sub-picture in the sub-picture sets by the support vector machine classifier to obtain a first model, and taking the first model as a final model for identifying the picture to be identified.
The method for identifying the picture further comprises a model iteration upgrading process. In the process: if the picture identification is correct in step S103, the identification result is output, and if the picture identification is incorrect, the incorrect picture is saved, and when a sufficient number of such incorrect pictures are accumulated, parameters of a processing link in the picture correcting process can be corrected according to the incorrect picture to improve the accuracy of the model, for example, the setting of a threshold value in the denoising process can be adjusted, the ratio of gaussian blur can be adjusted, and the like. The image can also be added into the image set to be summarized with the image in the original image set, and a new first model is regenerated by executing the model training step, so that the model is iteratively upgraded, and the accuracy of image identification is continuously improved.
The method for identifying the picture cuts the picture into the sub-pictures, classifies the sub-pictures and marks the labels through the machine learning classification algorithm, and obtains the information of the sub-pictures according to the labels, so that the content of the whole picture is identified, and the problems of low accuracy and low identification efficiency of the existing picture identification method for identifying the fuzzy picture are solved. Moreover, the classification model of the classification algorithm can be continuously iteratively upgraded through continuous collection and analysis of the error pictures, and the accuracy of fuzzy picture identification is linearly improved. The noise data of the blurred picture can be effectively ignored after the error pictures are continuously accumulated.
An embodiment of the present invention further provides an apparatus for recognizing a picture, as shown in fig. 4, the apparatus 500 includes: a receiving module 501, a picture processing module 502 and a picture identifying module 503.
The receiving module 501 is configured to receive a picture to be identified.
The picture processing module 502 is used to cut a picture into one or more sub-pictures.
The picture recognition module 503 is configured to input the sub-picture into a classifier, and the classifier labels the sub-picture based on a first model obtained through pre-training, so as to recognize the picture.
In the invention, the image processing module is further used for carrying out binarization and denoising processing on the sub-image.
The device for identifying the picture provided by the embodiment of the invention further comprises: and a picture training module.
The picture training module is used for obtaining a first model through the following model training steps:
acquiring a picture set;
cutting each picture in the picture set to obtain a sub-picture set of the picture;
selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking a label for each sub-picture in the first sub-picture set;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, comparing pixels of each sub-picture in the first sub-picture set and the second sub-picture set, and marking a label for each sub-picture in the second sub-picture set in a pixel efficient mode obtained by calculating comparison;
inputting each sub-picture in the second sub-picture set into a classifier, and training the classifier based on the second sub-picture set to obtain a second model;
inputting each sub-picture in all the sub-picture sets into a classifier, and marking each sub-picture with a label by the classifier based on a second model;
each sub-picture in all the sub-picture sets is input into a classifier, and the classifier trains and obtains a first model based on the sub-pictures.
The device for identifying the picture provided by the embodiment of the invention further comprises: and (5) an iterative upgrading module.
And the iteration upgrading module is used for saving the picture if the picture is identified wrongly so as to add the picture into the picture set, and obtaining a new first model by executing the model training step.
In the invention, the picture processing module is further used for scanning the picture column by column from left to right, when a first effective pixel is found, the abscissa of the pixel is taken as the left boundary of a first sub-picture, then the scanning column by column is continued, when a first all-invalid pixel column is found, the abscissa of the column is taken as the right boundary of the first sub-picture,
the left boundary and the right boundary of the first sub-picture are scanned line by line from top to bottom, when the first effective pixel is found, the ordinate of the pixel is taken as the upper boundary of the first sub-picture, then the line by line scanning is continued, when the first all-ineffective pixel line is found, the ordinate of the line is taken as the lower boundary of the first sub-picture,
and repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture.
In the present invention, the picture processing module is further configured to determine that the effective pixel point is a noise point when the number of other effective pixel points around the effective pixel point in the sub-picture does not exceed a threshold, where the threshold is a preset first threshold when the number of effective pixel points in the sub-picture is less than a preset number, and the threshold is a preset second threshold otherwise, and then the noise point is set to be invalid.
The device for identifying the picture cuts the picture into the sub-pictures, classifies the sub-pictures and marks the labels through the machine learning classification algorithm, and obtains the information of the sub-pictures according to the labels, so that the content of the whole picture is identified, and the problems of low accuracy and low identification efficiency of the existing picture identification method for identifying the fuzzy picture are solved. Moreover, the classification model of the classification algorithm can be continuously and iteratively upgraded through continuous analysis of the error picture, and the accuracy of fuzzy picture identification is linearly improved. The noise data of the blurred picture can be effectively ignored after the error pictures are continuously accumulated.
Referring now to FIG. 5, a block diagram of a computer system V00 suitable for use in implementing an electronic device of an embodiment of the invention is shown. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system V00 includes a Central Processing Unit (CPU) V01, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) V02 or a program loaded from a storage portion V08 into a Random Access Memory (RAM) V03. In the RAM V03, various programs and data necessary for the operation of the system V00 are also stored. The CPU V01, ROM V02, and RAM V03 are connected to each other via a bus V04. An input/output (I/O) interface V05 is also connected to bus V04.
The following components are connected to the I/O interface V05: an input section V06 including a keyboard, a mouse, and the like; an output section V07 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion V08 including a hard disk and the like; and a communication section V09 including a network interface card such as a LAN card, a modem, or the like. The communication section V09 performs communication processing via a network such as the internet. The drive V10 is also connected to the I/O interface V05 as required. A removable medium V11, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive V10 as needed, so that a computer program read out therefrom is mounted in the storage section V08 as needed.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication section V09, and/or installed from removable media V11. The above-described functions defined in the system of the present invention are executed when the computer program is executed by the Central Processing Unit (CPU) V01.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving module, a picture processing module, and a picture identification module. Where the names of these modules do not in some cases constitute a limitation of the module itself, for example, a picture processing module may also be described as a "module that slices a picture into one or more sub-pictures".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
receiving a picture to be identified;
cutting the picture into one or more sub-pictures;
and inputting the sub-picture into a classifier, and labeling the sub-picture by the classifier based on a first model obtained by pre-training so as to identify the picture.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method for recognizing pictures, comprising:
receiving a picture to be identified;
cutting the picture into one or more sub-pictures;
inputting the sub-picture into a classifier, and labeling the sub-picture by the classifier based on a first model obtained by pre-training so as to identify the picture;
wherein the first model is obtained by the following model training steps:
acquiring a picture set;
cutting each picture in the picture set to obtain a sub-picture set of the picture;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, and marking a label for each sub-picture in the second sub-picture set;
inputting each sub-picture marked with a label in the second sub-picture set into a classifier, and training the classifier based on the second sub-picture set to obtain a second model;
inputting each sub-picture in all sub-picture sets into a classifier, the classifier tagging each sub-picture based on the second model;
inputting each sub-picture marked with a label in all the sub-picture sets into a classifier, and training the classifier based on all the sub-picture sets to obtain the first model;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, and marking a label for each sub-picture in the second sub-picture set, wherein the method comprises the following steps:
selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking a label for each sub-picture in the first sub-picture set;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, comparing pixels of the sub-pictures in the second sub-picture set with pixels of each sub-picture in the first sub-picture set, and marking labels for each sub-picture in the second sub-picture set according to pixel efficiency obtained by comparison.
2. The method of claim 1, wherein segmenting the picture into one or more sub-pictures comprises binarizing and denoising the sub-pictures.
3. The method of claim 1, further comprising:
and if the picture identification is wrong, storing the picture so as to add the picture into the picture set, and obtaining a new first model by executing the model training step.
4. The method of claim 1, wherein cutting the picture comprises:
scanning the picture column by column from left to right, taking the abscissa of the pixel as the left boundary of the first sub-picture when the first effective pixel is found, then continuing to scan column by column, taking the abscissa of the column as the right boundary of the first sub-picture when the first completely ineffective pixel column is found,
scanning line by line from top to bottom between the left boundary and the right boundary of the first sub-picture, taking the ordinate of the pixel as the upper boundary of the first sub-picture when the first effective pixel is found, then continuing to scan line by line, taking the ordinate of the line as the lower boundary of the first sub-picture when the first all-ineffective pixel line is found,
and repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture.
5. The method of claim 2, wherein denoising the sub-picture comprises:
when the number of other effective pixel points around the effective pixel point in the sub-picture does not exceed a threshold value, determining the effective pixel point as a noise point, wherein when the number of the effective pixel points in the sub-picture is less than a preset number, the threshold value is a preset first threshold value, otherwise, the threshold value is a preset second threshold value;
the noise point is set to null.
6. An apparatus for recognizing pictures, comprising:
the receiving module is used for receiving the picture to be identified;
a picture processing module for cutting the picture into one or more sub-pictures;
the picture identification module is used for inputting the sub-picture into a classifier, and the classifier marks a label for the sub-picture based on a first model obtained by pre-training so as to identify the picture;
a picture training module, configured to obtain the first model through the following model training steps:
acquiring a picture set;
cutting each picture in the picture set to obtain a sub-picture set of the picture;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, and marking a label for each sub-picture in the second sub-picture set;
inputting each sub-picture marked with a label in the second sub-picture set into a classifier, and training the classifier based on the second sub-picture set to obtain a second model;
inputting each sub-picture in all sub-picture sets into a classifier, the classifier tagging each sub-picture based on the second model;
inputting each sub-picture marked with a label in all the sub-picture sets into a classifier, and training the classifier based on all the sub-picture sets to obtain the first model;
the picture training module is further configured to:
selecting sub-pictures from all the sub-picture sets to form a first sub-picture set, and marking a label for each sub-picture in the first sub-picture set;
selecting sub-pictures from all the sub-picture sets to form a second sub-picture set, comparing pixels of the sub-pictures in the second sub-picture set with pixels of each sub-picture in the first sub-picture set, and marking labels for each sub-picture in the second sub-picture set according to pixel efficiency obtained by comparison.
7. The apparatus of claim 6, wherein the picture processing module is further configured to perform binarization and denoising processing on the sub-picture.
8. The apparatus of claim 6, further comprising:
and the iteration upgrading module is used for saving the picture if the picture is identified wrongly so as to add the picture into the picture set, and obtaining a new first model by executing the model training step.
9. The apparatus of claim 6, wherein the picture processing module is further configured to scan the picture column by column from left to right, and when a first valid pixel is found, take the abscissa of the pixel as the left boundary of a first sub-picture, and then continue to scan column by column, and when a first fully invalid pixel column is found, take the abscissa of the column as the right boundary of the first sub-picture,
scanning line by line from top to bottom between the left boundary and the right boundary of the first sub-picture, taking the ordinate of the pixel as the upper boundary of the first sub-picture when the first effective pixel is found, then continuing to scan line by line, taking the ordinate of the line as the lower boundary of the first sub-picture when the first all-ineffective pixel line is found,
and repeating the process until all the pixels of the picture are scanned, so as to determine the left boundary, the right boundary, the upper boundary and the lower boundary of all the sub-pictures of the picture.
10. The apparatus of claim 7, wherein the picture processing module is further configured to determine the active pixel point as a noise point when the number of other active pixel points around the active pixel point in the sub-picture does not exceed a threshold, wherein the threshold is a preset first threshold when the number of active pixel points in the sub-picture is less than a preset number, otherwise the threshold is a preset second threshold, and then the noise point is set as invalid.
11. An electronic device for recognizing pictures, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201710537368.5A 2017-07-04 2017-07-04 Method and device for identifying picture Active CN107330470B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710537368.5A CN107330470B (en) 2017-07-04 2017-07-04 Method and device for identifying picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710537368.5A CN107330470B (en) 2017-07-04 2017-07-04 Method and device for identifying picture

Publications (2)

Publication Number Publication Date
CN107330470A CN107330470A (en) 2017-11-07
CN107330470B true CN107330470B (en) 2020-03-27

Family

ID=60197884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710537368.5A Active CN107330470B (en) 2017-07-04 2017-07-04 Method and device for identifying picture

Country Status (1)

Country Link
CN (1) CN107330470B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108236784B (en) * 2018-01-22 2021-09-24 腾讯科技(深圳)有限公司 Model training method and device, storage medium and electronic device
CN113761249A (en) * 2020-08-03 2021-12-07 北京沃东天骏信息技术有限公司 Method and device for determining picture type

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426649A (en) * 2011-10-13 2012-04-25 石家庄开发区冀科双实科技有限公司 Simple steel seal digital automatic identification method with high accuracy rate
CN103207998A (en) * 2012-12-24 2013-07-17 电子科技大学 License plate character segmentation method based on support vector machine
CN104361311A (en) * 2014-09-25 2015-02-18 南京大学 Multi-modal online incremental access recognition system and recognition method thereof
CN105760874A (en) * 2016-03-08 2016-07-13 中国科学院苏州生物医学工程技术研究所 CT image processing system and method for pneumoconiosis

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426649A (en) * 2011-10-13 2012-04-25 石家庄开发区冀科双实科技有限公司 Simple steel seal digital automatic identification method with high accuracy rate
CN103207998A (en) * 2012-12-24 2013-07-17 电子科技大学 License plate character segmentation method based on support vector machine
CN104361311A (en) * 2014-09-25 2015-02-18 南京大学 Multi-modal online incremental access recognition system and recognition method thereof
CN105760874A (en) * 2016-03-08 2016-07-13 中国科学院苏州生物医学工程技术研究所 CT image processing system and method for pneumoconiosis

Also Published As

Publication number Publication date
CN107330470A (en) 2017-11-07

Similar Documents

Publication Publication Date Title
US10817741B2 (en) Word segmentation system, method and device
CN109902622B (en) Character detection and identification method for boarding check information verification
CN110363252B (en) End-to-end trend scene character detection and identification method and system
CN108805128B (en) Character segmentation method and device
EP3176751B1 (en) Information processing device, information processing method, computer-readable recording medium, and inspection system
US7715628B2 (en) Precise grayscale character segmentation apparatus and method
US9965695B1 (en) Document image binarization method based on content type separation
US20120213429A1 (en) System and method for extracting flowchart information from digital images
CN110942074A (en) Character segmentation recognition method and device, electronic equipment and storage medium
CN111652208A (en) User interface component identification method and device, electronic equipment and storage medium
CN111507957B (en) Identity card picture conversion method and device, computer equipment and storage medium
CN107330470B (en) Method and device for identifying picture
CN111209865A (en) File content extraction method and device, electronic equipment and storage medium
CN113537184A (en) OCR (optical character recognition) model training method and device, computer equipment and storage medium
CN110969640A (en) Video image segmentation method, terminal device and computer-readable storage medium
CN112330602A (en) Intelligent trapping direction judgment method and device
KR20150099116A (en) Method for recognizing a color character using optical character recognition and apparatus thereof
CN116030472A (en) Text coordinate determining method and device
KR101048399B1 (en) Character detection method and apparatus
CN111753842B (en) Method and device for detecting text region of bill
CN111783780B (en) Image processing method, device and computer readable storage medium
JP4253265B2 (en) Shadow detection apparatus, shadow detection method and shadow detection program, image processing apparatus using shadow detection apparatus, image processing method using shadow detection method, and image processing program using shadow detection program
WO2017088478A1 (en) Number separating method and device
CN113255657B (en) Method and device for detecting scratch on bill surface, electronic equipment and machine-readable medium
CN112215783B (en) Image noise point identification method, device, storage medium and equipment

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