CN111340896B - Object color recognition method, device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN111340896B
CN111340896B CN202010108689.5A CN202010108689A CN111340896B CN 111340896 B CN111340896 B CN 111340896B CN 202010108689 A CN202010108689 A CN 202010108689A CN 111340896 B CN111340896 B CN 111340896B
Authority
CN
China
Prior art keywords
color
image area
local image
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.)
Active
Application number
CN202010108689.5A
Other languages
Chinese (zh)
Other versions
CN111340896A (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

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]

Abstract

The application relates to a method, a device, a computer device and a storage medium for identifying object colors. The method comprises the following steps: acquiring an image of an object to be identified; inputting the image of the object to be identified 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 identified; for each local image area, if the number of candidate colors corresponding to the local image area is a plurality of, determining a target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule; and if the number of 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 can improve the accuracy of object color identification.

Description

Object color recognition method, 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 apparatus for identifying an object color, a computer device, and a storage medium.
Background
Currently, in video structuring applications, it is often necessary to identify the color of a target object in a video. In the prior art, colors of local image areas contained in an image of a sample object are marked based on a preset color set, and a neural network model is trained. And then, recognizing the colors of the areas containing the local images in the images 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 identification.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, and a storage medium for identifying an object color.
In a first aspect, there is provided a method of 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 identified 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 identified;
for each local image area, if the number of candidate colors corresponding to the local image area is a plurality of, determining a target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of 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 identified into a pre-trained color classification model, outputting candidate colors corresponding to each local image area included in the image of the object to be identified, includes:
inputting the image of the object to be identified 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 identified;
for each local image area, determining candidate colors corresponding to the local image areas by using preset colors with probability larger than a preset probability threshold value in the preset colors; or alternatively, the process may be performed,
and determining a preset number of candidate colors corresponding to each local image region in the sequence from the big probability to the small probability in each preset color according to each local image region.
As an alternative embodiment, the preset colors include one or more of an untuned color or a tinted color.
As an optional implementation manner, the number of candidate colors corresponding to the local image area is two, and the determining, according to the plurality of candidate colors corresponding to the local image area and a preset color determining rule, the target color corresponding to the local image area includes:
if the two candidate colors corresponding to the local image area are contrasting 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 similar colors, 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 the two candidate colors are each a non-tone color, the composite color of the two candidate colors is a gray having a gray value between the gray values of the two candidate colors; when the two candidate colors are both tonal colors, the composite color of the two candidate colors is the mixed color of the two candidate colors; when the two candidate colors are a non-tonal color and a tonal color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors.
As an alternative embodiment, 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;
training the color classification model to be trained according to the images of the sample objects and at least one sample color corresponding to each local image area contained in each sample object, and obtaining a trained color classification model.
In a second aspect, there is provided 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 identified 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 identified;
a first determining module, configured to determine, for each local image area, a target color corresponding to the local image area according to a plurality of candidate colors corresponding to the local image area and a preset color determining rule if the number of candidate colors corresponding to the local image area is a plurality of;
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 alternative embodiment, the output module is specifically configured to:
inputting the image of the object to be identified 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 identified;
for each local image area, determining candidate colors corresponding to the local image areas by using preset colors with probability larger than a preset probability threshold value in the preset colors; or alternatively, the process may be performed,
and determining a preset number of candidate colors corresponding to each local image region in the sequence from the big probability to the small probability in each preset color according to each local image region.
In a third aspect, a computer device is provided, comprising a memory and a processor, the memory having stored thereon a computer program executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring an image of an object to be identified;
inputting the image of the object to be identified 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 identified;
for each local image area, if the number of candidate colors corresponding to the local image area is a plurality of, determining a target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of 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 identified 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 identified;
for each local image area, if the number of candidate colors corresponding to the local image area is a plurality of, determining a target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule;
and if the number of 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, an object color identification device, computer equipment and a storage medium. The server acquires an image of the object to be identified, inputs the image of the object to be identified 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 identified. Then, for each partial image area, if the number of candidate colors corresponding to the partial image area is a plurality of, the server determines a target color corresponding to the partial image area according to the plurality of candidate colors corresponding to the partial image area and a preset color determination rule. If the number of 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. In this way, 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 plurality of 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 a method for identifying object colors according to an embodiment of the present application;
FIG. 2 is a flowchart of a training method of a color classification model according to an embodiment of the present application;
FIG. 3 is a flowchart of an example of an object color identification method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an object color recognition device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the 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. The server is used for acquiring the image of the object to be identified, inputting the image of the object to be identified into a pre-trained color classification model, and outputting candidate colors corresponding to the local image areas contained in the image of the object to be identified. Then, for each partial image area, if the number of candidate colors corresponding to the partial image area is a plurality of, the server determines a target color corresponding to the partial image area according to the plurality of candidate colors corresponding to the partial image area and a preset color determination rule. If the number of 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 a method for identifying object colors according to an embodiment of the present application in detail with reference to a specific embodiment, as shown in fig. 1, and the specific steps are as follows:
step 101, an image of an object to be identified is acquired.
In this embodiment, the image capturing device may capture an image according to a preset sampling period, and send the captured image (i.e., the image to be identified) to the server. Alternatively, the user may store the image to be recognized in advance in the memory of the server. When the server needs to identify the color of the object, the image to be identified can be read from the memory or the image to be identified sent by the image acquisition device can be received. The server may then acquire an image of the object to be identified in the image to be identified. Wherein the image of each object to be identified contains one object to be identified. Optionally, the processing procedure of the server for acquiring the image of the object to be identified is as follows:
step one, an image to be identified is obtained.
In this embodiment, the image capturing device may capture an image according to a preset sampling period, and send the captured image (i.e., the image to be identified) to the server. Alternatively, the user may store the image to be recognized in advance in the memory of the server. When the server needs to identify the color of the object, the image to be identified can be read from the memory or the image to be identified sent by the image acquisition device can be received.
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 can be selected by a technician according to actual requirements. The object detection algorithm may be an object detection algorithm based on global features, an object detection algorithm based on a human body part, or an object detection algorithm based on stereoscopic vision, which is not limited in the embodiment of the present application. After the server acquires the image to be identified, an object detection frame corresponding to each object to be identified contained in the image to be identified can be determined based on a preset object detection algorithm. Wherein each object detection frame contains an object to be identified.
And thirdly, taking the image contained in the object detection frame corresponding to each object to be identified as the image of each object to be identified.
In this embodiment, after the server obtains the object detection frames corresponding to the objects to be identified, the server may use, as the image of the object to be identified, the image included in the object detection frame corresponding to the object to be identified for each object detection frame corresponding to the object to be identified.
Step 102, inputting the image of the object to be identified 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 identified.
In this implementation, the server may have pre-trained color classification models pre-stored therein. The training process of the color classification model by the server will be described in detail later. Alternatively, the color classification model may be a deep neural network model, or may be another type of neural network model, which is not limited in the embodiment of the present application. After the server acquires the image of the object to be identified, the image of the object to be identified can be input into a pre-trained color classification model. Correspondingly, the color classification model outputs candidate colors corresponding to the local image areas included in the image of the object to be identified. Wherein, the number of the candidate colors can be one or a plurality of; the partial image area contained in the image of the object to be identified may include one or more of a head image area, a coat image area, a lower coat image area, a shoe image area, and an accessory image area. Optionally, the head image area may be further subdivided into a cap 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 identified into a pre-trained color classification model, and the processing procedure of outputting candidate colors corresponding to each local image area included in the image of the object to be identified is as follows: and inputting the image of the object to be identified 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 identified. The preset color is a predefined color, and can be a colorless tone color or a colored tone color. For example, 12 preset colors may be predefined, including three non-hued colors of black, white, and gray, and nine hued colors of red, orange, yellow, green, deep blue, light blue, violet, powder, brown.
In this embodiment, the pre-trained color classification model is obtained by training based on training samples with preset color labels. After the server acquires the image of the object to be identified, the image of the object to be identified 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 identified. For example, { coat image area, color 1:50%, color 2:30% … … color 12:0.01% }. Alternatively, 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 classified into two types of non-tone colors (black, white, gray) and colored colors (red, orange, yellow, green, deep blue, light blue, violet, powder, brown). In this way, after the server obtains the probabilities of the preset colors corresponding to the local image areas, the candidate colors can be further determined in the preset colors. The manner in which the server determines the candidate color corresponding to each partial image area in each preset color may be various, and the embodiment of the present application provides two possible implementation manners, and the specific processing procedure is as follows:
in one mode, for each local image region, among the preset colors, a preset color with a probability greater than a preset probability threshold is determined as a 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 the skilled person. For each local image region, the server may determine, among the preset colors, a preset color having 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 partial image areas may be different or the same for different partial image areas.
In the second mode, for each local image region, a preset number of candidate colors corresponding to the local image region are determined according to the order of probability from high to low in each preset color.
In this embodiment, the server may store a predetermined number in advance. The preset number may be set empirically by the skilled artisan. For each partial image area, the server may determine, from among the preset colors, a preset number of preset colors as candidate colors corresponding to the partial image area in order of probability from high to low. In this way, the number of candidate colors corresponding to different partial image areas is the same for different partial image areas.
Step 103, 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.
In this embodiment, after the server obtains the candidate colors corresponding to the partial image areas, the server may further determine, for each partial image area, whether the number of candidate colors corresponding to the partial image area is plural. If the number of candidate colors corresponding to the local image area is a plurality of, the server may determine the target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule. In this way, the determined target color corresponding to the partial image area is not limited to the preset color, but is more accurate.
Optionally, when the number of candidate colors corresponding to the local image area is two, the server determines, according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule, a process of determining the target color corresponding to the local image area as follows:
step one, if two candidate colors corresponding to the local image area are contrasting 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, if the number of candidate colors corresponding to the partial image area is two for each partial image area, the server may further determine whether the two candidate colors corresponding to the partial image area are contrasting colors or complementary colors. Wherein the contrast color is a color differing by 120 degrees in hue circle of the hued color (e.g., yellow and red are contrast colors); the complementary colors are colors 180 degrees apart in the hue circle of the hued colors (e.g., yellow and purple are complementary colors). If the two candidate colors corresponding to the local image area are contrasting colors or complementary colors, the candidate colors output by the color classification model are indicated to have conflict, and the server can determine the candidate color with the highest probability as the target color corresponding to the local image area.
And step two, if the two candidate colors corresponding to the local image area are adjacent colors or similar colors, 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 the hue circle of the hued color (e.g., yellow and green are adjacent colors); a color of the same class of colors that differ by 30 degrees in the hue circle of the hue color (e.g., yellow and yellow-green are the same class of colors) if the two candidate colors corresponding to the partial image region are adjacent colors or the same class of colors. The server may determine the composite color of the two candidate colors corresponding to the partial image region as the target color corresponding to the partial image region. The embodiment of the application provides three ways for determining the composite color, which are specifically as follows:
in one mode, when the two candidate colors are a non-tone color and a tone color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors. Specifically, if the two candidate colors are respectively an untuned color and a toned color, the composite color corresponding to the black and the toned color is a dark-x color (such as dark red); the composite color of gray and the toned color is gray (such as grayish green); the composite color of white and the toned color is light (such as light pink).
In the second mode, when both the two candidate colors are non-tone colors, the composite color of the two candidate colors is gray with a gray value between the gray values of the two candidate colors. Specifically, if the two candidate colors are colorless, 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 color of the hue, the composite color of the two candidate colors is the mixed color of the two candidate colors. Specifically, if the two candidate colors are both tinted colors, the composite color corresponding to red and orange is orange; the orange and yellow composite color is orange yellow; the composite color corresponding to the yellow and the green is yellow-green; the composite color corresponding to the green and the light blue is blue-green; the compound color corresponding to light blue and deep blue is blue; the composite color corresponding to the deep blue and the purple is blue-purple; the composite color corresponding to purple and red is purple red; the compound color corresponding to the brown and the red is reddish brown; the compound color corresponding to brown and orange is orange-brown; the compound color corresponding to brown and yellow is yellow-brown; the composite color corresponding to the brown color and the green color is green-brown.
And 104, if the number of 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 partial image area is one, the server may directly determine the candidate color corresponding to the partial image area as the target color corresponding to the partial image area.
The application provides an object color identification method, an object color identification device, computer equipment and a storage medium. The server acquires an image of the object to be identified, inputs the image of the object to be identified 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 identified. Then, for each partial image area, if the number of candidate colors corresponding to the partial image area is a plurality of, the server determines a target color corresponding to the partial image area according to the plurality of candidate colors corresponding to the partial image area and a preset color determination rule. If the number of 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. In this way, 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 plurality of 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 application also provides a training method of the color classification model, as shown in fig. 2, and the specific processing process is as follows:
step 201, a pre-stored training sample set is obtained. The training sample set comprises a plurality of images of sample objects and at least one sample color corresponding to each local image area contained in each image of the sample objects.
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 a plurality of images of sample objects and at least one sample color corresponding to each local image area contained in each image of the sample objects. The sample color is one or more colors selected from preset colors by an annotator when annotating a certain local image area of the sample object. Wherein there is at least one partial image region, each of the at least one partial image region corresponding to a plurality of sample colors. In the prior art, the color of a labeling person for a training sample is limited by the perception of the color by the labeling person, and different labeling persons may be labeled with different colors for the same color. Therefore, the labeling of the local image area of the sample object by the labeling staff with only one color brings larger error, and the trained color classification model is lower in precision finally. Moreover, the kind of the finally determined target color is also limited to the kind of the preset color. In order to solve the above problems, in the labeling process of training samples, a labeling person can label at least one color of colors corresponding to each local image area contained in an image of each sample object in advance based on preset colors, and can label at least part of the local image areas in the image of each sample object as a plurality of preset colors. For example, { image of sample object 1; coat image area: color 1 and color 2; lower garment image area: color 6; shoe image area: color 1; package 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 acquire a pre-stored training sample set.
Step 202, training a 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, and obtaining a trained color classification model.
In this embodiment, after the server acquires the 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 area and at least one sample color corresponding to each local image area until the color classification model to be trained meets the preset precision, so that the trained color classification model is obtained. Therefore, the trained color classification model can output at least a plurality of candidate colors in the use process, and the composite color of the candidate colors is determined as the target color, so that the accuracy of the color classification model is improved, the types of the target colors are further limited to the types of preset colors, and the types of the target colors are expanded.
Fig. 3 is a flowchart of an example of an object color recognition method according to an embodiment of the present application, where, as shown in the drawing, a specific processing procedure is as follows:
step 301, an image to be identified is acquired.
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, taking the image contained in the object detection frame corresponding to each object to be identified as the image of each object to be identified.
Step 304, inputting the image of the object to be identified 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 identified.
In step 305, for each local image area, among the preset colors, the candidate color corresponding to the local image area is determined by using the preset color with the probability greater than the preset probability threshold.
Step 306, for each local image region, determining whether the number of candidate colors corresponding to the local image region is plural.
If the number of candidate colors corresponding to the partial image region is a plurality, step 307 is performed. If the number of candidate colors corresponding to the partial image region is one, step 310 is performed.
Step 307, determining whether the two candidate colors corresponding to the partial image area are contrasting colors or complementary colors.
If the two candidate colors corresponding to the partial image region are contrasting or complementary colors, then step 308 is performed. If the two candidate colors corresponding to the partial image region are neighboring colors or the same type of color, step 309 is performed.
And 308, determining the candidate color with the highest probability as the target color corresponding to the local image region.
Step 309, 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 step 310, the candidate color corresponding to the local image area is determined as the target color corresponding to the local image area.
The processing procedures of step 301 to step 310 and the processing procedure types of step 101 to step 104 are not described here again.
The embodiment of the application also provides a device for identifying the color of the object, as shown in fig. 4, which comprises:
a first acquiring module 410, configured to acquire an image of an object to be identified;
the output module 420 is configured to input an image of the object to be identified into a pre-trained color classification model, and output candidate colors corresponding to each local image area included in the image of the object to be identified;
a first determining module 430, configured to determine, for each local image area, if the number of candidate colors corresponding to the local image area is multiple, 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 determining rule;
the second determining module 440 is configured to determine the candidate color corresponding to the local image area as the target color corresponding to the local image area if the number of candidate colors corresponding to the local image area is one.
As an alternative embodiment, the output module 420 is specifically configured to:
inputting an image of an object to be identified 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 identified;
for each local image area, determining candidate colors corresponding to the local image area by using preset colors with probability larger than a preset probability threshold value in the preset colors; or alternatively, the process may be performed,
and determining a preset number of candidate colors corresponding to each local image region in the sequence from the big probability to the small probability in each preset color according to each local image region.
As an alternative embodiment, each preset color comprises one or more of an untuned color or a tinted 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 contrasting 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 similar colors, 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 non-tone colors, the composite color of the two candidate colors is gray with a gray value between the gray values of the two candidate colors; when the two candidate colors are both tonal colors, the composite color of the two candidate colors is the mixed color of the two candidate colors; when the two candidate colors are a non-tonal color and a tonal color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors.
As an alternative embodiment, the device 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;
the training module is used for training the color classification model to be trained according to the images of the sample objects and at least one sample color corresponding to each local image area contained in each sample object, and obtaining a trained color classification model.
The application provides an object color recognition device. The server acquires an image of the object to be identified, inputs the image of the object to be identified 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 identified. Then, for each partial image area, if the number of candidate colors corresponding to the partial image area is a plurality of, the server determines a target color corresponding to the partial image area according to the plurality of candidate colors corresponding to the partial image area and a preset color determination rule. If the number of 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. In this way, 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 plurality of 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, including a memory and a processor, where the memory stores a computer program that can be executed on the processor, and the processor executes the computer program to implement the steps of the method for identifying object colors.
In one embodiment, a computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the above-described object color identification method.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile 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), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (10)

