CN111127327A - Picture inclination detection method and device - Google Patents

Picture inclination detection method and device Download PDF

Info

Publication number
CN111127327A
CN111127327A CN201911113009.2A CN201911113009A CN111127327A CN 111127327 A CN111127327 A CN 111127327A CN 201911113009 A CN201911113009 A CN 201911113009A CN 111127327 A CN111127327 A CN 111127327A
Authority
CN
China
Prior art keywords
picture
sample
training
inclination detection
detection 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.)
Granted
Application number
CN201911113009.2A
Other languages
Chinese (zh)
Other versions
CN111127327B (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.)
Beike Technology Co Ltd
Original Assignee
Beike 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 Beike Technology Co Ltd filed Critical Beike Technology Co Ltd
Priority to CN201911113009.2A priority Critical patent/CN111127327B/en
Publication of CN111127327A publication Critical patent/CN111127327A/en
Application granted granted Critical
Publication of CN111127327B publication Critical patent/CN111127327B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/60Rotation of whole images or parts thereof
    • G06T3/608Rotation of whole images or parts thereof by skew deformation, e.g. two-pass or three-pass rotation
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/245Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a picture inclination detection method and a device, wherein the method comprises the following steps: constructing a training sample comprising a vertical picture sample and an inclined picture sample; acquiring a preset channel picture of each training sample, and training the convolutional neural network model through the preset channel picture to obtain a picture inclination detection model; and inputting the picture to be detected into a picture inclination detection model to perform inclination detection on the picture to be detected. According to the picture inclination detection method and device provided by the embodiment of the invention, the training sample consisting of the vertical picture sample and the inclined picture sample is constructed, the preset channel picture of the training sample is input into the convolutional neural network model for training to obtain the picture inclination detection model, and then the picture inclination detection model is used for detecting whether the picture is inclined or not, so that the automatic extraction and identification of the picture inclination characteristics are realized, the picture classification is carried out, the picture inclination detection under a complex daily scene can be realized, and compared with the prior art, the identification rate and the robustness are improved, and the time and the labor are saved.

Description

