Color classification method and device, storage medium and equipment

By dividing the image into sub-images in the HSV color space and combining them with location information, the problem of prior knowledge and environmental interference in existing technologies is solved, and accurate and fast object color classification is achieved.

CN120833496APending Publication Date: 2025-10-24BEIJING TECHSHINO TECHNOLOGY CO LTD +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410480314.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-22
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Existing color classification methods require specialized prior knowledge and are difficult to eliminate interference from the environment and object attributes, leading to inaccurate classification.

Method used

The image is divided into multiple sub-HSV color spaces using the HSV color space. The color statistical code of each sub-image is statistically calculated, and the location information and color statistical code are combined to generate location information and color statistical code. The location information and color statistical code classifier are used for classification.

Benefits of technology

Accurate classification of object colors can be achieved without professional prior knowledge, which reduces the difficulty of reasoning and improves classification speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120833496A_ABST
    Figure CN120833496A_ABST
Patent Text Reader

Abstract

The invention discloses a color classification method and device, a storage medium and equipment, and belongs to the field of computer vision. The method comprises the following steps: firstly, dividing a to-be-classified image into a plurality of sub-images and converting the sub-images into an HSV color space; dividing the HSV color space into a plurality of sub HSV color spaces; then generating position information and color statistical codes according to the number of pixels of the sub-images in each sub-HSV color space and the positions of the sub-images; and finally, inputting the position information and the color statistical codes into a position information and color statistical code classifier to obtain the color category of the to-be-classified image. According to the method, the position information and the color statistical codes of the image are designed, the position information and color statistical code classifier matched with the position information and the color statistical codes is designed, color classification is achieved by combining the position information and the color statistical codes, and accurate classification of object colors can be achieved without professional priori knowledge. In addition, the image is compressed, the reasoning difficulty is reduced, and the reasoning speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision, and in particular to a color classification method, apparatus, storage medium, and device. Background Art

[0002] Color classification is a technology that classifies the colors of target objects in images detected by image detection models. It is one of the applications in the field of computer vision. For example, the pre-set color categories include: {black, white, gray, brown, red, green, blue, yellow, purple, orange}, and the prediction Figure 1 The color of the vehicle.

[0003] Color statistics is a relatively common color classification method. This method delineates the color space in advance based on a large amount of prior knowledge. For example, in the RGB color space, R>200, G<50, and B<50 are defined as red (each pre-set color has a value range). Then, the number of pixels in the image that meet the red condition is counted. When the proportion of red pixels in the entire image is greater than the set threshold, the object is judged to be red.

[0004] However, the color statistics method has the following defects:

[0005] (1) Professional prior knowledge is required, and the range of pre-set colors is very difficult to determine.

[0006] (2) It is impossible to eliminate the interference of environment and object properties. Figure 1 As shown, the vehicle is green, but the proportion of green is not as large as that of black. The statistical color classification method will classify the vehicle as black. Summary of the Invention

[0007] To address the deficiencies of the prior art, the present application provides a color classification method, apparatus, storage medium, and device that enable rapid and accurate classification of object colors without requiring specialized prior knowledge.

[0008] The technical solutions provided in this application are as follows:

[0009] In a first aspect, the present application provides a color classification method, the method comprising:

[0010] Acquire an image to be classified, and divide the image to be classified into a plurality of sub-images;

[0011] Convert each sub-image to HSV color space;

[0012] Divide the value ranges of the H channel, S channel, and V channel of the HSV color space into h_n, s_n, and v_n parts respectively, to obtain h_n*s_n*v_n sub-HSV color spaces;

[0013] counting the number of pixels of the sub-image falling in each sub-HSV color space to obtain a color statistic code of the sub-image;

[0014] generating position information and color statistic codes according to the color statistic codes of the sub-images and the position information of the sub-images;

[0015] inputting the position information and color statistic codes into a position information and color statistic code classifier to obtain a color category of the image to be classified.