1. A method of 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 identified 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 identified;
for each local image area, if the number of candidate colors corresponding to the local image area is a plurality of, determining a target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and a preset color determination rule;
if the number of candidate colors corresponding to the local image area is one, determining the candidate color corresponding to the local image area as a target color corresponding to the local image area;
the number of candidate colors corresponding to the local image area is two, and the determining the target color corresponding to the local image area according to the plurality of candidate colors corresponding to the local image area and the preset color determining rule includes:
if the two candidate colors corresponding to the local image area are contrasting 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 similar colors, 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.
2. The method according to claim 1, wherein inputting the image of the object to be identified 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 identified, comprises:
inputting the image of the object to be identified 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 identified;
for each local image area, determining candidate colors corresponding to the local image areas by using preset colors with probability larger than a preset probability threshold value in the preset colors; or alternatively, the process may be performed,
and determining a preset number of candidate colors corresponding to each local image region in the sequence from the big probability to the small probability in each preset color according to each local image region.
3. The method of claim 2, wherein each of the preset colors comprises one or more of an untuned color or a tinted color.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
when the two candidate colors are colorless, the composite color of the two candidate colors is gray with gray values between the gray values of the two candidate colors;
when the two candidate colors are both tonal colors, the composite color of the two candidate colors is the mixed color of the two candidate colors;
when the two candidate colors are a non-tonal color and a tonal color, respectively, the composite color of the two candidate colors is an intermediate color of the two candidate colors.
5. The method according to any one of claims 1 to 4, 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;
training the color classification model to be trained according to the images of the sample objects and at least one sample color corresponding to each local image area contained in each sample object, and obtaining a trained color classification model.
6. 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 identified 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 identified;
a first determining module, configured to determine, for each local image area, a target color corresponding to the local image area according to a plurality of candidate colors corresponding to the local image area and a preset color determining rule if the number of candidate colors corresponding to the local image area is a plurality of;
a second determining module, configured to determine, if the number of candidate colors corresponding to the local image area is one, a candidate color corresponding to the local image area as a target color corresponding to the local image area; the number of candidate colors corresponding to the local image area is two, and the first determining module is specifically configured to determine a candidate color with the highest probability as a target color corresponding to the local image area if the two candidate colors corresponding to the local image area are contrasting colors or complementary colors, where 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 similar colors, 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.
7. The apparatus of claim 6, wherein the output module is specifically configured to:
inputting the image of the object to be identified 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 identified;
for each local image area, determining candidate colors corresponding to the local image areas by using preset colors with probability larger than a preset probability threshold value in the preset colors; or alternatively, the process may be performed,
and determining a preset number of candidate colors corresponding to each local image region in the sequence from the big probability to the small probability in each preset color according to each local image region.
8. The apparatus of claim 7, wherein each of the preset colors comprises one or more of an untuned color or a tinted color.
9. A computer device comprising a memory and a processor, the memory having stored thereon a computer program executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
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 CN111340896A (en) 2020-06-26
CN111340896B true 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)