Picture inclination detection method and device
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a picture inclination detection method and device.
Background
Due to the position and other conditions of the shot picture, the shot picture is often in an inclined state, and particularly for a square structure such as a house, the appearance of the picture is seriously influenced by the inclined condition.
The inclination correction is an important part of picture preprocessing, and the existing inclination correction method mainly focuses on the aspects of certificates and texts with rectangular frame edges. The image tilt detection is the basis of image rectification, and the existing tilt detection method mainly adopts a traditional image processing method, and mainly comprises the following steps: a line-based method and a projection-based method. The method based on the straight line mainly utilizes hough transformation to detect the horizontal straight line and the longitudinal straight line, and then judges whether the straight line inclines or not according to the angle of the straight line. The method based on projection projects pictures at different angles to obtain a plurality of projection pictures, and the inclination angle is calculated according to certain statistical characteristics of the projection pictures, but the method needs to project the whole picture and has more projection directions, needs a large amount of calculation, and has greatly increased error probability along with the increase of the size and complexity of the picture. Moreover, the result of the method based on the traditional picture processing is greatly influenced by the super-parameter setting, and the method has a good effect only by adjusting parameters for different scenes and has poor robustness.
It can be seen that the picture tilt detection in a complex daily scene is also a difficult point.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for detecting a picture tilt.
In a first aspect, an embodiment of the present invention provides a method for detecting a picture tilt, including: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample; acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model; and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
Further, the vertical picture sample is provided with a label for indicating that the picture is vertical, and the oblique picture sample is provided with a label for indicating that the picture is oblique; the training of the convolutional neural network model through the preset channel picture of the training sample to obtain the picture inclination detection model comprises the following steps: inputting the preset channel picture into the convolutional neural network model, and training the convolutional neural network model by taking the label of the training sample corresponding to the preset channel picture as output to obtain the picture inclination detection model.
Further, the step of training the convolutional neural network model through the preset channel picture of the training sample to obtain a picture tilt detection model further includes: dividing the training samples into a training set and a verification set according to a set proportion; training a convolutional neural network model through a preset channel picture of the training sample in the training set to obtain a picture inclination detection model weight; and evaluating the accuracy and reliability of the picture tilt detection model weight through the preset channel pictures of the training samples in the verification set to obtain the optimized picture tilt detection model weight.
Further, the preset channel pictures comprise preset feature pictures with a preset number, and each preset feature picture corresponds to a picture of one channel; the acquiring the preset channel picture of each training sample in the training samples is performed by the following steps: and acquiring an x-direction gradient image, a y-direction gradient image and a gray scale image of each training sample in the training samples, and overlapping the x-direction gradient image, the y-direction gradient image and the gray scale image to form the three-channel image.
Further, the acquiring an x-direction gradient map and a y-direction gradient map of each training sample in the training samples specifically includes: and converting the training sample into an hsv space, and extracting the x-direction gradient map and the y-direction gradient map of a hue h channel by using a sobel operator.
Further, prior to the transforming the training sample to the hsv space, the method further comprises: performing histogram equalization on the training samples.
Further, the constructing the training sample includes: acquiring the vertical picture sample, and performing sample augmentation on the vertical picture sample according to a preset picture augmentation rule; and obtaining an inclined picture sample according to the vertical picture sample subjected to the sample augmentation.
Further, the preset picture augmentation rule includes: at least one of randomly cropping the picture, randomly scaling, randomly horizontal flipping, and randomly vertical flipping.
Further, the obtaining of the oblique picture sample according to the vertical picture sample after the sample augmentation includes: and rotating the vertical picture sample subjected to sample augmentation and extracting the maximum inscribed rectangle in the overlapped region before and after rotation to obtain the inclined picture sample.
Further, the rotating the vertical picture sample after the sample augmentation includes: and selecting a rotation degree by taking normal distribution as probability to randomly rotate the vertical picture sample subjected to sample augmentation.
Further, the convolutional neural network model is a multi-scale residual error network model, and the convolutional neural network model comprises a cascade residual error module, a multi-scale pooling module and a full connection module which are connected in sequence.
Further, the cascade residual modules comprise 9 cascade residual modules, each residual module is superposed by 1 × 1 convolution, 3 × 3 convolution and 1 × 1 convolution, wherein the 3 rd residual module and the 6 th residual module are followed by a maximum pooling layer, and the 9 th residual module is connected with the multi-scale pooling module; wherein, the activation function in the convolutional layer adopts relu.
Further, the pooling kernels of the multi-scale pooling module are respectively 16 × 16, 8 × 8, 4 × 4, 2 × 2, and four layers in total are in parallel, and each layer of pooling is followed by 1 3 × 3 convolution and 1 × 1 convolution and global average pooling layer.
Furthermore, the full-connection module comprises two full-connection layers, a dropout layer is arranged between the two full-connection layers, and the latter full-connection layer maps the probability value of the picture as inclination by using a sigmoid function.
In a second aspect, an embodiment of the present invention provides a picture tilting detection apparatus, including: a sample construction module to: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample; the image inclination detection model building module is used for: acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model; a tilt detection module to: and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
Further, the vertical picture sample is provided with a label for indicating that the picture is vertical, and the oblique picture sample is provided with a label for indicating that the picture is oblique; the image tilt detection model construction module is used for training the convolutional neural network model through the preset channel image of the training sample to obtain an image tilt detection model, and is specifically used for: inputting the preset channel picture into the convolutional neural network model, and training the convolutional neural network model by taking the label of the training sample corresponding to the preset channel picture as output to obtain the picture inclination detection model.
Further, the image tilt detection model construction module, when being used for training the convolutional neural network model through the preset channel image of the training sample to obtain the image tilt detection model, is further used for: dividing the training samples into a training set and a verification set according to a set proportion; training a convolutional neural network model through a preset channel picture of the training sample in the training set to obtain a picture inclination detection model weight; and evaluating the accuracy and reliability of the picture tilt detection model weight through the preset channel pictures of the training samples in the verification set to obtain the optimized picture tilt detection model weight.
Further, the preset channel pictures comprise preset feature pictures with a preset number, and each preset feature picture corresponds to a picture of one channel; the preset channel picture is a three-channel picture, and the picture tilt detection model construction module is specifically configured to, when being configured to obtain the preset channel picture of each training sample in the training samples: and acquiring an x-direction gradient image, a y-direction gradient image and a gray scale image of each training sample in the training samples, and overlapping the x-direction gradient image, the y-direction gradient image and the gray scale image to form the three-channel image.
Further, when the image tilt detection model building module is configured to obtain an x-direction gradient map and a y-direction gradient map of each training sample in the training samples, the image tilt detection model building module is specifically configured to: and converting the training sample into an hsv space, and extracting the x-direction gradient map and the y-direction gradient map of a hue h channel by using a sobel operator.
Further, the picture tilt detection model construction module, prior to the transforming the training samples to the hsv space, is further configured to: performing histogram equalization on the training samples.
Further, when the sample construction module is used for constructing a training sample, the sample construction module is specifically configured to: acquiring the vertical picture sample, and performing sample augmentation on the vertical picture sample according to a preset picture augmentation rule; and obtaining an inclined picture sample according to the vertical picture sample subjected to the sample augmentation.
Further, the preset picture augmentation rule includes: at least one of randomly cropping the picture, randomly scaling, randomly horizontal flipping, and randomly vertical flipping.
Further, when the sample construction module is configured to obtain an oblique picture sample according to the vertical picture sample after the sample augmentation, the sample construction module is specifically configured to: and rotating the vertical picture sample subjected to sample augmentation and extracting the maximum inscribed rectangle in the overlapped region before and after rotation to obtain the inclined picture sample.
Further, when the sample construction module is configured to rotate the vertical picture sample after the sample augmentation, the sample construction module is specifically configured to: and selecting a rotation degree by taking normal distribution as probability to randomly rotate the vertical picture sample subjected to sample augmentation.
Further, the convolutional neural network model is a multi-scale residual error network model, and the convolutional neural network model comprises a cascade residual error module, a multi-scale pooling module and a full connection module which are connected in sequence.
Further, the cascade residual modules comprise 9 cascade residual modules, each residual module is superposed by 1 × 1 convolution, 3 × 3 convolution and 1 × 1 convolution, wherein the 3 rd residual module and the 6 th residual module are followed by a maximum pooling layer, and the 9 th residual module is connected with the multi-scale pooling module; wherein, the activation function in the convolutional layer adopts relu.
Further, the pooling kernels of the multi-scale pooling module are respectively 16 × 16, 8 × 8, 4 × 4, 2 × 2, and four layers in total are in parallel, and each layer of pooling is followed by 1 3 × 3 convolution and 1 × 1 convolution and global average pooling layer.
Furthermore, the full-connection module comprises two full-connection layers, a dropout layer is arranged between the two full-connection layers, and the latter full-connection layer maps the probability value of the picture as inclination by using a sigmoid function.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method provided in the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method as provided in the first aspect.
According to the picture inclination detection method and device provided by the embodiment of the invention, the training sample consisting of the vertical picture sample and the inclined picture sample is constructed, the preset channel picture of the training sample is input into the convolutional neural network model for training to obtain the picture inclination detection model, and then the picture inclination detection model is used for detecting whether the picture is inclined or not, so that the automatic extraction and identification of the picture inclination characteristics are realized, the picture classification is carried out, the picture inclination detection under a complex daily scene can be realized, and compared with the prior art, the identification rate and the robustness are improved, and the time and the labor are saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for detecting a tilt of a picture according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a process for constructing a picture tilt detection model in the picture tilt detection method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a convolutional neural network model in a picture tilt detection method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a residual error module in a convolutional neural network model in a picture tilt detection method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus for detecting a picture tilt according to an embodiment of the present invention;
fig. 6 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a method for detecting a picture tilt according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step 101, constructing a training sample, wherein the training sample comprises a vertical picture sample and an oblique picture sample.
According to the embodiment of the invention, whether the picture is inclined or not is detected by a machine learning method, and firstly, a picture inclination detection model for detecting the picture inclination needs to be obtained by training. To train to obtain the image tilt detection model, a training sample needs to be constructed first. The training samples should include vertical picture samples and oblique picture samples, so that the neural network can learn the difference between the vertical picture samples and the oblique picture samples in the image characteristics, and thus, the picture classification is facilitated. For example, if the probability that the picture is tilted is high, it can be determined that the picture is tilted.
102, obtaining a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel pictures of the training samples to obtain a picture inclination detection model.
The preset channel pictures comprise preset feature pictures with preset quantity, and each preset feature picture corresponds to one channel. The preset channel picture has a preset channel number, and the preset feature picture of each channel can be preset to be of a picture type. And acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model.
And 103, inputting a picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
Different from the traditional picture inclination detection, the picture inclination detection model is constructed by using the convolutional neural network model, the picture inclination detection model is used for inclination detection, and the picture inclination detection model can automatically identify the inclination or vertical characteristics of the picture, so that whether the picture is inclined or not can be judged, and the method and the device are suitable for daily complex picture inclination detection.
According to the picture inclination detection method provided by the embodiment of the invention, the training sample consisting of the vertical picture sample and the inclined picture sample is constructed, the preset channel picture of the training sample is input into the convolutional neural network model for training to obtain the picture inclination detection model, and then the picture inclination detection model is used for detecting whether the picture is inclined or not, so that the automatic extraction, identification and picture classification of the picture inclination characteristics are realized, the picture inclination detection under a complex daily scene can be realized, and compared with the prior art, the identification rate and robustness are improved, and the time and the labor are saved.
The image inclination detection model is used for detecting the image inclination, and firstly, the image inclination detection model needs to be constructed.
Fig. 2 is a schematic diagram of a construction process of a picture tilt detection model in the picture tilt detection method according to an embodiment of the present invention. Fig. 3 is a schematic structural diagram of a convolutional neural network model in the picture tilt detection method according to an embodiment of the present invention. Fig. 4 is a schematic structural diagram of a residual error module in a convolutional neural network model in the picture tilt detection method according to an embodiment of the present invention. The process of constructing the picture tilt detection model is specifically described below with reference to fig. 2, 3, and 4.
Step 201, collecting a vertical picture sample, augmenting data and generating an oblique picture sample.
And (3) shooting a normal vertical sample picture by using a camera or a mobile phone, and amplifying data after the vertical picture sample is generated. Random augmentation data, including randomly cropped pictures, e.g., randomly cropping regions of the size of the artwork 1/4; random scaling, for example, the amplitude of the random scaling is 80% to 120% of the original picture; and randomly performing horizontal turning and other operations on the picture.
The oblique picture sample is obtained by rotating the normal vertical picture sample, and the network can learn the difference before and after the sample rotation, namely the oblique characteristic. And randomly rotating the vertical picture sample, wherein the probability of the picture with higher inclination amplitude in the actual scene is smaller, so that the picture is randomly rotated by selecting the rotation degree by taking normal distribution as probability. The method comprises the steps of randomly rotating a normal vertical picture sample, enabling the rotation range to be [ -90,90] degrees, enabling the selection probability of the rotation angle to be normal distribution, enabling the mean value and the variance to be (0, 0.01) respectively, rotating by taking the picture center as an original point, calculating the maximum inscribed rectangle of the overlapped area before and after rotation, and cutting out the maximum rectangle area to serve as an inclined picture sample.
Step 202, data preprocessing.
In order to avoid the situations of overexposure and over-darkness of the picture, histogram equalization is carried out on the sample picture, and the picture contrast is increased. In order to reduce the influence of illumination and the like, each sample picture is converted into an hsv space, and an x gradient picture and a y gradient picture of a hue h channel are extracted by a sobel operator. And acquiring a gray image of each sample picture, and superposing the gray image, the gradient in the x direction, the gradient in the y direction and the three single-channel pictures together to form a three-channel picture as network input.
And step 203, constructing a multi-scale residual error network.
The multi-scale residual error network comprises a cascade residual error module, a multi-scale pooling module and a full-connection module which are connected in sequence.
The multi-scale residual error network model consists of 9 residual error modules, 1 multi-scale pooling module and 2 full-connection modules. Each residual module is superposed by 1 × 1 convolution, 3 × 3 convolution and 1 × 1 convolution, the activation function in the convolution layer uses relu, and each 3 residual modules are followed by a maximum pooling layer (the last residual module is followed by a multi-scale pooling module). The multi-scale pooling module has pooling kernels of 16 × 16, 8 × 8, 4 × 4 and 2 × 2 respectively, and a total of four layers are parallel, each layer of pooling is followed by 3 × 3 convolution and 1 × 1 convolution and global average pooling, and finally four layers of results are connected in series (splicing operation) to serve as the characteristics of the pictures and then are sent to the fully-connected layers for classification. Dropout layers with the proportion of 0.5 are arranged between all the connection layers, and finally, the output result is mapped into the probability value of whether the connection layer is inclined or not by using sigmoid.
Step 204, model training and testing.
Dividing the picture sample into a training set and a verification set, carrying out iterative training on the designed convolutional neural network model by using the training set to obtain model weight, and carrying out accuracy and reliability evaluation on the model weight obtained by training by using the verification set to obtain optimized model weight.
For example, the picture samples are divided into a training set and a verification set according to a ratio of 9:1, the model is trained on the training samples by using an SGD random gradient descent method, the initial learning rate is 0.001, the momentum parameter is 0.9, and the learning rate is attenuated by 10 times every 30 epochs. And in addition, after each epoch is finished, carrying out accuracy and reliability evaluation on the model weight on the verification sample to obtain the optimized model weight.
Compared with the prior art, the image inclination detection method based on the convolutional neural network provided by the embodiment of the invention has the advantages and positive effects that: the convolutional neural network model is established, so that automatic extraction, identification and classification of the image tilt characteristics are realized, and compared with the prior art, the recognition rate and robustness are improved, and the time and the labor are saved.
Fig. 5 is a schematic structural diagram of a picture tilt detection apparatus according to an embodiment of the present invention. As shown in fig. 5, the apparatus includes: sample construction module 10, picture slope detection model construction module 20 and slope detection module 30, wherein: the sample construction module 10 is used to: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample; the picture tilt detection model building module 20 is configured to: acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model; the tilt detection module 30 is configured to: and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
According to the picture inclination detection device provided by the embodiment of the invention, the training sample consisting of the vertical picture sample and the inclined picture sample is constructed, the preset channel picture of the training sample is input into the convolutional neural network model for training to obtain the picture inclination detection model, and then the picture inclination detection model is used for detecting whether the picture is inclined or not, so that the automatic extraction, identification and picture classification of the picture inclination characteristics are realized, the picture inclination detection under a complex daily scene can be realized, and compared with the prior art, the picture inclination detection device has the advantages that the identification rate and the robustness are improved, and the time and the labor are saved.
The apparatus provided in the embodiment of the present invention is used for the method, and specific functions may refer to the method flow described above, which is not described herein again.
Fig. 6 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 6, the electronic device may include: a processor (processor)610, a communication Interface (Communications Interface)620, a memory (memory)630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logic instructions in the memory 630 to perform the following method: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample; acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model; and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
In addition, the logic instructions in the memory 630 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented by a processor to perform the method provided by the foregoing embodiments, for example, including: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample; acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model; and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A picture tilt detection method is characterized by comprising the following steps:
constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample;
acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model;
and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
2. The picture inclination detection method according to claim 1, wherein the vertical picture sample is provided with a label indicating that the picture is vertical, and the inclined picture sample is provided with a label indicating that the picture is inclined;
the training of the convolutional neural network model through the preset channel picture of the training sample to obtain the picture inclination detection model comprises the following steps:
inputting the preset channel picture into the convolutional neural network model, and training the convolutional neural network model by taking the label of the training sample corresponding to the preset channel picture as output to obtain the picture inclination detection model.
3. The method according to claim 1 or 2, wherein the step of training a convolutional neural network model through a preset channel picture of the training sample to obtain a picture tilt detection model further comprises:
dividing the training samples into a training set and a verification set according to a set proportion;
training a convolutional neural network model through a preset channel picture of the training sample in the training set to obtain a picture inclination detection model weight;
and evaluating the accuracy and reliability of the picture tilt detection model weight through the preset channel pictures of the training samples in the verification set to obtain the optimized picture tilt detection model weight.
4. The method according to claim 1, wherein the preset channel pictures comprise a preset number of preset feature pictures, and each preset feature picture corresponds to a picture of one channel;
the acquiring the preset channel picture of each training sample in the training samples is performed by the following steps:
and acquiring an x-direction gradient image, a y-direction gradient image and a gray scale image of each training sample in the training samples, and overlapping the x-direction gradient image, the y-direction gradient image and the gray scale image to form the three-channel image.
5. The method according to claim 4, wherein the obtaining of the x-direction gradient map and the y-direction gradient map of each training sample in the training samples specifically includes:
and converting the training sample into an hsv space, and extracting the x-direction gradient map and the y-direction gradient map of a hue h channel by using a sobel operator.
6. The method of claim 5, wherein prior to said transforming the training samples into the hsv space, the method further comprises:
performing histogram equalization on the training samples.
7. The method according to claim 1, wherein the constructing a training sample comprises:
acquiring the vertical picture sample, and performing sample augmentation on the vertical picture sample according to a preset picture augmentation rule;
and obtaining an inclined picture sample according to the vertical picture sample subjected to the sample augmentation.
8. A picture tilt detection apparatus, comprising:
a sample construction module to: constructing a training sample, wherein the training sample comprises a vertical picture sample and an inclined picture sample;
the image inclination detection model building module is used for: acquiring a preset channel picture of each training sample in the training samples, and training a convolutional neural network model through the preset channel picture of the training sample to obtain a picture inclination detection model;
a tilt detection module to: and inputting the picture to be detected into the picture inclination detection model, and performing inclination detection on the picture to be detected according to the output of the picture inclination detection model.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the picture tilt detection method according to any one of claims 1 to 7 when executing the computer program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the picture tilt detection method according to any one of claims 1 to 7.
CN201911113009.2A 2019-11-14 2019-11-14 Picture inclination detection method and device Active CN111127327B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911113009.2A CN111127327B (en) 2019-11-14 2019-11-14 Picture inclination detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911113009.2A CN111127327B (en) 2019-11-14 2019-11-14 Picture inclination detection method and device