[0016] Further, the generating position information and color statistic codes according to the color statistic codes of the sub-images and the position information of the sub-images comprises:

[0017] arranging the color statistic codes of all the sub-images according to a set first arrangement order, taking the first arrangement order of the color statistic codes as the position information of the corresponding sub-image to generate the position information and color statistic codes.

[0018] Further, the counting the number of pixels of the sub-image falling in each sub-HSV color space to obtain a color statistic code of the sub-image comprises:

[0019] arranging all the sub-HSV color spaces according to a set second arrangement order;

[0020] sequentially counting the number of pixels of the sub-image falling in each sub-HSV color space according to the second arrangement order;

[0021] sequentially taking the number of pixels of the sub-image falling in each sub-HSV color space as the element value of each position of the color statistic code according to the second arrangement order to obtain the color statistic code.

[0022] Further, the inputting the position information and color statistic codes into a position information and color statistic code classifier further comprises:

[0023] uniformly processing the position information and color statistic codes.

[0024] Further, the uniformly processing the position information and color statistic codes comprises:

[0025] respectively dividing the element value of each position of the color statistic code by the sum of the element values of all positions of the color statistic code to realize the uniform processing.

[0026] Further, the position information and color statistic code classifier comprises a color classifier and is configured with learnable position weights.

[0027] The color classification method comprises the following steps:

[0028] The color classification method comprises the following steps:

[0029] The color classification method comprises the following steps:

[0030] Further, the step of dividing the image to be classified into a plurality of sub-images comprises:

[0031] The image to be classified is divided into a plurality of sub-images in an equal division manner;

[0032] and / or;

[0033] The value ranges of the H channel, the S channel and the V channel of the HSV color space are divided into h_n, s_n and v_n parts, respectively, and the step of dividing the value ranges of the H channel, the S channel and the V channel of the HSV color space into h_n, s_n and v_n parts, respectively, comprises:

[0034] The value ranges of the H channel, the S channel and the V channel of the HSV color space are divided into h_n, s_n and v_n parts, respectively, in an equal division manner.

[0035] In a second aspect, the present application provides a color classification device, which comprises:

[0036] An image division module is configured to acquire an image to be classified and divide the image to be classified into a plurality of sub-images;

[0037] A color space conversion module is configured to convert each sub-image to an HSV color space;

[0038] A color space division module is configured to divide the value ranges of the H channel, the S channel and the V channel of the HSV color space into h_n, s_n and v_n parts, respectively, to obtain h_n*s_n*v_n sub-HSV color spaces;

[0039] A color encoding module is configured to, for each sub-image, count the number of pixels of the sub-image falling in each sub-HSV color space to obtain a color statistical code of the sub-image;

[0040] A position and color encoding module is configured to, for all sub-images, generate a position information and color statistical code according to the color statistical code of the sub-image and the position information of the sub-image;

[0041] The color classification module is configured to input the position information and the color statistic code into a position information and color statistic code classifier to obtain a color category of the image to be classified.

[0042] Further, the position and color encoding module is configured to:

[0043] The color statistic codes of all the sub-images are arranged according to a first arrangement order, and the first arrangement order of the color statistic codes is taken as the position information of the corresponding sub-image to generate the position information and color statistic code.

[0044] Further, the color encoding module comprises:

[0045] The sorting unit is configured to arrange all the sub-HSV color spaces according to a second arrangement order.

[0046] The statistic unit is configured to sequentially count the number of pixels of the sub-image falling in each sub-HSV color space according to the second arrangement order.

[0047] The encoding unit is configured to sequentially take the number of pixels of the sub-image falling in each sub-HSV color space as an element value of each position of the color statistic code according to the second arrangement order to obtain the color statistic code.

[0048] Further, the device further comprises:

[0049] The uniformization module is configured to perform uniformization processing on the position information and color statistic code.

[0050] Further, the uniformization module is configured to:

[0051] The element value of each position of the color statistic code is divided by the sum of the element values of all positions of the color statistic code to realize the uniformization processing.