Families Citing this family (2)

* 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
CN115984680A (en) * 2023-02-15 2023-04-18 博奥生物集团有限公司 Identification method and device for can printing colors, storage medium and equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6721446B1 (en) * 1999-04-26 2004-04-13 Adobe Systems Incorporated Identifying intrinsic pixel colors in a region of uncertain pixels

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
刘倩倩 ; 范越 ; 王琦 ; .基于车牌颜色特征的定位方法研究.科技创新导报.2009,(第31期),第11页. *

Also Published As

Publication number Publication date
CN111340896A (en) 2020-06-26

Similar Documents

Publication Publication Date Title
CN108446697B (en) Image processing method, electronic device and storage medium
CN112016464B (en) Method and device for detecting face shielding, electronic equipment and storage medium
CN111340896B (en) Object color recognition method, device, computer equipment and storage medium
Ismael et al. Face recognition using Viola-Jones depending on Python
CN111160275B (en) Pedestrian re-recognition model training method, device, computer equipment and storage medium
CN108229522B (en) Neural network training method, attribute detection device and electronic equipment
CN108734684B (en) Image background subtraction for dynamic illumination scene
CN111461101B (en) Method, device, equipment and storage medium for identifying work clothes mark
CN110163250B (en) Image desensitization processing system, method and device based on distributed scheduling
CN110543823B (en) Pedestrian re-identification method and device based on residual error network and computer equipment
CN113723513B (en) Multi-label image classification method and device and related equipment
US20210216912A1 (en) Device and computer-implemented method for data-efficient active machine learning
CN112633297A (en) Target object identification method and device, storage medium and electronic device
CN115170792B (en) Infrared image processing method, device and equipment and storage medium
CN113792827A (en) Target object recognition method, electronic device, and computer-readable storage medium
CN116071294A (en) Optical fiber surface defect detection method and device
CN108154199B (en) High-precision rapid single-class target detection method based on deep learning
CN107862654A (en) Image processing method, device, computer-readable recording medium and electronic equipment
CN113128522B (en) Target identification method, device, computer equipment and storage medium
CN108197563B (en) Method and device for acquiring information
Sari et al. Assessment of color levels in leaf color chart using smartphone camera with relative calibration
CN109583326A (en) Method, apparatus and computer equipment based on recognition of face verifying outsourcing employee
CN109977729A (en) A kind of Method for text detection and device
CN111428553B (en) Face pigment spot recognition method and device, computer equipment and storage medium
CN112037202A (en) Method and device for detecting quality of body fluid sample, transportation device, equipment and 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