CN111340896A - Object color identification method and device, computer equipment and storage medium - Google Patents

Object color identification method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111340896A
CN111340896A CN202010108689.5A CN202010108689A CN111340896A CN 111340896 A CN111340896 A CN 111340896A CN 202010108689 A CN202010108689 A CN 202010108689A CN 111340896 A CN111340896 A CN 111340896A
Authority
CN
China
Prior art keywords
color
local image
image area
colors
candidate
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
CN202010108689.5A
Other languages
Chinese (zh)
Other versions
CN111340896B (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 Megvii Technology Co Ltd
Original Assignee
Beijing Megvii 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 Megvii Technology Co Ltd filed Critical Beijing Megvii Technology Co Ltd
Priority to CN202010108689.5A priority Critical patent/CN111340896B/en
Publication of CN111340896A publication Critical patent/CN111340896A/en
Application granted granted Critical
Publication of CN111340896B publication Critical patent/CN111340896B/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
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

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

Abstract

The application relates to a method and a device for identifying object colors, computer equipment and a storage medium. The method comprises the following steps: acquiring an image of an object to be identified; inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized; for each local image area, if the number of candidate colors corresponding to the local image area is multiple, determining a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule; and if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area. By the method and the device, the accuracy of object color identification can be improved.

Description

Object color identification method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for identifying an object color, a computer device, and a storage medium.
Background
Currently, in video structuring applications, it is generally necessary to identify the color of a target object in a video. In the prior art, colors of local image regions included in an image of a sample object are labeled based on a preset color set, and a neural network model is trained. And subsequently, identifying the color of each local image area in the image of the object through the trained neural network model.
However, the number of colors in the preset color set is limited, resulting in inaccurate color recognition.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method and apparatus for identifying a color of an object, a computer device, and a storage medium.
In a first aspect, a method for identifying a color of an object is provided, the method including:
acquiring an image of an object to be identified;
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
for each local image area, if the number of candidate colors corresponding to the local image area is multiple, determining a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
As an optional implementation manner, the inputting the image of the object to be recognized into a color classification model trained in advance, and outputting candidate colors corresponding to each local image region included in the image of the object to be recognized includes:
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized;
for each local image region, determining a candidate color corresponding to the local image region from preset colors with the probability greater than a preset probability threshold value among the preset colors; alternatively, the first and second electrodes may be,
and for each local image region, determining a preset number of candidate colors corresponding to the local image region in the preset colors according to the sequence of the probability from large to small.
As an optional embodiment, each preset color comprises one or more of a non-tonal color or a tonal color.
As an optional implementation manner, the determining, according to the multiple candidate colors corresponding to the local image region and a preset color determination rule, a target color corresponding to the local image region includes:
if the two candidate colors corresponding to the local image area are contrast colors or complementary colors, determining the candidate color with the highest probability as the target color corresponding to the local image area, wherein the probability of the candidate color is output by the pre-trained color classification model;
and if the two candidate colors corresponding to the local image area are adjacent colors or the same color, determining the composite color of the two candidate colors corresponding to the local image area as the target color corresponding to the local image area.
As an optional embodiment, when both of the two candidate colors are the non-tone colors, the composite color of the two candidate colors is a gray with a gray value between the gray values of the two candidate colors; when the two candidate colors are both the hues, the composite color of the two candidate colors is a mixed color of the two candidate colors; when the two candidate colors are a non-toned color and a toned color, respectively, a composite color of the two candidate colors is an intermediate color of the two candidate colors.
As an optional implementation, the method further comprises:
acquiring a pre-stored training sample set, wherein the training sample set comprises images of a plurality of sample objects and at least one sample color corresponding to each local image area contained in the image of each sample object;
and training the color classification model to be trained according to the image of each sample object and at least one sample color corresponding to each local image area contained in each sample object to obtain the trained color classification model.
In a second aspect, an apparatus for identifying a color of an object is provided, the apparatus comprising:
the first acquisition module is used for acquiring an image of an object to be identified;
the output module is used for inputting the image of the object to be recognized into a pre-trained color classification model and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
a first determining module, configured to determine, for each local image region, a target color corresponding to the local image region according to a plurality of candidate colors corresponding to the local image region and a preset color determination rule if the number of candidate colors corresponding to the local image region is multiple;
and the second determining module is used for determining the candidate color corresponding to the local image area as the target color corresponding to the local image area if the number of the candidate colors corresponding to the local image area is one.
As an optional implementation manner, the output module is specifically configured to:
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized;
for each local image region, determining a candidate color corresponding to the local image region from preset colors with the probability greater than a preset probability threshold value among the preset colors; alternatively, the first and second electrodes may be,
and for each local image region, determining a preset number of candidate colors corresponding to the local image region in the preset colors according to the sequence of the probability from large to small.
In a third aspect, a computer device is provided, which includes a memory and a processor, the memory stores a computer program operable on the processor, and the processor executes the computer program to implement the following steps:
acquiring an image of an object to be identified;
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
for each local image area, if the number of candidate colors corresponding to the local image area is multiple, determining a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring an image of an object to be identified;
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
for each local image area, if the number of candidate colors corresponding to the local image area is multiple, determining a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
The application provides an object color identification method and device, computer equipment and a storage medium. The server acquires an image of the object to be recognized, inputs the image of the object to be recognized into a pre-trained color classification model, and outputs candidate colors corresponding to each local image area contained in the image of the object to be recognized. Then, for each local image area, if the number of candidate colors corresponding to the local image area is multiple, the server determines a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule. And if the number of the candidate colors corresponding to the local image area is one, the server determines the candidate color corresponding to the local image area as the target color corresponding to the local image area. Therefore, for each local image area, the color classification model can output a plurality of candidate colors, and the server can determine the target color corresponding to the local image area according to the candidate colors corresponding to the local image area and the preset color determination rule, so that the target color of each area is not limited to the preset color, and the accuracy of object color identification is improved.
Drawings
Fig. 1 is a flowchart of an object color identification method according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a method for training a color classification model according to an embodiment of the present disclosure;
fig. 3 is a flowchart of an example of a method for identifying object colors according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an apparatus for identifying object colors according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The embodiment of the application provides an object color identification method, which can be applied to an image identification system, and particularly can be applied to a server in the image identification system. The image recognition system comprises an image acquisition device and a server. And the image acquisition equipment is used for acquiring the image of the object and sending the acquired image of the object to the server. And the server is used for acquiring the image of the object to be recognized, inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized. Then, for each local image area, if the number of candidate colors corresponding to the local image area is multiple, the server determines a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule. And if the number of the candidate colors corresponding to the local image area is one, the server determines the candidate color corresponding to the local image area as the target color corresponding to the local image area.
The following will describe in detail an object color identification method provided in an embodiment of the present application with reference to specific embodiments, as shown in fig. 1, the specific steps are as follows:
step 101, acquiring an image of an object to be identified.
In this implementation, the image acquisition device may acquire an image according to a preset sampling period, and send the acquired image (i.e., the image to be identified) to the server. Alternatively, the user may store the image to be recognized in the memory of the server in advance. When the server needs to identify the color of the object, the image to be identified can be read from the memory or received from the image acquisition device. Then, the server may acquire an image of the object to be recognized among the images to be recognized. Wherein, the image of each object to be identified comprises one object to be identified. Optionally, the processing procedure of the server acquiring the image of the object to be recognized is as follows:
step one, an image to be identified is obtained.
In this implementation, the image acquisition device may acquire an image according to a preset sampling period, and send the acquired image (i.e., the image to be identified) to the server. Alternatively, the user may store the image to be recognized in the memory of the server in advance. When the server needs to identify the color of the object, the image to be identified can be read from the memory or received from the image acquisition device.
And step two, determining an object detection frame corresponding to each object to be identified contained in the image to be identified according to the image to be identified and a preset object detection algorithm.
In this embodiment, the server may store the object detection algorithm in advance. The object detection algorithm may be selected by a skilled person according to actual requirements. The object detection algorithm may be an object detection algorithm based on global features, an object detection algorithm based on human body parts, or an object detection algorithm based on stereoscopic vision, and the embodiment of the present application is not limited. After the server acquires the image to be recognized, the server may determine an object detection frame corresponding to each object to be recognized included in the image to be recognized based on a preset object detection algorithm. Wherein, each object detection frame comprises an object to be identified.
And step three, taking the image contained in the object detection frame corresponding to each object to be recognized as the image of each object to be recognized.
In this embodiment, after the server obtains the object detection frame corresponding to each object to be recognized, for the object detection frame corresponding to each object to be recognized, the server may use the image included in the object detection frame corresponding to the object to be recognized as the image of the object to be recognized.
And 102, inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized.
In this embodiment, the server may store a color classification model trained in advance. Wherein, the server introduces details to the training process of the color classification model in the following. Optionally, the color classification model may be a deep neural network model, or may be another type of neural network model, and the embodiment of the present application is not limited. After the server acquires the image of the object to be recognized, the image of the object to be recognized can be input into a pre-trained color classification model. Correspondingly, the color classification model outputs candidate colors corresponding to each local image area contained in the image of the object to be recognized. Wherein, the number of the candidate colors can be one or more; the image of the object to be recognized includes a partial image region which may include one or more of a head image region, a top image region, a bottom image region, a shoe image region, and an accessory image region. Optionally, the head image area may be further subdivided into a hat image area and a hair image area, and the accessory image area may be subdivided into a handbag image area, a backpack image area, and the like.
Optionally, the server inputs the image of the object to be recognized into a pre-trained color classification model, and outputs the candidate colors corresponding to the local image regions included in the image of the object to be recognized as follows: and inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized. The preset color is a predefined color, and the preset color may be a non-tone color or a tone color. For example, 12 preset colors can be predefined, including three non-hue colors of black, white and gray, and nine hue colors of red, orange, yellow, green, dark blue, light blue, purple, pink and brown.
In this embodiment, the pre-trained color classification model is trained based on a training sample with a preset color label. After the server acquires the image of the object to be recognized, the image of the object to be recognized can be input into a pre-trained color classification model. Correspondingly, the color classification model outputs the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized. For example, { jacket image area, color 1: 50%, color 2: 30% … … color 12: 0.01% }. Optionally, each preset color may include one or more of a non-tonal color or a tonal color. For example, the preset colors include 12 colors, which are divided into two colors of no hue (black, white, gray) and hue (red, orange, yellow, green, dark blue, light blue, violet, pink, brown). In this way, after the server obtains the probability of each preset color corresponding to each local image region, the server can further determine candidate colors in each preset color. The method for determining the candidate color corresponding to each local image area in each preset color by the server may be various, and the embodiment of the present application provides two feasible implementation manners, and the specific processing procedure is as follows:
in a first manner, for each local image region, in each preset color, the preset color with the probability greater than a preset probability threshold is determined as the candidate color corresponding to the local image region.
In this embodiment, the server may store a preset probability threshold in advance. The preset probability threshold may be set empirically by a skilled person. For each local image region, the server may determine, among the preset colors, a preset color with a probability greater than a preset probability threshold as a candidate color corresponding to the local image region. In this way, the number of candidate colors corresponding to different local image regions is not constant, and may be different or the same for different local image regions.
And secondly, determining a preset number of candidate colors corresponding to each local image region in each preset color according to the sequence of the probability from large to small.
In this embodiment, the server may store a preset number in advance. The preset number may be set by a skilled person based on experience. For each local image region, the server may determine, in each preset color, a preset number of preset colors as candidate colors corresponding to the local image region according to a sequence of probabilities from large to small. In this way, the number of candidate colors corresponding to different local image regions is the same for different local image regions.
Step 103, for each local image region, if the number of candidate colors corresponding to the local image region is multiple, determining a target color corresponding to the local image region according to the multiple candidate colors corresponding to the local image region and a preset color determination rule.
In this embodiment, after the server obtains the candidate colors corresponding to the local image regions, the server may further determine, for each local image region, whether the number of candidate colors corresponding to the local image region is plural. If the number of candidate colors corresponding to the local image area is multiple, the server may determine the target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule. Therefore, the determined target color corresponding to the local image area is not limited to the preset color, and is more accurate.
Optionally, when the number of the candidate colors corresponding to the local image area is two, the server determines, according to the multiple candidate colors corresponding to the local image area and a preset color determination rule, a processing procedure of determining the target color corresponding to the local image area is as follows:
step one, if the two candidate colors corresponding to the local image area are contrast colors or complementary colors, determining the candidate color with the highest probability as the target color corresponding to the local image area. Wherein the probability of the candidate color is output by a pre-trained color classification model.
In this embodiment, for each local image region, if the number of candidate colors corresponding to the local image region is two, the server may further determine whether the two candidate colors corresponding to the local image region are contrasting colors or complementary colors. Wherein, the contrast color is a color with a difference of 120 degrees in hue ring of hues (for example, yellow and red are contrast colors); complementary colors are colors that differ by 180 degrees in the hue circle of a toned color (e.g., yellow and violet are complementary colors). If the two candidate colors corresponding to the local image region are contrast colors or complementary colors, it is indicated that the candidate colors output by the color classification model have conflict, and the server may determine the candidate color with the highest probability as the target color corresponding to the local image region.
And step two, if the two candidate colors corresponding to the local image area are adjacent colors or the same color, determining the composite color of the two candidate colors corresponding to the local image area as the target color corresponding to the local image area.
In this embodiment, the adjacent colors are colors that differ by 60 degrees in hue circle of the toned colors (e.g., yellow and green are adjacent colors); if two candidate colors corresponding to the local image area are adjacent colors or the same color, the two candidate colors are different by 30 degrees in the hue ring of the hue color (for example, yellow and yellow-green are the same color). The server may determine a composite color of the two candidate colors corresponding to the local image area as a target color corresponding to the local image area. The embodiment of the application provides three ways for determining the composite color, which are as follows:
in the first mode, when the two candidate colors are a non-toned color and a toned color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors. Specifically, the two candidate colors are respectively a non-tonal color and a tonal color, and then the composite color corresponding to the black and tonal colors is a dark color (for example, dark red); the composite color of the gray and the hues is gray (such as gray green); the composite color of white and the corresponding color of the shade is light color (such as light pink).
In the second mode, when both the two candidate colors are the non-tone colors, the composite color of the two candidate colors is gray having a gray value between the gray values of the two candidate colors. Specifically, if the two candidate colors are both colorless colors, the composite color corresponding to black and gray is dark gray; the composite color of gray and white is light gray.
In the third mode, when both the two candidate colors are the toned colors, the composite color of the two candidate colors is a mixed color of the two candidate colors. Specifically, if the two candidate colors are both hues, the composite color corresponding to red and orange is orange; the compound color of the orange and the yellow is orange yellow; the composite color corresponding to the yellow and the green is yellow-green; the composite color of green and light blue is blue-green; the composite color corresponding to the light blue and the dark blue is blue; the compound color of the dark blue and the purple is blue-purple; the compound color of purple and red is purple red; the composite color of brown and red is reddish brown; the compound color of brown and orange is orange-brown; the compound color of brown and yellow is yellow-brown; the composite color of brown and green is green-brown.
And 104, if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
In this embodiment, if the number of candidate colors corresponding to the local image area is one, the server may directly determine the candidate color corresponding to the local image area as the target color corresponding to the local image area.
The application provides an object color identification method and device, computer equipment and a storage medium. The server acquires an image of the object to be recognized, inputs the image of the object to be recognized into a pre-trained color classification model, and outputs candidate colors corresponding to each local image area contained in the image of the object to be recognized. Then, for each local image area, if the number of candidate colors corresponding to the local image area is multiple, the server determines a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule. And if the number of the candidate colors corresponding to the local image area is one, the server determines the candidate color corresponding to the local image area as the target color corresponding to the local image area. Therefore, for each local image area, the color classification model can output a plurality of candidate colors, and the server can determine the target color corresponding to the local image area according to the candidate colors corresponding to the local image area and the preset color determination rule, so that the target color of each area is not limited to the preset color, and the accuracy of object color identification is improved.
The embodiment of the present application further provides a method for training a color classification model, as shown in fig. 2, the specific processing procedure is as follows:
step 201, a pre-stored training sample set is obtained. The training sample set comprises images of a plurality of sample objects and at least one sample color corresponding to each local image area contained in the image of each sample object.
In this embodiment, the server may store a training sample set and a color classification model to be trained in advance. The training sample set comprises images of a plurality of sample objects and at least one sample color corresponding to each local image area contained in the image of each sample object. The sample color is one or more colors selected from preset colors by a annotator when annotating a certain local image area of the sample object. Wherein there is at least one local image region, each of the at least one local image region corresponding to a plurality of sample colors. In the prior art, colors of a marker labeled on a training sample are limited by the perception of the marker on the colors, and different markers may be labeled with different colors for the same color. Therefore, a annotator can only annotate one color to the local image area of the sample object, which brings a large error, and finally results in low accuracy of the trained color classification model. Also, the kind of the finally determined target color is also limited to the kind of the preset color. In order to solve the above problem, in the process of labeling the training sample, for the image of each sample object, the annotator may label, based on a preset color, at least one color of the color corresponding to each local image region included in the image of the sample object in advance, and may label at least part of the local image regions therein with multiple preset colors. For example, { an image of the sample object 1; jacket image area: color 1 and color 2; lower garment image area: color 6; shoe image area: color 1; packet image area: color 4, color 6, and color 8. When the server needs to train the color classification model to be trained, the server can obtain a pre-stored training sample set.
Step 202, training the color classification model to be trained according to the image of each sample object and at least one sample color corresponding to each local image area contained in each sample object, so as to obtain the trained color classification model.
In this implementation, after the server obtains a pre-stored training sample set, the image of each sample object may be input into the color classification model to be trained. Correspondingly, the color classification model to be trained outputs the probability of the preset color corresponding to each local image area. And then the server adjusts the weight of each neuron in the color classification model to be trained according to the probability of the preset color corresponding to each local image region and at least one sample color corresponding to each local image region until the color classification model to be trained meets the preset precision, so that the trained color classification model is obtained. Therefore, at least a plurality of candidate colors can be output by the trained color classification model in the using process, and the composite color of the candidate colors is determined as the target color, so that the precision of the color classification model is improved, the type of the target color is further limited to the type of the preset color, and the type of the target color is expanded.
Fig. 3 is a flowchart of an example of an object color identification method provided in an embodiment of the present application, and as shown in the figure, a specific processing procedure is as follows:
step 301, acquiring an image to be identified.
Step 302, determining an object detection frame corresponding to each object to be identified contained in the image to be identified according to the image to be identified and a preset object detection algorithm.
Step 303, the image included in the object detection frame corresponding to each object to be recognized is taken as the image of each object to be recognized.
Step 304, inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image region contained in the image of the object to be recognized.
Step 305, for each local image region, determining a candidate color corresponding to the local image region from preset colors with a probability greater than a preset probability threshold.
Step 306, for each local image region, determining whether the number of candidate colors corresponding to the local image region is multiple.
If the number of candidate colors corresponding to the local image area is multiple, step 307 is executed. If the number of candidate colors corresponding to the local image area is one, step 310 is executed.
Step 307, determining whether the two candidate colors corresponding to the local image area are contrast colors or complementary colors.
If the two candidate colors corresponding to the local image area are contrast colors or complementary colors, step 308 is performed. If the two candidate colors corresponding to the local image area are neighboring colors or the same type of color, step 309 is executed.
And step 308, determining the candidate color with the highest probability as the target color corresponding to the local image area.
Step 309, determine the composite color of the two candidate colors corresponding to the local image area as the target color corresponding to the local image area.
Step 310, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
The processing procedures from step 301 to step 310 and the types of the processing procedures from step 101 to step 104 are not described herein again.
An embodiment of the present application further provides an apparatus for identifying a color of an object, as shown in fig. 4, the apparatus includes:
a first obtaining module 410, configured to obtain an image of an object to be identified;
the output module 420 is configured to input the image of the object to be recognized into a pre-trained color classification model, and output candidate colors corresponding to each local image region included in the image of the object to be recognized;
a first determining module 430, configured to, for each local image region, determine, according to a plurality of candidate colors corresponding to the local image region and a preset color determination rule, a target color corresponding to the local image region if the number of candidate colors corresponding to the local image region is multiple;
the second determining module 440 is configured to determine the candidate color corresponding to the local image region as the target color corresponding to the local image region if the number of candidate colors corresponding to the local image region is one.
As an optional implementation manner, the output module 420 is specifically configured to:
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized;
for each local image region, determining a candidate color corresponding to the local image region from preset colors with the probability greater than a preset probability threshold value; alternatively, the first and second electrodes may be,
and for each local image region, determining a preset number of candidate colors corresponding to the local image region in the preset colors according to the sequence of the probability from large to small.
As an alternative embodiment, each preset color comprises one or more of a non-tonal color or a tonal color.
As an optional implementation manner, the number of candidate colors corresponding to the local image area is two, and the first determining module 430 is specifically configured to:
if the two candidate colors corresponding to the local image area are contrast colors or complementary colors, determining the candidate color with the highest probability as the target color corresponding to the local image area, wherein the probability of the candidate color is output by a pre-trained color classification model;
and if the two candidate colors corresponding to the local image area are adjacent colors or the same color, determining the composite color of the two candidate colors corresponding to the local image area as the target color corresponding to the local image area.
As an alternative embodiment, when both candidate colors are the non-tonal colors, the composite color of the two candidate colors is a gray with a gray value between the gray values of the two candidate colors; when the two candidate colors are both the hues, the composite color of the two candidate colors is a mixed color of the two candidate colors; when the two candidate colors are a non-toned color and a toned color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors.
As an optional implementation, the apparatus further comprises:
the second acquisition module is used for acquiring a pre-stored training sample set, wherein the training sample set comprises images of a plurality of sample objects and at least one sample color corresponding to each local image area contained in the image of each sample object;
and the training module is used for training the color classification model to be trained according to the image of each sample object and at least one sample color corresponding to each local image area contained in each sample object to obtain the trained color classification model.
The application provides an object color recognition device. The server acquires an image of the object to be recognized, inputs the image of the object to be recognized into a pre-trained color classification model, and outputs candidate colors corresponding to each local image area contained in the image of the object to be recognized. Then, for each local image area, if the number of candidate colors corresponding to the local image area is multiple, the server determines a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule. And if the number of the candidate colors corresponding to the local image area is one, the server determines the candidate color corresponding to the local image area as the target color corresponding to the local image area. Therefore, for each local image area, the color classification model can output a plurality of candidate colors, and the server can determine the target color corresponding to the local image area according to the candidate colors corresponding to the local image area and the preset color determination rule, so that the target color of each area is not limited to the preset color, and the accuracy of object color identification is improved.
In one embodiment, a computer device is provided, as shown in fig. 5, and includes a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor implements the steps of the method for identifying the color of the object when executing the computer program.
In an embodiment, a computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the above-mentioned object color identification method.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for identifying a color of an object, the method comprising:
acquiring an image of an object to be identified;
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
for each local image area, if the number of candidate colors corresponding to the local image area is multiple, determining a target color corresponding to the local image area according to the multiple candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of the candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as the target color corresponding to the local image area.
2. The method according to claim 1, wherein the inputting the image of the object to be recognized into a pre-trained color classification model and outputting candidate colors corresponding to each local image region included in the image of the object to be recognized comprises:
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized;
for each local image region, determining a candidate color corresponding to the local image region from preset colors with the probability greater than a preset probability threshold value among the preset colors; alternatively, the first and second electrodes may be,
and for each local image region, determining a preset number of candidate colors corresponding to the local image region in the preset colors according to the sequence of the probability from large to small.
3. The method of claim 2, wherein each of the preset colors comprises one or more of a non-tonal color or a tonal color.
4. The method according to claim 1 or 2, wherein the number of the candidate colors corresponding to the local image region is two, and determining the target color corresponding to the local image region according to the candidate colors corresponding to the local image region and a preset color determination rule comprises:
if the two candidate colors corresponding to the local image area are contrast colors or complementary colors, determining the candidate color with the highest probability as the target color corresponding to the local image area, wherein the probability of the candidate color is output by the pre-trained color classification model;
and if the two candidate colors corresponding to the local image area are adjacent colors or the same color, determining the composite color of the two candidate colors corresponding to the local image area as the target color corresponding to the local image area.
5. The method of claim 4,
when the two candidate colors are both non-tone colors, the composite color of the two candidate colors is gray with the gray value between the gray values of the two candidate colors;
when the two candidate colors are both the hues, the composite color of the two candidate colors is a mixed color of the two candidate colors;
when the two candidate colors are a non-toned color and a toned color, respectively, a composite color of the two candidate colors is an intermediate color of the two candidate colors.
6. The method according to any one of claims 1 to 5, further comprising:
acquiring a pre-stored training sample set, wherein the training sample set comprises images of a plurality of sample objects and at least one sample color corresponding to each local image area contained in the image of each sample object;
and training the color classification model to be trained according to the image of each sample object and at least one sample color corresponding to each local image area contained in each sample object to obtain the trained color classification model.
7. An apparatus for identifying a color of an object, the apparatus comprising:
the first acquisition module is used for acquiring an image of an object to be identified;
the output module is used for inputting the image of the object to be recognized into a pre-trained color classification model and outputting candidate colors corresponding to each local image area contained in the image of the object to be recognized;
a first determining module, configured to determine, for each local image region, a target color corresponding to the local image region according to a plurality of candidate colors corresponding to the local image region and a preset color determination rule if the number of candidate colors corresponding to the local image region is multiple;
and the second determining module is used for determining the candidate color corresponding to the local image area as the target color corresponding to the local image area if the number of the candidate colors corresponding to the local image area is one.
8. The apparatus of claim 7, wherein the output module is specifically configured to:
inputting the image of the object to be recognized into a pre-trained color classification model, and outputting the probability of each preset color corresponding to each local image area contained in the image of the object to be recognized;
for each local image region, determining a candidate color corresponding to the local image region from preset colors with the probability greater than a preset probability threshold value among the preset colors; alternatively, the first and second electrodes may be,
and for each local image region, determining a preset number of candidate colors corresponding to the local image region in the preset colors according to the sequence of the probability from large to small.
9. A computer device comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, wherein the processor, when executing the computer program, performs the steps of the method of any of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN202010108689.5A 2020-02-21 2020-02-21 Object color recognition method, device, computer equipment and storage medium Active CN111340896B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010108689.5A CN111340896B (en) 2020-02-21 2020-02-21 Object color recognition method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010108689.5A CN111340896B (en) 2020-02-21 2020-02-21 Object color recognition method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111340896A true CN111340896A (en) 2020-06-26
CN111340896B CN111340896B (en) 2023-10-27

Family

ID=71186924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010108689.5A Active CN111340896B (en) 2020-02-21 2020-02-21 Object color recognition method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111340896B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112507801A (en) * 2020-11-14 2021-03-16 武汉中海庭数据技术有限公司 Lane road surface digital color recognition method, speed limit information recognition method and system
CN113298105A (en) * 2020-07-22 2021-08-24 阿里巴巴集团控股有限公司 Image processing, displaying, acquiring and home decoration matching processing method, device and medium
CN115984680A (en) * 2023-02-15 2023-04-18 博奥生物集团有限公司 Identification method and device for can printing colors, storage medium and equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040042662A1 (en) * 1999-04-26 2004-03-04 Wilensky Gregg D. Identifying intrinsic pixel colors in a region of uncertain pixels
CN106294329A (en) * 2015-05-08 2017-01-04 北京智谷睿拓技术服务有限公司 Information processing method and equipment
CN106503638A (en) * 2016-10-13 2017-03-15 金鹏电子信息机器有限公司 For the image procossing of colour recognition, vehicle color identification method and system
CN106683140A (en) * 2016-12-16 2017-05-17 深圳市中达瑞和科技有限公司 Color recognition method and system
CN107358242A (en) * 2017-07-11 2017-11-17 浙江宇视科技有限公司 Target area color identification method, device and monitor terminal
KR20180093151A (en) * 2017-02-09 2018-08-21 공주대학교 산학협력단 Apparatus for detecting color region using gaussian mixture model and its method
CN109416747A (en) * 2016-09-30 2019-03-01 富士通株式会社 Color of object recognition methods, device and computer system
CN110263605A (en) * 2018-07-18 2019-09-20 桂林远望智能通信科技有限公司 Pedestrian's dress ornament color identification method and device based on two-dimension human body guise estimation
CN110298312A (en) * 2019-06-28 2019-10-01 北京旷视科技有限公司 Biopsy method, device, electronic equipment and computer readable storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040042662A1 (en) * 1999-04-26 2004-03-04 Wilensky Gregg D. Identifying intrinsic pixel colors in a region of uncertain pixels
CN106294329A (en) * 2015-05-08 2017-01-04 北京智谷睿拓技术服务有限公司 Information processing method and equipment
CN109416747A (en) * 2016-09-30 2019-03-01 富士通株式会社 Color of object recognition methods, device and computer system
CN106503638A (en) * 2016-10-13 2017-03-15 金鹏电子信息机器有限公司 For the image procossing of colour recognition, vehicle color identification method and system
CN106683140A (en) * 2016-12-16 2017-05-17 深圳市中达瑞和科技有限公司 Color recognition method and system
KR20180093151A (en) * 2017-02-09 2018-08-21 공주대학교 산학협력단 Apparatus for detecting color region using gaussian mixture model and its method
CN107358242A (en) * 2017-07-11 2017-11-17 浙江宇视科技有限公司 Target area color identification method, device and monitor terminal
CN110263605A (en) * 2018-07-18 2019-09-20 桂林远望智能通信科技有限公司 Pedestrian's dress ornament color identification method and device based on two-dimension human body guise estimation
CN110298312A (en) * 2019-06-28 2019-10-01 北京旷视科技有限公司 Biopsy method, device, electronic equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘倩倩;范越;王琦;: "基于车牌颜色特征的定位方法研究" *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113298105A (en) * 2020-07-22 2021-08-24 阿里巴巴集团控股有限公司 Image processing, displaying, acquiring and home decoration matching processing method, device and medium
CN112507801A (en) * 2020-11-14 2021-03-16 武汉中海庭数据技术有限公司 Lane road surface digital color recognition method, speed limit information recognition method and system
CN115984680A (en) * 2023-02-15 2023-04-18 博奥生物集团有限公司 Identification method and device for can printing colors, storage medium and equipment

Also Published As

Publication number Publication date
CN111340896B (en) 2023-10-27

Similar Documents

Publication Publication Date Title
CN111340896A (en) Object color identification method and device, computer equipment and storage medium
US20210256258A1 (en) Method, apparatus, and computer program for extracting representative characteristics of object in image
EP3657392A1 (en) Image feature acquisition
US7415153B2 (en) Color naming, color categorization and describing color composition of images
Bannert et al. Human V4 activity patterns predict behavioral performance in imagery of object color
CN112016464A (en) Method and device for detecting face shielding, electronic equipment and storage medium
Vazquez-Corral et al. Color constancy by category correlation
CN108229522B (en) Neural network training method, attribute detection device and electronic equipment
US11010894B1 (en) Deriving a skin profile from an image
CN110569856A (en) sample labeling method and device, and damage category identification method and device
WO2005012880B1 (en) Analysing biological entities
CN110728182A (en) Interviewing method and device based on AI interviewing system and computer equipment
Justiawan et al. Comparative analysis of color matching system for teeth recognition using color moment
CN114299567A (en) Model training method, living body detection method, electronic device, and storage medium
Laursen et al. Statistics-based segmentation using a continuous-scale naive Bayes approach
CN116824252A (en) Traditional Chinese medicine tongue color classification quantization method for hyperspectral tongue image
CN111401158A (en) Difficult sample discovery method and device and computer equipment
CN116469579A (en) Brain state monitoring method, equipment, storage medium and device
Sari et al. Assessment of color levels in leaf color chart using smartphone camera with relative calibration
CN112699809B (en) Vaccinia category identification method, device, computer equipment and storage medium
CN112699707B (en) Video detection method, device and storage medium
CN111048183B (en) Method, device, equipment and storage medium for homogenizing digital pathological image
CN110633710B (en) Live pig disease early warning system
Deshpande et al. A method for evaluating deep generative models of images via assessing the reproduction of high-order spatial context
CN113837174A (en) Target object identification method and device and computer 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