[0052] Further, the position information and color statistic code classifier comprises a color classifier and is configured with a learnable position weight.

[0053] The color classification module comprises:

[0054] The classification unit is configured to classify the position information and color statistic code classifier by the color classifier to obtain the color classification of each sub-image.

[0055] The calculation unit is configured to calculate the color classification of the image to be classified according to the color classification of each sub-image and the corresponding learnable position weight.

[0056] Further, in the image division module, the image to be classified is divided into multiple sub-images in an equal division manner.

[0057] And / or

[0058] In the color space division module, the value range of the H channel, the S channel and the V channel of the HSV color space is divided into h_n, s_n and v_n parts respectively in an equal division manner.

[0059] In a third aspect, the present application provides a computer readable storage medium for color classification, comprising a memory for storing processor executable instructions, the instructions being executed by the processor to implement the steps of the color classification method of the first aspect.

[0060] In a fourth aspect, the present application provides a device for color classification, characterized in that it comprises at least one processor and a memory storing computer executable instructions, the processor executing the instructions to implement the steps of the color classification method of the first aspect.

[0061] The present application has the following beneficial effects:

[0062] The present application designs the position information and color statistical encoding of the image, and designs the position information and color statistical encoding classifier matched therewith, realizes color classification by combining the position information and color statistical encoding, and realizes accurate classification of the color of the object without professional prior knowledge. In addition, the present application compresses the image, reduces the inference difficulty, and improves the inference speed. BRIEF DESCRIPTION OF DRAWINGS

[0063] Figure 1 FIG. 1 is a schematic diagram of an image for color classification;

[0064] Figure 2 FIG. 5 is a flowchart of the color classification method of the present application;

[0065] Figure 3 FIG. 8 is a schematic diagram of the position information and color statistical encoding classifier of the present application;

[0066] Figure 4 FIG. 11 is a schematic diagram of the color classification device of the present application. DETAILED DESCRIPTION

[0067] In order to make the technical problems, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below in conjunction with the drawings and specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work belong to the scope of protection of the present application.

[0068] The embodiments of the present application provide a color classification method, as shown in the method, the method comprises: Figure 2

[0069] S100: acquiring an image to be classified, and dividing the image to be classified into a plurality of sub-images.

[0070] When the embodiments of the present application divide the sub-images, the division can be performed in an equal division manner, for example, 4 equal divisions, 9 equal divisions, 16 equal divisions, etc., or can be performed in a non-equal division manner.

[0071] S200: converting each sub-image to an HSV color space.

[0072] The image to be classified and the divided sub-images thereof are all images in an RGB color space, which need to be converted to an HSV color space. The specific conversion method is known in the prior art, and will not be described herein.

[0073] S300: dividing the value ranges of the H channel, the S channel and the V channel of the HSV color space into h_n, s_n and v_n parts respectively, to obtain h_n*s_n*v_n sub-HSV color spaces.

[0074] When the HSV color space is divided, the division can be performed in an equal division manner or in a non-equal division manner, which is not limited by the present application. After the HSV color space is divided, the HSV color space is discretized into a plurality of sub-HSV color spaces.

[0075] In one example, the division is performed in an equal division manner, h_n=2, s_n=3, v_n=2, the H channel is equally divided into H_1 and H_2 (if 0<=H<360, then 0<=H_1<180, 180<=H_2<360), the S channel is equally divided into S_1, S_2 and S_3, and the V channel is equally divided into V_1 and V_2. The following 12 sub-HSV color spaces are obtained:

[0076] { ​

[0077] [H_1,S_1,V_1],

[0078] [H_1,S_1,V_2],

[0079] [H_1,S_2,V_1],

[0080] [H_1,S_2,V_2],

[0081] [H_1,S_3,V_1],

[0082] [H_1,S_3,V_2],

[0083] [H_2,S_1,V_1],

[0084] [H_2,S_1,V_2],

[0085] [H_2,S_2,V_1],

[0086] [H_2,S_2,V_2],

[0087] [H_2,S_3,V_1],

[0088] [H_2,S_3,V_2]

[0089] }

