A clothes color detection method, system, electronic device and storage medium
Patent Information
- Application Number
- CN202510775097.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2045-06-11
AI Technical Summary
传统图像颜色识别的方法,准确率较低,受光照等影响较大,由于洗衣机内光照无法做到全方位均匀,则会存在光照亮与光照暗的区域,光照暗的区域的衣物颜色稍暗,会被识别为比正常暗的颜色
[0034] The beneficial effects of this invention are as follows: The clothing color detection method, system, electronic device, and storage medium of this invention first collect a first training dataset, label the first training dataset to obtain a second training dataset, then construct a weight table, and obtain a color multi-classification model based on the weight table and the second training dataset. Finally, it acquires an image of the clothing to be detected, and obtains the clothing color detection result based on the image of the clothing to be detected through the color multi-classification model. This invention uses a weight table to train the color multi-classification model, which can improve the stability and robustness of the model in the color recognition process, reduce the problem of model training chaos caused by chaotic data labeling, and improve the accuracy of clothing color detection in washing machines.
Smart Images

Figure CN120852802B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, system, electronic device and storage medium for detecting clothing color. Background Technology
[0002] Smart washing machines intelligently determine the subsequent washing process and parameters by recognizing relevant attributes of clothing. Clothing color is a crucial attribute that significantly impacts the intelligence of a smart washing machine. Traditional image-based color recognition methods have low accuracy and are greatly affected by lighting conditions. Since lighting inside a washing machine cannot be perfectly uniform, there will be areas of both bright and dark lighting. Clothing in darker areas will be slightly darker and thus misidentified as darker than normal. When using deep learning models to identify clothing colors, it's difficult to achieve perfectly standardized labeling. These non-standard labels can confuse the model during training, hindering convergence and potentially resulting in a model that incorrectly classifies a very obvious color. Summary of the Invention
[0003] To address the aforementioned technical problems, the present invention aims to provide a highly accurate method, system, electronic device, and storage medium for detecting clothing color.
[0004] To achieve the above objectives, one aspect of this application proposes a method for detecting clothing color, comprising the following steps:
[0005] Collect a first training dataset, label the first training dataset, and obtain a second training dataset;
[0006] Construct a weight table, and obtain a color multi-classification model based on the weight table and the second training dataset;
[0007] An image of the clothing to be detected is acquired, and the color detection result of the clothing is obtained based on the image of the clothing using the color multi-classification model.
[0008] In some embodiments, the clothing color detection method further includes:
[0009] Define color categories, which include several monochrome categories and several non-monochrome categories.
[0010] In some embodiments, the step of collecting a first training dataset, labeling the first training dataset, and obtaining a second training dataset specifically includes:
[0011] Collect the first training dataset, which includes several clothing image data;
[0012] The clothing image data are labeled according to the color category to obtain the second training dataset.
[0013] In some embodiments, the step of labeling each of the clothing image data according to the color category to obtain the second training dataset specifically includes:
[0014] Determine the color category of the clothing image data;
[0015] When the color category of the clothing image data is between two color categories, the clothing image data is labeled with at most two corresponding color categories to obtain the second training dataset.
[0016] In some embodiments, constructing the weight table specifically includes:
[0017] Set a bias value, and calculate the distance difference between each monochrome category based on the bias value to obtain a first weight value;
[0018] The distance difference between each of the aforementioned non-monochrome categories is set to obtain the second weight value;
[0019] A third weight value is obtained by setting the distance difference between each non-monochrome category and each monochrome category;
[0020] The weight table is constructed based on the first weight value, the second weight value, and the third weight value.
[0021] In some embodiments, obtaining the color multi-classification model based on the weight table and the second training dataset specifically includes:
[0022] Construct a deep learning model, which includes a feature extraction module, a global pooling layer, a linear output layer, and a Sigmoid layer;
[0023] The second training dataset is input into the deep learning model for training;
[0024] The loss value is calculated based on the weight table, and the parameters of the trained deep learning model are optimized based on the loss value to obtain the color multi-classification model.
[0025] In some embodiments, obtaining the clothing color detection result based on the clothing image to be detected using the color multi-classification model specifically includes:
[0026] The image of the clothing to be detected is input into the color multi-classification model, which outputs multiple color category prediction values.
[0027] The color category corresponding to the largest predicted color category value is selected as the color detection result of the clothing image to be detected.
[0028] To achieve the above objectives, another aspect of this application provides a clothing color detection system, comprising:
[0029] The first module is used to collect a first training dataset, label the first training dataset, and obtain a second training dataset;
[0030] The second module is used to construct a weight table and obtain a color multi-classification model based on the weight table and the second training dataset.
[0031] The third module is used to acquire an image of the clothing to be detected, and to obtain the clothing color detection result based on the image of the clothing to be detected using the color multi-classification model.
[0032] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for enabling communication between the processor and the memory. When the program is executed by the processor, it implements the clothing color detection method described above.
[0033] To achieve the above objectives, another aspect of the embodiments of this application proposes a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs that can be executed by one or more processors to implement the clothing color detection method as described above.
[0034] The beneficial effects of this invention are as follows: The clothing color detection method, system, electronic device, and storage medium of this invention first collect a first training dataset, label the first training dataset to obtain a second training dataset, then construct a weight table, and obtain a color multi-classification model based on the weight table and the second training dataset. Finally, it acquires an image of the clothing to be detected, and obtains the clothing color detection result based on the image of the clothing to be detected through the color multi-classification model. This invention uses a weight table to train the color multi-classification model, which can improve the stability and robustness of the model in the color recognition process, reduce the problem of model training chaos caused by chaotic data labeling, and improve the accuracy of clothing color detection in washing machines. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the embodiments of the present invention are described below. It should be understood that the drawings described below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a flowchart of the steps of a clothing color detection method provided in one embodiment of the present invention;
[0037] Figure 2 This is a schematic diagram of the deep learning model training process provided in one embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of the structure of a clothing color detection system provided in one embodiment of the present invention;
[0039] Figure 4 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0041] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0042] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0043] Smart washing machines intelligently determine the subsequent washing process and parameters by recognizing relevant attributes of the clothing. Clothing color is a crucial attribute that significantly impacts the intelligence of smart washing machines.
[0044] Traditional image color recognition methods have low accuracy and are greatly affected by lighting conditions. Since lighting inside a washing machine cannot be uniformly distributed, there will be areas of both bright and dark light. Clothing in darker areas will be slightly darker and will be identified as a darker color than normal. Furthermore, traditional image recognition methods can only identify the color of certain points or areas and cannot generalize the color of the entire garment. For example, they struggle to accurately identify striped, checkered, printed, or multicolored clothing.
[0045] Using deep learning models to identify clothing colors faces challenges in achieving highly standardized labeling after clothing data collection. Different labeling engineers may have varying color judgments, and even the same engineer can be influenced by subjective psychological states at different times, leading to inconsistent judgments. This makes it difficult to establish a consistently high standard for labeling the dataset. Furthermore, some colors are very similar, such as sky blue and cyan, making it difficult even for relatively experienced engineers to provide accurate initial judgments. These non-standard labeled data can confuse the deep learning model during training, hindering convergence and potentially resulting in a model that misclassifies a very obvious color by significantly different categories.
[0046] To address the aforementioned issues, analysis reveals that during training, current deep learning classification models, when encountering training data with confusing labels for similar categories, exhibit a complex boundary in the feature space between the two classes due to the inherent "either A or B" nature of deep learning classification models. When a test image falls near this boundary and cannot be correctly classified, the model does not arbitrarily assign it to either class as expected. Instead, it considers the sample to belong to neither class and assigns it to another category that may be significantly different from the given color.
[0047] To address this issue, this invention proposes a method for clothing color detection. First, a first training dataset is collected and labeled to obtain a second training dataset. Then, a weight table is constructed. Based on the weight table and the second training dataset, a color multi-classification model is obtained. Finally, an image of the clothing to be detected is acquired, and the color detection result is obtained using the color multi-classification model based on the image. This invention uses a weight table to train the color multi-classification model, which improves the model's stability and robustness in the color recognition process, reduces the problem of model training chaos caused by chaotic data labeling, and improves the accuracy of clothing color detection in washing machines.
[0048] Reference Figure 1 , Figure 1 This is a flowchart illustrating the steps of a clothing color detection method according to an embodiment of the present invention. The embodiment of the present invention proposes a clothing color detection method, which includes steps S101 to S103:
[0049] S101. Collect the first training dataset, label the first training dataset, and obtain the second training dataset;
[0050] Specifically, image data of clothing is collected for training the model. In a real washing machine scenario, various types of clothing are placed in the washing machine, and image data is collected to simulate the actual state of the clothing in the washing machine.
[0051] As an optional implementation, the clothing color detection method further includes the following step S1011:
[0052] S1011. Define color categories, which include several monochrome categories and several non-monochrome categories.
[0053] Specifically, color categories are defined based on the colors and styles of clothing related to e-commerce and common clothing in daily life. This includes determining which clothing colors belong to a single-color category, such as white, black, red, blue, burgundy, etc. Non-single-color clothing, such as printed, striped, checkered, and floral patterns, are categorized separately. Furthermore, different colored stripes, such as black and white stripes, red and black stripes, and blue and white stripes, are categorized separately, and it is determined whether very similar colors should be merged into the same category.
[0054] As an optional implementation, the step of collecting a first training dataset, labeling the first training dataset, and obtaining a second training dataset can be further divided into the following steps S1012 and S1013:
[0055] S1012. Collect the first training dataset, which includes several clothing image data;
[0056] Specifically, in a real-world washing machine scenario, various types of clothing are placed in the washing machine, and corresponding clothing image data is collected. The clothing image data, including clothing color, style, and type, should cover common categories, resulting in the first training dataset used for training the deep learning model.
[0057] S1013. Label the clothing image data according to color category to obtain the second training dataset.
[0058] As an optional implementation, step S1013 can be further divided into the following steps S10131 and S10132:
[0059] S10131. Determine the color category of the clothing image data;
[0060] S10132. When the color category of clothing image data is between two color categories, label the clothing image data with at most two corresponding color categories to obtain the second training dataset.
[0061] It should be noted that the collected clothing images are labeled according to the defined color categories. Typically, each clothing image is labeled with the most appropriate color tag. For clothing images falling between two color categories (such as a "red-orange" transition color), at most two of the most relevant color tags are used. This more accurately guides the model to learn color boundary features and reduces the model's sensitivity to noisy data in the training dataset. Each image is labeled with a maximum of two tags; three or more tags are not assigned to avoid noise interfering with model learning.
[0062] S102. Construct a weight table and obtain a color multi-classification model based on the weight table and the second training dataset.
[0063] Specifically, a weight table is constructed based on the degree of difference between colors, so that categories with significantly different colors have higher weight values, while categories with similar colors have lower weight values. Thus, during model training, the model prioritizes learning to distinguish between categories with large color differences. After the model has learned a certain level, it then learns to distinguish between categories with less distinct colors. Using the weight table and a labeled training dataset, a color multi-classification model is trained.
[0064] As an optional implementation, the step of constructing the weight table can be further divided into the following steps S1021 to S1024:
[0065] S1021. Set the bias value, calculate the distance difference between each monochrome category based on the bias value, and obtain the first weight value;
[0066] S1022. Set the distance difference between each non-monochrome category to obtain the second weight value;
[0067] S1023. Set the distance difference between each non-monochrome category and each monochrome category to obtain the third weight value;
[0068] S1024. Construct a weight table based on the first weight value, the second weight value, and the third weight value.
[0069] Specifically, the weight table values represent the distance difference between color categories. Table 1 below shows an example of a weight representation provided in one embodiment of the present invention. This weight table expresses the distance difference between each color category and all other color categories. A difference of 1 indicates a standard distance, meaning the difference between the two categories is the standard difference, and it is not enhanced or weakened during the actual loss calculation. A difference greater than 1 indicates a large difference between the two color categories; a difference less than 1 indicates a small difference between the two color categories. The weight values are obtained by combining image color calculation with human experience.
[0070] Table 1
[0071] White 0 2.1 black 2.1 0 blue 0 red 0 Claret 0 Black and white stripes 0 Blue and white stripes 0 .....
[0072] In some optional embodiments, for the first weight value between monochrome categories, the difference between the two standard color categories is obtained by numerical calculation. The distance difference between the first color C1(r, g, b) and the second color C2(r, g, b) is calculated by the following formula:
[0073] W(C1, C2)=Average(C1-C2) / 127.5+b
[0074] In the formula, b represents the bias value, which is determined according to the number of color categories. In the experiment of this embodiment, the bias value b = -30 obtained empirically. After obtaining the weight value from the above formula, the value is adjusted manually again.
[0075] For the second weight value between non-monochrome categories and the third weight value between non-monochrome categories, the above formula is not performed, and the weight value is assigned manually. While the value is set manually based on experience, the difference between dark and light colors, and the difference between easily faded and easily stained colors are appropriately increased to forcibly separate color combinations with huge visual differences (dark / light) or extremely high risks of physical interaction (easily faded / easily stained).
[0076] As an optional implementation, the step of obtaining the color multi-classification model based on the weight table and the second training dataset can be further divided into the following steps S1025 to S1027:
[0077] S1025. Construct a deep learning model, which includes a feature extraction module, a global pooling layer, a linear output layer, and a Sigmoid layer.
[0078] S1026. Input the second training dataset into the deep learning model for training;
[0079] S1027. Calculate the loss value based on the weight table, and optimize the parameters of the trained deep learning model based on the loss value to obtain a color multi-classification model.
[0080] Specifically, such as Figure 2 The diagram illustrates the training process of a deep learning model according to an embodiment of the present invention. The deep learning model uses a transformer backbone as the feature extraction module, followed by a global pooling layer to pool the features, and then a linear output layer for linear output. The output values are mapped to 0-1 using a sigmoid layer. Compared to traditional classification networks, this embodiment replaces the commonly used softmax layer with a sigmoid layer to achieve multi-class output, eliminating the traditional either A or B output method. This multi-class output, combined with a weight table, calculates the final loss value (Loss) using the following formula. Let the linear output layer output be f(x), x be the input image, and the training set label be gt(x), then the final loss value (loss) is:
[0081] Loss=BinaryCrossEntropyLoss(Sigmoid(f(x)),gt(x))*WeightMap(f(x),gt(x))
[0082] S103. Obtain the image of the clothing to be detected, and obtain the clothing color detection result based on the image of the clothing to be detected using a color multi-classification model.
[0083] As an optional implementation, the step of obtaining the clothing color detection result based on the clothing image using a color multi-classification model can be specifically divided into the following steps S1031 and S1032:
[0084] S1031. Input the image of the clothing to be detected into the color multi-classification model to obtain multiple color category prediction values;
[0085] S1032. Select the color category corresponding to the largest color category prediction value as the clothing color detection result for the clothing image to be detected.
[0086] Specifically, after the model is trained, when detecting clothing colors in actual applications, a weight table is no longer needed. The model output, after passing through a sigmoid layer, yields the predicted values for all color categories of the clothing image data. The color category corresponding to the largest predicted value is selected as the predicted color category of the clothing. Furthermore, the model can output multiple color categories simultaneously. That is, for samples with inaccurate labeling, the model allows it to output similar categories. When there are multiple predicted values for the largest color category, multiple corresponding color categories are output, greatly reducing the impact of label confusion caused by similar categories. Internally, the model is no longer forced to establish very clear boundaries between similar categories in the color feature space, thus reducing model confusion caused by label errors.
[0087] The above describes the clothing color detection method according to embodiments of the present invention. It can be understood that, compared with existing image color recognition methods, the embodiments of the present invention, on the one hand, use a weight table to train the color multi-classification model, guiding the model to prioritize learning and distinguishing categories with large color differences, and then learning categories with less obvious color differences, which can improve the stability and robustness of the model in the color recognition process; on the other hand, by replacing the traditionally used softmax layer with a sigmoid layer, for samples whose labels are not particularly accurate, the model is allowed to output similar categories, reducing the problem of model training chaos caused by chaotic data labeling, and improving the effectiveness and accuracy of the model for detecting the color of clothing in washing machines.
[0088] Reference Figure 3 This invention also provides a clothing color detection system, comprising:
[0089] The first module is used to collect the first training dataset, label the first training dataset, and obtain the second training dataset;
[0090] The second module is used to construct a weight table, and based on the weight table and the second training dataset, a color multi-classification model is obtained.
[0091] The third module is used to acquire images of the clothing to be detected, and to obtain the clothing color detection results based on the images of the clothing using a color multi-classification model.
[0092] The content of the above-described clothing color detection method embodiments is applicable to the clothing color detection system embodiments. The specific functions implemented by the clothing color detection system embodiments are the same as those of the above-described clothing color detection method embodiments, and the beneficial effects achieved are also the same as those achieved by the above-described clothing color detection method embodiments.
[0093] This invention also provides an electronic device, comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for communication between the processor and the memory. When the program is executed by the processor, it implements the aforementioned clothing color detection method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0094] like Figure 4 The diagram shown is a hardware structure schematic of an electronic device provided in an embodiment of the present invention. (Refer to...) Figure 4 This invention provides an electronic device, comprising:
[0095] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0096] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 to execute the clothing color detection method of the embodiments of this invention.
[0097] Input / output interface 1003 is used to implement information input and output;
[0098] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0099] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0100] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0101] This invention also provides a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs, which can be executed by one or more processors to implement the above-described clothing color detection method.
[0102] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0103] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform... Figure 1 The method shown.
[0104] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the aforementioned blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0105] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the aforementioned functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0106] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0107] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0108] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0109] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0110] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A method for detecting the color of clothing, characterized in that, Includes the following steps: Collect a first training dataset, label the first training dataset, and obtain a second training dataset; Construct a weight table, and obtain a color multi-classification model based on the weight table and the second training dataset; Acquire an image of the clothing to be detected, and obtain the clothing color detection result based on the image of the clothing using the color multi-classification model; The clothing color detection method also includes: Define color categories, which include several monochrome categories and several non-monochrome categories; The construction of the weight table specifically includes: Set a bias value, and calculate the distance difference between each monochrome category based on the bias value to obtain a first weight value; The distance difference between each of the aforementioned non-monochrome categories is set to obtain the second weight value; A third weight value is obtained by setting the distance difference between each non-monochrome category and each monochrome category; The weight table is constructed based on the first weight value, the second weight value, and the third weight value; The step of obtaining a color multi-classification model based on the weight table and the second training dataset specifically includes: Construct a deep learning model, which includes a feature extraction module, a global pooling layer, a linear output layer, and a Sigmoid layer; The second training dataset is input into the deep learning model for training; The loss value is calculated based on the weight table, and the parameters of the trained deep learning model are optimized based on the loss value to obtain the color multi-classification model.
2. The method for detecting clothing color according to claim 1, characterized in that, The process of collecting a first training dataset, labeling the first training dataset, and obtaining a second training dataset specifically includes: Collect the first training dataset, which includes several clothing image data; The clothing image data are labeled according to the color category to obtain the second training dataset.
3. The method for detecting clothing color according to claim 2, characterized in that, The step of labeling each of the clothing image data according to the color category to obtain the second training dataset specifically includes: Determine the color category of the clothing image data; When the color category of the clothing image data is between two color categories, the clothing image data is labeled with at most two corresponding color categories to obtain the second training dataset.
4. The method for detecting clothing color according to claim 1, characterized in that, The step of obtaining the clothing color detection result based on the clothing image to be detected using the color multi-classification model specifically includes: The image of the clothing to be detected is input into the color multi-classification model to obtain multiple color category prediction values; The color category corresponding to the largest predicted color category value is selected as the color detection result of the clothing image to be detected.
5. A clothing color detection system, characterized in that, include: The first module is used to collect a first training dataset, label the first training dataset, and obtain a second training dataset; The second module is used to construct a weight table and obtain a color multi-classification model based on the weight table and the second training dataset. The third module is used to acquire an image of the clothing to be detected, and to obtain the clothing color detection result based on the image of the clothing to be detected using the color multi-classification model. The clothing color detection system also includes: The fourth module is used to define color categories, which include several monochrome categories and several non-monochrome categories; The construction of the weight table specifically includes: Set a bias value, and calculate the distance difference between each monochrome category based on the bias value to obtain a first weight value; The distance difference between each of the aforementioned non-monochrome categories is set to obtain the second weight value; A third weight value is obtained by setting the distance difference between each non-monochrome category and each monochrome category; The weight table is constructed based on the first weight value, the second weight value, and the third weight value; The step of obtaining a color multi-classification model based on the weight table and the second training dataset specifically includes: Construct a deep learning model, which includes a feature extraction module, a global pooling layer, a linear output layer, and a Sigmoid layer; The second training dataset is input into the deep learning model for training; The loss value is calculated based on the weight table, and the parameters of the trained deep learning model are optimized based on the loss value to obtain the color multi-classification model.
6. An electronic device, characterized in that, The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for establishing communication between the processor and the memory. When the program is executed by the processor, it implements the steps of the clothing color detection method as described in any one of claims 1 to 4.
7. A storage medium, said storage medium being a computer-readable storage medium for computer-readable storage, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the clothing color detection method as described in any one of claims 1 to 4.