Disclosure of Invention
The invention aims to provide a picture detection method and a picture detection device, which can improve the quality of uploaded pictures by increasing the picture background purity and the main body position compliance detection items.
In order to achieve the above object, an aspect of the present invention provides a picture detection method, including:
acquiring a denoised picture to be detected, and identifying a main body region image and a background region image after pixel-level semantic segmentation processing;
Performing color space conversion on the picture to be detected, and outputting tone space data and brightness space data of the image;
fusing the expanded main area image with the hue space data, extracting a background purity value corresponding to each pixel in a background area image formed after expansion, and judging whether the background purity of the picture to be detected is in compliance or not;
processing the brightness space data in multiple binarization modes, and correspondingly outputting multiple binarization results;
and respectively fusing the main body region image with various binarization results, extracting the coordinate value and the corresponding background purity value of each pixel in the fused main body region image, and judging whether the main body position of the picture to be detected is in compliance.
Preferably, the method for acquiring the denoised picture to be detected and identifying the image of the main body region and the image of the background region after the pixel-level semantic segmentation processing comprises the following steps:
denoising the picture to be detected by adopting a nonlinear filtering method;
and performing pixel-level semantic segmentation on the denoised picture to be detected through a multi-channel depth residual full convolution network model, and identifying a main body region image and a background region image.
Preferably, the method of performing color space conversion on a picture to be tested and outputting hue space data and lightness space data of an image includes:
Converting hue space data of an output image of a picture to be detected by adopting an HSV color space conversion method, wherein the hue space data comprises a hue space component H;
and converting brightness space data of an output image of the picture to be detected by adopting an LUV color space conversion method, wherein the brightness space data comprises a brightness space channel L.
Preferably, the method for fusing the expanded main region image with the hue space data, extracting the background purity value corresponding to each pixel in the background region image formed after the expansion processing, and determining whether the background purity of the picture to be detected is compliant includes:
filtering processing is carried out on edge pixels of the main body area image through a filtering core so as to expand the main body area image;
updating the part of the picture to be detected except the expanded main body area image into a background area image;
fusing the updated background area image with the data of the tone space component H, and judging whether the background purity values corresponding to all pixels in the updated background area image all accord with a first threshold value, if so, judging that the background purity of the picture to be detected is in compliance, otherwise, judging that the background purity of the picture to be detected is not in compliance;
the first threshold comprises a first background purity threshold.
Preferably, the lightness space data is processed by a plurality of binarization modes, and the corresponding method for outputting a plurality of binarization results comprises:
processing data of the lightness space channel L in a fixed threshold value binarization mode to obtain a first binarization result;
and processing the data of the lightness space channel L in a Gaussian window binarization mode to obtain a second binarization result.
Further, after correspondingly outputting a plurality of binarization results, the method further comprises:
and respectively carrying out incoherent region suppression processing on the first binarization result and the second binarization result by adopting a non-maximum value suppression method.
Further, the method for fusing the main body region image with various binarization results respectively, extracting the coordinate value of each pixel in the fused main body region image and the corresponding background purity value, and judging whether the main body position of the picture to be detected is in compliance or not comprises the following steps:
respectively fusing the main body area image identified by pixel-level semantic segmentation processing with the first binarization result and the second binarization result;
extracting the coordinate values and the corresponding background purity values of the pixels belonging to the main body area image and the first binarization result from the fusion result, and extracting the coordinate values and the corresponding background purity values of the pixels belonging to the main body area image and the second binarization result from the fusion result;
Summarizing and extracting the coordinate values of the pixels and the corresponding background purity values, judging whether the coordinate values of the pixels and the corresponding background purity values all accord with a second threshold value, if so, judging that the main body position of the picture to be detected is in compliance, otherwise, judging that the main body position of the picture to be detected is not in compliance;
the second threshold includes a second background purity threshold and a location coordinate interval threshold.
Compared with the prior art, the picture detection method provided by the invention has the following beneficial effects:
in the picture detection method provided by the invention, firstly, a main body area image and a background area image are identified by a to-be-detected picture subjected to pixel level semantic segmentation and denoising, then, color space conversion is carried out on the to-be-detected picture, and tone space data and lightness space data of the picture are output: when the background purity detection item is carried out, the coarseness of the edge pixel processing of the main body area image and the background area image is considered in the pixel-level semantic segmentation, so that in order to ensure that the main body area image can be completely covered, the invention expands the range of the edge pixel of the main body area image by carrying out expansion processing on the main body area image, then fuses the expanded main body area image and the tone space data, and finally judges whether the background purity of the picture to be detected is in compliance or not according to the background purity value corresponding to each pixel of the background area image in the fusion result; when a main body position detection item is carried out, firstly, brightness space data is processed in multiple binarization modes to obtain multiple binarization results corresponding to the brightness space data, then, a main body area image subjected to pixel level semantic segmentation is respectively fused with the multiple binarization results, and finally, whether the main body position of the picture to be detected is in compliance or not is judged based on the coordinate value of each pixel in the fused main body area image and the corresponding background purity value.
Therefore, the method and the device realize the detection of the background purity and the main body position of the uploaded picture, and greatly improve the auditing efficiency compared with the manual auditing mode in the prior art.
Another aspect of the present invention provides a picture detection apparatus, which is applied in the picture detection method mentioned in the above technical solution, and the apparatus includes:
the pixel processing unit is used for acquiring the denoised picture to be detected, and identifying a main body region image and a background region image after pixel-level semantic segmentation processing;
the color space conversion unit is used for performing color space conversion on the picture to be detected and outputting tone space data and lightness space data of the image;
the first judgment unit is used for fusing the expanded main area image and the tone space data, extracting a background purity value corresponding to each pixel in a background area image formed after the expansion processing, and judging whether the background purity of the picture to be detected is in compliance or not;
a binarization processing unit, which is used for processing the lightness space data through a plurality of binarization modes and correspondingly outputting a plurality of binarization results;
and the second judgment unit is used for fusing the main body area image with various binarization results respectively, extracting the coordinate value of each pixel in the fused main body area image and the corresponding background purity value, and judging whether the main body position of the picture to be detected is in compliance or not.
Preferably, between the binarization processing unit and the second judging unit, further comprising:
and respectively carrying out incoherent region suppression processing on the first binarization result and the second binarization result by adopting a non-maximum value suppression method.
Compared with the prior art, the beneficial effects of the picture detection device provided by the invention are the same as those of the picture detection method provided by the technical scheme, and are not repeated herein.
A third aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above-mentioned picture detection method.
Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the invention are the same as those of the image detection method provided by the technical scheme, and are not repeated herein.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the 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.
Example one
Referring to fig. 1 and fig. 2, the present embodiment provides a method for detecting a picture, including:
acquiring a denoised picture to be detected, and identifying a main body region image and a background region image after pixel-level semantic segmentation processing; performing color space conversion on the picture to be detected, and outputting tone space data and brightness space data of the image; fusing the expanded main area image with the tone space data, extracting a background purity value corresponding to each pixel in a background area image formed after expansion, and judging whether the background purity of the picture to be detected is in compliance or not; processing lightness space data in multiple binarization modes, and correspondingly outputting multiple binarization results; and respectively fusing the main body area image with various binarization results, extracting the coordinate value and the corresponding background purity value of each pixel in the fused main body area image, and judging whether the main body position of the picture to be detected is in compliance or not.
In the image detection method provided in this embodiment, a main body region image and a background region image are first identified by segmenting and denoising a to-be-detected image at a pixel level semantic, and then color space conversion is performed on the to-be-detected image to output tone space data and brightness space data of the image: when the background purity detection item is performed, the fact that the edge pixels of the main body area image and the background area image are processed in a rough manner by pixel-level semantic segmentation is considered, so that the main body area image can be completely covered, the embodiment expands the range of the edge pixels of the main body area image by expanding the main body area image, then fuses the expanded main body area image and the tone space data, and finally judges whether the background purity of the picture to be detected is in compliance or not according to the background purity value corresponding to each pixel of the background area image in the fusion result; when a main body position detection item is carried out, firstly, brightness space data is processed in multiple binarization modes to obtain multiple binarization results corresponding to the brightness space data, then, a main body area image subjected to pixel level semantic segmentation is respectively fused with the multiple binarization results, and finally, whether the main body position of the picture to be detected is in compliance or not is judged based on the coordinate value of each pixel in the fused main body area image and the corresponding background purity value.
Therefore, the embodiment realizes the detection of the background purity and the main body position of the uploaded picture, and greatly improves the auditing efficiency compared with a manual auditing mode in the prior art.
In the above embodiment, the method for acquiring a denoised to-be-detected picture and identifying a main body region image and a background region image after pixel-level semantic segmentation processing includes:
denoising the picture to be detected by adopting a nonlinear filtering method; and performing pixel-level semantic segmentation on the denoised picture to be detected through a multi-channel depth residual full convolution network model, and identifying a main body region image and a background region image. Illustratively, the nonlinear filtering method is a median filtering denoising algorithm.
Specifically, the method for performing color space conversion on a picture to be tested and outputting hue space data and brightness space data of an image in the above embodiment includes:
converting hue space data of an output image of the picture to be detected by adopting an HSV color space conversion method, wherein the hue space data comprises a hue space component H; and converting brightness space data of an output image of the picture to be detected by adopting an LUV color space conversion method, wherein the brightness space data comprises a brightness space channel L.
In specific implementation, for the conversion of the hue space data, considering that the commonly used RGB color space is provided based on computer hardware, and the color space is not suitable for the characterization of color purity, the embodiment uses the HSV color space conversion method to convert the to-be-detected picture in the RGB color space into the HSV color space closer to the human visual perception characteristic, so as to enhance the color purity characterization capability, and further improve the accuracy of background purity detection. The conversion formula is as follows:
Because the lightness space data has the characteristics of wider color gamut coverage, better vision uniformity and stronger vision color perception expression capability, the implementation needs to implement the conversion of the lightness space data on the picture to be detected, and specifically comprises the following steps: firstly, RGB space data of a picture to be detected is converted into CIE XYZ space data, and then the CIE XYZ space data are converted into LUV brightness space data. The conversion formula is as follows:
μ=13×L×(μ′-μ n ′)
v=13×L×(v′-v n ′)
wherein, mu n ' and v n ' is a constant value of the light source, Y n Is a preset fixed value;
specifically, in the above embodiment, the method for fusing the expanded main area image with the hue space data, extracting the background purity value corresponding to each pixel in the background area image formed after the expansion processing, and determining whether the background purity of the to-be-detected picture is compliant includes:
filtering processing is carried out on edge pixels of the main area image through a filtering core so as to expand the main area image; updating the part of the picture to be detected except the expanded main body area image into a background area image; fusing the updated background area image with the data of the tone space component H, and judging whether the background purity values corresponding to all pixels in the updated background area image all accord with a first threshold value, if so, judging that the background purity of the picture to be detected is in compliance, otherwise, judging that the background purity of the picture to be detected is not in compliance; the first threshold comprises a first background purity threshold.
In specific implementation, a circular filter kernel k is selected to filter pixels of the image of the main region, and a circular filter kernel with a radius of 4 is taken as an example to explain:
the filter processing formula is as follows:
in the above formula, (i, j) represents pixel coordinates, P represents a subject region image, and Z
ij Representing the corresponding background purity value of the pixel,
the method comprises the steps of representing a depocenter neighborhood region corresponding to each pixel by taking a circular filter kernel k as a mask, B representing a main body region image after expansion, updating a background region image after the main body region image is expanded, D representing an updated background region image, and then fusing the updated background region image with data of a hue space component H to obtain a result C, wherein the fusion formula is as follows:
wherein (i, j) represents pixel coordinates, H (i, j) represents a background purity value corresponding to a pixel in the hue space component H, when a pixel with the coordinate (i, j) belongs to the dilated background region image D, the background purity value of the pixel in the hue space component H is assigned, and when a pixel with the coordinate (i, j) does not belong to the dilated background region image D, assigning the background purity value of the pixel in the hue space component H to zero, summarizing the coordinate of each pixel and the corresponding background purity value to form an array C, namely an array formed by the position coordinate of each pixel in the background area image D and the corresponding converted background purity value, comparing a preset first threshold value with the array C, and when the background purity values corresponding to the pixels in the background region image D are smaller than the first background purity threshold value, judging that the background purity of the picture to be detected is in compliance.
Preferably, in the above embodiment, the lightness space data is processed by multiple binarization manners, and the corresponding method for outputting multiple binarization results includes:
processing data of the lightness space channel L in a fixed threshold binarization mode to obtain a first binarization result T; and processing the data of the lightness space channel L in a Gaussian window binarization mode to obtain a second binarization result G. And then, respectively carrying out incoherent region suppression processing on the first binarization result T and the second binarization result G by adopting a non-maximum value suppression method, eliminating the influence of an incoherent region caused by complex background on a detection result, and further improving the detection accuracy.
In the above embodiment, the method for fusing the main body region image with the multiple binarization results, extracting the coordinate value of each pixel in the fused main body region image and the corresponding background purity value, and determining whether the main body position of the picture to be detected is compliant includes:
respectively fusing the main body area image identified by pixel-level semantic segmentation processing with the first binarization result and the second binarization result; extracting coordinate values of pixels belonging to the main body area image and the first binarization result and corresponding background purity values from the fusion result; and/or extracting the coordinate values of the pixels belonging to the main body region image and the second binarization result and the corresponding background purity values from the fusion result; summarizing and extracting the coordinate values of the pixels and the corresponding background purity values, judging whether the coordinate values of the pixels and the corresponding background purity values all accord with a second threshold value, if so, judging that the main body position of the picture to be detected is in compliance, otherwise, judging that the main body position of the picture to be detected is not in compliance; the second threshold includes a second background purity threshold and a location coordinate interval threshold.
In practice, the fusion process is a known technique in the art, and is only exemplified as follows: the fusion formula is
And is
When the background purity value of the pixel (i, j) belongs to the intersection of the first binarization result T and the main body region image, the coordinate of the pixel and the corresponding background purity value are taken, or when the background purity value of the pixel (i, j) belongs to the intersection of the second binarization result G and the main body region image, the coordinate of the pixel and the corresponding background purity value are taken, the pixel coordinate and the corresponding background purity value are finally collected to form an array F, namely the array formed by the pixel position coordinate and the corresponding background purity value after the T n P and the G n P are collected, the preset second threshold value array is compared with the array F, and when the pixel coordinate is within the threshold value range of the position coordinate interval and the background purity value is within the second background purity threshold value, the main body position compliance of the picture to be measured is determined.
Example two
The embodiment provides a picture detection device, including:
the pixel processing unit is used for acquiring the denoised picture to be detected, and identifying a main body region image and a background region image after pixel-level semantic segmentation processing;
the color space conversion unit is used for performing color space conversion on the picture to be detected and outputting tone space data and lightness space data of the image;
The first judgment unit is used for fusing the expanded main area image with the tone space data, extracting the background purity value corresponding to each pixel in the background area image formed after the expansion processing, and judging whether the background purity of the picture to be detected is in compliance or not;
the binarization processing unit is used for processing the lightness space data through various binarization modes and correspondingly outputting various binarization results;
and the second judgment unit is used for fusing the main body area image with various binarization results respectively, extracting the coordinate value of each pixel in the fused main body area image and the corresponding background purity value, and judging whether the main body position of the picture to be detected is in compliance or not.
Preferably, between the binarization processing unit and the second judging unit, further comprising:
and respectively carrying out incoherent region suppression processing on the first binarization result and the second binarization result by adopting a non-maximum value suppression method.
Compared with the prior art, the beneficial effects of the image detection device provided by the embodiment are the same as those of the image detection method based on the convolutional neural network provided by the embodiment, and are not repeated herein.
EXAMPLE III
The present embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned picture detection method are executed.
Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the embodiment are the same as those of the image detection method provided by the above technical scheme, and are not repeated herein.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the invention may be implemented by hardware that is instructed to be associated with a program, the program may be stored in a computer-readable storage medium, and when the program is executed, the program includes the steps of the method of the embodiment, and the storage medium may be: ROM/RAM, magnetic disks, optical disks, memory cards, and the like.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.