[0090] S400: For each sub-image, count the number of pixels in each sub-HSV color space, and obtain the color statistical code of the sub-image.

[0091] When counting, the number of pixels in each sub-HSV color space is formed into a vector form to obtain the color statistical code. For example, assuming that the color statistical code of a sub-image is [2, 3, 4, 1, 2, 0, 0, 0, 0, 0, 3, 5], the code length is equal to h_n*s_n*v_n=12.

[0092] The present application compresses the image through color statistical coding, so that the inference difficulty is reduced and the inference speed is improved. Assuming that a 200*200 RGB sub-image contains 200*200*3=120000 information, through color statistical coding, assuming that h_n=10, s_n=8, and v_n=8, the sub-image is compressed into a 640-dimensional color statistical coding vector, and the size of the color statistical coding is consistent regardless of the size of the sub-image.

[0093] S500: For all sub-images, generate position information and color statistical code according to the color statistical code of the sub-image and the position information of the sub-image.

[0094] The color statistical coding represents the color information of each sub-image, but the position of each sub-image is different, and the contribution to the overall band classification image is different, so the application adds position information to the color statistics, and combines the color information and the position information to generate the position information and the color statistical coding.

[0095] S600: input the position information and the color statistical coding into the position information and color statistical coding classifier to obtain the color category of the image to be classified.

[0096] The position information and color statistical coding classifier needs to be trained in advance. During training, first, the color categories of the objects to be classified are determined, such as vehicle color classification, and the color categories can be set as: {black, white, gray, brown, red, green, blue, yellow, purple, orange}. Then, for each color, a certain amount of object picture data is collected as a training set, for example, for vehicle color classification, pictures of vehicles of different colors can be collected. Finally, the position information and color statistical coding classifier is trained according to the training set.

[0097] The position information and color statistical coding classifier is trained or the position information and color statistical coding is input, and the color category of the image to be classified can be determined according to the combination of the position information and the color information.

[0098] The application designs the position information and color statistical coding of the image, and designs the position information and color statistical coding classifier matched therewith, realizes color classification by combining the position information and the color statistical coding, and realizes accurate classification of the color of the object without professional prior knowledge. In addition, the application compresses the image, reduces the inference difficulty, and improves the inference speed.

[0099] As an improvement of an embodiment of the application, the foregoing S500 comprises:

[0100] The color statistical coding of all sub-images is arranged according to a set first arrangement order, and the first arrangement order of the color statistical coding is taken as the position information of the corresponding sub-image to generate the position information and color statistical coding.

[0101] The application takes the arrangement order of the color statistical coding as the position information, without adding extra information. For example, it is assumed that the image to be classified is divided into four sub-images, which are arranged in order as the upper left sub-image, the upper right sub-image, the lower left sub-image, and the lower right sub-image, and the color statistical coding is also arranged in this order, and the obtained position information and color statistical coding are as follows:

[0102] {

[0103] [2, 3, 3, 1, 2, 0, 7, 0, 9, 0, 3, 5],

[0104] [1, 3, 4, 1, 2, 0, 7, 4, 0, 5, 3, 5],

[0105] [8, 3, 4, 1, 2, 0, 0, 9, 0, 0, 3, 5],

[0106] [2, 3, 4, 1, 3, 0, 4, 0, 10, 0, 3, 5]

[0107] }

[0108] Since the above example is equal division, the total number of pixels of each sub-image is the same, i.e. the sum of each element of the color statistic code is equal. When unequal division, the sum of each element of the color statistic code is not equal.

[0109] Further, the aforementioned S400 comprises:

[0110] S410: arranging all sub-HSV color spaces according to a set second arrangement order.

[0111] For example, the arrangement is as shown in the aforementioned S300.