Publications (2)

Publication Number Publication Date
CN111127327A true CN111127327A (en) 2020-05-08
CN111127327B CN111127327B (en) 2024-04-12

Family

ID=70495599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911113009.2A Active CN111127327B (en) 2019-11-14 2019-11-14 Picture inclination detection method and device

Country Status (1)

Country Link
CN (1) CN111127327B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464852A (en) * 2020-12-09 2021-03-09 重庆大学 Self-adaptive correction and identification method for vehicle driving license picture

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106951848A (en) * 2017-03-13 2017-07-14 平安科技(深圳)有限公司 The method and system of picture recognition
CN107273832A (en) * 2017-06-06 2017-10-20 青海省交通科学研究院 Licence plate recognition method and system based on integrating channel feature and convolutional neural networks
US20180260621A1 (en) * 2017-03-10 2018-09-13 Baidu Online Network Technology (Beijing) Co., Ltd. Picture recognition method and apparatus, computer device and computer- readable medium
CN108830213A (en) * 2018-06-12 2018-11-16 北京理工大学 Car plate detection and recognition methods and device based on deep learning
CN109961006A (en) * 2019-01-30 2019-07-02 东华大学 A kind of low pixel multiple target Face datection and crucial independent positioning method and alignment schemes
KR20190091101A (en) * 2018-01-26 2019-08-05 지의소프트 주식회사 Automatic classification apparatus and method of document type using deep learning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180260621A1 (en) * 2017-03-10 2018-09-13 Baidu Online Network Technology (Beijing) Co., Ltd. Picture recognition method and apparatus, computer device and computer- readable medium
CN106951848A (en) * 2017-03-13 2017-07-14 平安科技(深圳)有限公司 The method and system of picture recognition
CN107273832A (en) * 2017-06-06 2017-10-20 青海省交通科学研究院 Licence plate recognition method and system based on integrating channel feature and convolutional neural networks
KR20190091101A (en) * 2018-01-26 2019-08-05 지의소프트 주식회사 Automatic classification apparatus and method of document type using deep learning
CN108830213A (en) * 2018-06-12 2018-11-16 北京理工大学 Car plate detection and recognition methods and device based on deep learning
CN109961006A (en) * 2019-01-30 2019-07-02 东华大学 A kind of low pixel multiple target Face datection and crucial independent positioning method and alignment schemes

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
傅鹏;谢世朋;: "基于级联卷积神经网络的车牌定位", no. 01, pages 140 - 143 *
徐文渊等: "基于卷积神经网络的复杂档案图像倾斜校正方法研究", 《全国第三届"智能电网"会议论文集》, pages 294 - 300 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464852A (en) * 2020-12-09 2021-03-09 重庆大学 Self-adaptive correction and identification method for vehicle driving license picture
CN112464852B (en) * 2020-12-09 2023-12-05 重庆大学 Vehicle driving license picture self-adaptive correction and identification method