[0112] S420: according to the second arrangement order, sequentially counting the number of pixels of the sub-image falling in each sub-HSV color space;

[0113] S430: according to the second arrangement order, sequentially taking the number of pixels of the sub-image falling in each sub-HSV color space as the element value of each position of the color statistic code, to obtain the color statistic code.

[0114] In the present application, before S600, further comprises:

[0115] Uniformly processing the position information and the color statistic code.

[0116] Specifically, the element value of each position of the color statistic code can be divided by the sum of the element values of all positions of the color statistic code, to realize the uniform processing.

[0117] For example, the position information and the color statistic code after uniform processing are as follows:

[0118] {

[0119] [0.0571, 0.0857, 0.0857, 0.0286, 0.0571, 0.0000, 0.2000, 0.0000, 0.2571, 0.0000, 0.0857, 0.1429],

[0120] [0.0286, 0.0857, 0.1143, 0.0286, 0.0571, 0.0000, 0.2000, 0.1143, 0.0000, 0.1429, 0.0857, 0.1429],

[0121] [0.2286, 0.0857, 0.1143, 0.0286, 0.0571, 0.0000, 0.0000, 0.2571, 0.0000, 0.0000, 0.0857, 0.1429],

[0122] [0.0571, 0.0857, 0.1143, 0.0286, 0.0857, 0.0000, 0.1143, 0.0000, 0.2857, 0.0000, 0.0857, 0.1429]

[0123] }

[0124] As another improvement of the embodiments of the present application, the position information and color statistical encoding classifier includes a color classifier C and is configured with a learnable position weight W, as shown in the following formula (1). Figure 3 The color classifier C can be a CNN network or a model such as a multi-layer perceptron. The learnable position weight W is a vector equal to the dimension of the to-be-classified partition, which can adapt to different object attributes and learn the corresponding position weight.

[0125] Correspondingly, S600 includes:

[0126] S610: classifying the position information and color statistical encoding classifier through the color classifier to obtain the color classification of each sub-image.

[0127] S620: calculating the color classification of the to-be-classified image according to the color classification of each sub-image and the corresponding learnable position weight.

[0128] For example, the final color classification can be calculated by weighting the color classification position weight.

[0129] The position information and color statistical encoding classifier of the present application can adapt to different object attributes, learn the corresponding position weight without human intervention, and the final color classification is more accurate and has improved anti-interference performance.

[0130] The embodiments of the present application also provide a color classification device, as shown in the following formula (2). Figure 4 The device includes:

[0131] An image division module 100 is configured to obtain a to-be-classified image and divide the to-be-classified image into a plurality of sub-images.

[0132] The color space conversion module 200 is used to convert each sub-image into the HSV color space.

[0133] The color space division module 300 is used to divide the value ranges of the H channel, S channel and V channel of the HSV color space into h_n, s_n and v_n parts respectively, to obtain h_n*s_n*v_n sub-HSV color spaces.

[0134] The color coding module 400 is used to count the number of pixels of each sub-image that fall within each sub-HSV color space, and obtain a color statistical code of the sub-image.

[0135] The position and color coding module 500 is configured to generate position information and color statistical codes for all sub-images according to the color statistical codes of the sub-images and the position information of the sub-images.

[0136] The color classification module 600 is used to input the position information and the color statistical code into a position information and color statistical code classifier to obtain the color category of the image to be classified.

[0137] This application designs an image's position information and color statistical coding, and a corresponding position information and color statistical coding classifier. By combining position information and color statistical coding to achieve color classification, the application can accurately classify object colors without requiring specialized prior knowledge. Furthermore, this application compresses the image, reducing the difficulty of reasoning and increasing its speed.

[0138] As an improvement to the embodiment of the present application, the aforementioned position and color coding module is used to:

[0139] The color statistical codes of all sub-images are arranged according to a set first arrangement order, and the first arrangement order of the color statistical codes is used as position information of the corresponding sub-images to generate position information and color statistical codes.

[0140] Furthermore, the aforementioned color coding module includes:

[0141] The sorting unit is used to sort all sub-HSV color spaces according to the set second sorting order.

[0142] The counting unit is used to count the number of pixels of the sub-image falling within each sub-HSV color space in sequence according to the second arrangement order.

[0143] The encoding unit is used to sequentially use the number of pixels of the sub-image falling within each sub-HSV color space as the element value of each position of the color statistical code in accordance with the second arrangement order to obtain the color statistical code.

[0144] The device of the present application may further include:

[0145] a uniformization module configured to uniformize the position information and the color statistic code.

[0146] Specifically, the uniformization module is configured to:

[0147] divide the element value of each position of the color statistic code by the sum of the element values of all positions of the color statistic code, to realize the uniformization.

[0148] As an improvement of the embodiments of the present application, the position information and color statistic code classifier described above comprises a color classifier and is configured with learnable position weights.

[0149] Correspondingly, the color classification module comprises:

[0150] a classification unit configured to classify the position information and color statistic code classifier by the color classifier to obtain the color classification of each sub-image.

[0151] a calculation unit configured to calculate the color classification of the image to be classified according to the color classification of each sub-image and the corresponding learnable position weights.

[0152] As some examples, in the image division module described above, the image to be classified can be divided into multiple sub-images in an equal division manner.

[0153] In the color space division module described above, the value range of the H channel, the S channel and the V channel of the HSV color space can be divided into h_n, s_n and v_n parts, respectively, in an equal division manner.

[0154] The device provided by the above embodiments has the same implementation principle and technical effects as the above-mentioned method embodiments. For brevity and conciseness, the specific working process of the modules and units of the device is described below. For reference, the corresponding process in the above-mentioned method embodiments is described below, and will not be repeated here.

[0155] The color classification method described in the above embodiments provided by the present application can implement business logic through a computer program and be recorded on a storage medium. The storage medium can be read and executed by a computer to achieve the effects of the schemes described in the method embodiments of the present application. Therefore, the embodiments of the present application also provide a computer readable storage medium for color classification, which includes a memory for storing processor executable instructions. When the instructions are executed by a processor, the steps of the color classification method comprising the above embodiments are realized.

[0156] The storage medium can include a physical device for storing information, usually after digitizing the information and then storing it with media using electricity, magnetism or optics, etc. The storage medium can include devices that store information using electrical energy, such as various memories, such as RAM, ROM, etc.; devices that store information using magnetic energy, such as hard disks, floppy disks, magnetic tapes, magnetic core memories, bubble memories, U disks; devices that store information using optical methods, such as CDs or DVDs. Of course, there are other ways of reading the storage medium, such as quantum memory, graphene memory, etc.

[0157] The storage medium described above according to the description of the method embodiment can also include other embodiments, the implementation principle and the technical effects of the present embodiment are the same as the foregoing method embodiments, and the specific description can be referred to the description of the related method embodiments, which will not be repeated here.

[0158] The present application embodiment also provides a device for color classification, which can be a separate computer, or can include an actual operation device using one or more methods or one or more embodiment devices of the present application. The color classification device can include at least one processor and a memory storing computer executable instructions, and the processor executes the instructions to implement the steps of any one or more color classification methods described above.

[0159] The device described above according to the description of the method embodiment can also include other embodiments, the implementation principle and the technical effects of the present embodiment are the same as the foregoing method embodiments, and the specific description can be referred to the description of the related method embodiments, which will not be repeated here.

[0160] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them, the protection scope of the present application is not limited thereto, although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: any person skilled in the art within the technical range disclosed by the present application, they can still modify or easily think of changes to the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications, changes or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the present application. All should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A color sorting method characterized by, The method comprises: acquiring an image to be classified and dividing the image to be classified into a plurality of sub-images; converting each sub-image into an HSV color space; dividing the value ranges of the H channel, the S channel and the V channel of the HSV color space into h_n, s_n and v_n parts respectively, to obtain h_n*s_n*v_n sub-HSV color spaces; for each sub-image, counting the number of pixels of the sub-image falling into each sub-HSV color space, to obtain a color statistical code of the sub-image; for all sub-images, generating a position information and color statistical code according to the color statistical code of the sub-image and the position information of the sub-image; inputting the position information and color statistical code into a position information and color statistical code classifier, to obtain a color category of the image to be classified.