Also Published As

Publication number Publication date
CN111127327B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
JP6926335B2 (en) Variable rotation object detection in deep learning
CN110163198B (en) Table identification reconstruction method and device and storage medium
CN108334848B (en) Tiny face recognition method based on generation countermeasure network
CN109815770B (en) Two-dimensional code detection method, device and system
CN106683048B (en) Image super-resolution method and device
CN110866871A (en) Text image correction method and device, computer equipment and storage medium
CN105574550A (en) Vehicle identification method and device
CN111079739B (en) Multi-scale attention feature detection method
CN111680690B (en) Character recognition method and device
CN111445459A (en) Image defect detection method and system based on depth twin network
EP3702957A1 (en) Target detection method and apparatus, and computer device
CN109389105B (en) Multitask-based iris detection and visual angle classification method
CN112001403B (en) Image contour detection method and system
CN111626249B (en) Method and device for identifying geometric figure in topic image and computer storage medium
US11605210B2 (en) Method for optical character recognition in document subject to shadows, and device employing method
CN111353325A (en) Key point detection model training method and device
CN115082941A (en) Form information acquisition method and device for form document image
CN113850238B (en) Document detection method and device, electronic equipment and storage medium
CN113936288A (en) Inclined text direction classification method and device, terminal equipment and readable storage medium
CN111127327B (en) Picture inclination detection method and device
CN111310751A (en) License plate recognition method and device, electronic equipment and storage medium
CN113269752A (en) Image detection method, device terminal equipment and storage medium
CN116246161A (en) Method and device for identifying target fine type of remote sensing image under guidance of domain knowledge
CN112308061B (en) License plate character recognition method and device
CN115311680A (en) Human body image quality detection method and device, electronic equipment and storage medium

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