2. The color sorting method according to claim 1, characterized by, The method for generating the position information and color statistical code according to the color statistical code of the sub-image and the position information of the sub-image comprises: arranging the color statistical codes of all sub-images according to a first arrangement order, taking the first arrangement order of the color statistical code as the position information of the corresponding sub-image, to generate the position information and color statistical code.

3. The color sorting method according to claim 1, characterized by, The method for counting the number of pixels of the sub-image falling into each sub-HSV color space to obtain the color statistical code of the sub-image comprises: arranging all sub-HSV color spaces according to a second arrangement order; sequentially counting the number of pixels of the sub-image falling into each sub-HSV color space according to the second arrangement order; sequentially taking the number of pixels of the sub-image falling into each sub-HSV color space as the element value of each position of the color statistical code according to the second arrangement order, to obtain the color statistical code.

4. The color sorting method according to claim 3, characterized in that, The method further comprises: uniformly processing the position information and color statistical code.

5. The color sorting method according to claim 4, characterized in that, The method for uniformly processing the position information and color statistical code comprises: dividing the element value of each position of the color statistical code by the sum of the element values of all positions of the color statistical code, to realize the uniform processing.

6. The color sorting method according to any one of claims 1 to 5, characterized in that, The position information and color statistical code classifier comprises a color classifier and is configured with learnable position weights. The method for inputting the position information and color statistical code into the position information and color statistical code classifier to obtain the color category of the image to be classified comprises: classifying the position information and color statistical code classifier through the color classifier, to obtain the color classification of each sub-image; calculating the color category of the image to be classified according to the color classification of each sub-image and the corresponding learnable position weights.

7. The color sorting method according to claim 6, characterized in that, The method for dividing the image to be classified into a plurality of sub-images comprises: dividing the image to be classified into a plurality of sub-images in an equal division manner; and / or The method for dividing the value ranges of the H channel, the S channel and the V channel of the HSV color space into h_n, s_n and v_n parts respectively comprises: The value ranges of H channel, S channel and V channel of the HSV color space are divided into h_n, s_n and v_n parts respectively in an equal division manner.

8. A color sorting apparatus characterized by comprising: The device comprises: An image division module, configured to acquire a to-be-classified image and divide the to-be-classified image into a plurality of sub-images; A color space conversion module, configured to convert each sub-image to an HSV color space; A color space division module, configured to divide the value ranges of H channel, S channel and V channel of the HSV color space into h_n, s_n and v_n parts respectively, and obtain h_n*s_n*v_n sub-HSV color spaces; A color coding module, configured to, for each sub-image, count the number of pixels of the sub-image falling in each sub-HSV color space, and obtain color statistical coding of the sub-image; A position and color coding module, configured to, for all sub-images, generate position information and color statistical coding according to the color statistical coding of the sub-images and the position information of the sub-images; A color classification module, configured to input the position information and color statistical coding into a position information and color statistical coding classifier, and obtain the color category of the to-be-classified image.

9. A computer readable storage medium for color classification, the method comprising: A computer program product, comprising a memory for storing processor-executable instructions, which, when executed by the processor, implement the steps of the color classification method according to any one of claims 1-7.

10. An apparatus for color classification, characterized by, A computer device, comprising at least one processor and a memory storing computer-executable instructions, which, when executed by the processor, implement the steps of the color classification method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for carrying out color classification on target image

    CN103366178A

  • Vehicle color recognition method and device

    CN106384117A

  • Method and device for identifying vehicle colors

    CN107301421A