Clothes identification method based on ResNet50 model
Through the clothing recognition method based on the ResNet50 model, the problem of inefficiency caused by traditional clothing recognition relying on manual operations is solved, and the accuracy and convenience of clothing recognition are achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411573152.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-25
AI Technical Summary
Traditional clothing recognition methods rely on a large number of manual operations, which are inefficient, expensive and prone to errors, making it difficult to meet the modern society's demand for quickly and accurately handling large amounts of old clothes.
The clothing recognition method based on the ResNet50 model is adopted, and the data set is obtained and preprocessed, the ResNet50 model is built, and the physical standards are combined with the web interface is used to classify clothing.
It realizes the accuracy and reliability of clothing recognition, improves the practicality and generalization capabilities of recognition, provides intuitive and convenient clothing classification services, and improves user experience and interactivity.
Smart Images

Figure CN119513693A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of clothing recognition, and in particular to a clothing recognition method based on a ResNet50 model. Background Art
[0002] As a widely popular daily consumer product, clothing occupies a pivotal position in the national economy. With the rapid development of social economy and the improvement of people's living standards, the speed of clothing renewal is accelerating, and with it comes a surge in the demand for the disposal of old clothes. However, traditional clothing identification methods mainly rely on a large number of manual operations, which are not only inefficient and consume huge human and material resources, but also prone to errors, making it difficult to meet the modern society's demand for fast and accurate disposal of large amounts of old clothes.
[0003] Therefore, facing the massive inventory of old clothes, how to efficiently and accurately identify and classify different clothes has become an important issue that needs to be solved. Although artificial intelligence has made significant progress in related fields such as image recognition and natural language processing, the attention paid to algorithms and technologies specifically for old clothes recognition is still relatively limited; in this context, the introduction of artificial intelligence technology into the field of clothing recognition has extremely important practical significance. By applying artificial intelligence technology, we can quickly and accurately complete the classification of clothes, effectively alleviating the contradiction between rapid clothing updates and delayed processing.
[0004] Therefore, it is necessary for us to actively explore and study the application of artificial intelligence in the field of clothing recognition in order to promote the intelligent and automated development of the clothing processing industry, further improve industry efficiency, and meet society's needs for the processing of old clothes. Summary of the invention
[0005] The purpose of the present invention is to provide a clothing recognition method based on the ResNet50 model to solve the problems that the traditional clothing recognition method in the prior art relies too much on manual operation, resulting in low efficiency, huge consumption of manpower and material resources, and high error rate.
[0006] To achieve the above object, the present invention provides a clothing recognition method based on the ResNet50 model, comprising the following steps:
[0007] Step 1: Obtain the original data set and preprocess the obtained original data set to divide the original data set into a training set and a test set;
[0008] Step 2: Build a model based on ResNet50;
[0009] Step 3: Input the training set into the ResNet50 model built in step 2 for training;
[0010] Step 4: Build your own clothing dataset and use it to fine-tune the model trained in step 3 to obtain the final ResNet50 model.
[0011] Step 5: Input the items to be classified into the ResNet50 model for classification, and view the final classification results through the web page.
[0012] Preferably, the original data set includes categories and attributes; the self-built clothing data set includes clothing type, style and material.
[0013] Preferably, the ResNet50-based model built in step 2 includes 5 stages, specifically Stage 0, Stage 1, Stage 2, Stage 3, and Stage 4.
[0014] Preferably, Stage 0 is the preprocessing of the input, and the input image is input into Stage 1 after two layers of operations; the first layer operation is the convolution CONV convolution operation, and the second layer operation is the maximum pooling layer MAXPOOL pooling operation; the result after the first layer of convolution operation is processed by BN and ReLU activation function before entering the second layer.
[0015] Preferably, Stage 1, Stage 2, Stage 3 and Stage 4 each include two Bottleneck structures, Bottleneck 1 and Bottleneck 2 respectively.
[0016] Preferably, Bottleneck1 includes four parameters: C, W, C1, and S, where C represents the number of input channels, W represents the input size, C1 represents the number of output channels of the convolution layer, and S represents the step size in the convolution layer. Specifically, the input parameters are respectively output through a convolution layer and three convolution blocks to output G(X) and F(X), and G(X) and F(X) are added and then passed through the ReLU activation function to obtain the final output result.
[0017] Preferably, Bottleneck2 includes two parameters, C and W, where C represents the number of input channels and W represents the input size. Specifically, the input parameters are output as F(X) after three convolution blocks, and F(X) and x are added and then activated by ReLU to obtain the final output result.
[0018] Preferably, the specific process of inputting the training set into the built ResNet50 model for training in step 3 is as follows:
[0019] S31. Input the training set into the built ResNet50 model;
[0020] S32. Determine whether the model converges by calculating the cross entropy loss function, where the calculation expression of the cross entropy loss function is as follows:
[0021]
[0022] y i and p i The true label and predicted probability corresponding to the i-th category, n is the number of categories;
[0023] S33. If the model reaches convergence, save the trained model; if the model does not reach convergence, update the parameters and return to S31 to continue execution until the model reaches convergence.
[0024] Preferably, the web page in step 5 is specifically composed of RESTful API, Flask and Gradio.
[0025] Therefore, the present invention adopts the above-mentioned clothing recognition method based on the ResNet50 model, which has the following beneficial effects:
[0026] (1) Through a carefully designed network architecture and optimized algorithm, it can accurately capture the subtle differences of clothing, such as color, texture, shape, etc., thereby ensuring the accuracy and reliability of classification;
[0027] (2) It combines physical standards and incorporates the characteristics of real clothing into the training process, making the model closer to actual application scenarios and improving the practicality and generalization ability of recognition;
[0028] (3) Through web page design, users are provided with intuitive and convenient clothing classification services, which further enhances user experience and interactivity.
[0029] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is an overall flow chart of a clothing recognition method based on the ResNet50 model of the present invention;
[0031] Figure 2 This is a schematic diagram of the structure of the ResNet50 model according to an embodiment of the present invention;
[0032] Figure 3 This is a display diagram of a clothing classification web page according to an embodiment of the present invention;
[0033] Figure 4 1 and 2. The web page display diagrams of clothing classification results of an embodiment of the present invention, wherein (a) is a web page display diagram of adult skirts, (b) is a web page display diagram of adult spring and autumn clothing, and (c) is a web page display diagram of children's skirts. DETAILED DESCRIPTION
[0034] The following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] See also Figure 1-4 , a clothing recognition method based on the ResNet50 model, comprising the following steps:
[0036] Step 1: Obtain the original data set and preprocess the obtained original data set to divide the original data set into a training set and a test set; the original data set includes types and attributes;
[0037] Step 2: Build a model based on ResNet50; the model based on ResNet50 includes 5 stages, namely Stage0, Stage1, Stage2, Stage3, and Stage4; Stage0 is the preprocessing of the input, and the input image is input into Stage1 after two layers of operations; the first layer is the convolution CONV convolution operation, and the second layer is the maximum pooling layer MAXPOOL pooling operation; the result after the first layer of convolution operation is processed by BN and ReLU activation function before entering the second layer; specifically: the image input format is (3, 224, 224), namely the number of channels (channel), height (height) and width (width). There are two layers of operations in total, the first layer includes CONV (convolution) operation, the convolution kernel size is 7x7, the number of convolution kernels is 64, and / 2 refers to the step size of the convolution kernel. Then, BN (Batch Normalization) and ReLU activation functions are performed to enter the second layer. The second layer is MAXPOOL, i.e., the maximum pooling layer, with a convolution kernel size of 3x3 and a step size of 2. Then, the result with a shape of (64, 56, 56) is output and enters Stage1. Stage1, Stage2, Stage3, and Stage4 all include two Bottleneck structures, Bottleneck1 and Bottleneck2. Bottleneck1 includes four parameters: C, W, C1, and S. C represents the number of input channels, W represents the input size, C1 represents the number of output channels of the convolution layer, and S represents the step size in the convolution layer. Specifically, the input parameters are respectively output through a convolution layer and three convolution blocks to output G(X) and F(X). G(X) and F(X) are added and then passed through the ReLU activation function to obtain the final output result. Bottleneck2 includes two parameters, C and W. C represents the number of input channels and W represents the input size. Specifically, the input parameters are output as F(X) after three convolution blocks. F(X) and x are added and the final output result is obtained through the ReLU activation function.
[0038] Step 3: Input the training set into the ResNet50 model built in step 2 for training; the specific process is as follows:
[0039] S31. Input the training set into the built ResNet50 model;
[0040] S32. Determine whether the model converges by calculating the cross entropy loss function, where the calculation expression of the cross entropy loss function is as follows:
[0041]
[0042] y i and pi The true label and predicted probability corresponding to the i-th category, n is the number of categories;
[0043] S33. If the model reaches convergence, save the trained model; if the model does not reach convergence, update the parameters and return to S31 to continue execution until the model reaches convergence.
[0044] Step 4: Build your own clothing dataset and use it to fine-tune the model trained in step 3 to obtain the final ResNet50 model; the self-built clothing dataset includes clothing types, styles, and materials;
[0045] Step 5. Input the items to be classified into the ResNet50 model for classification, and view the final classification results through the web page; the web page is specifically composed of RESTfulAPI, Flask and Gradio. Among them, the design of RESTful API makes the communication between the front-end and the back-end clearer and more standardized, which is convenient for system maintenance and upgrades. At the same time, we chose Flask, a lightweight Python Web framework. Flask provides us with a platform for quickly building Web applications with its simplicity, flexibility and powerful scalability. Through Flask, we can easily integrate the trained ResNet50 clothing classification model into the web page to provide users with intuitive and convenient clothing classification services. Finally, in order to further enhance the user experience and interactivity, we introduced the open source tool Gradio. Gradio allows us to easily create interactive interfaces for machine learning models, allowing users to intuitively experience the functions of the model without writing any code. Through the Gradio tool, users can upload their own clothing pictures and get classification results immediately, which greatly improves the ease of use and practicality of the system. As Figure 3 As shown. The user clicks on the upper left corner of the page to add clothing photos. After adding successfully, continue to click the Pred button, and the prediction results will be generated in the upper right corner of the page. The prediction results are composed of five different categories, reflecting the degree of classification of different clothing by the model. Generally speaking, the maximum value is the prediction result. The larger the value, the more accurate the prediction result, such as Figure 4 As shown, the accuracy of the method proposed in the present invention can be further verified, wherein (a) adult skirts account for 100%, and the proportions of children's skirts, adult spring and autumn clothes, adult pants, and adult winter clothes are all 0, so the identified clothing is an adult skirt; (b) adult spring and autumn clothes account for 63%, children's skirts account for 5%, adult skirts account for 29%, children's winter clothes account for 2%, and adult winter clothes account for 0, so the identified clothing is an adult spring and autumn clothes; (c) children's skirts account for 100%, and the proportions of children's summer clothes, adult skirts, others, and children's spring and autumn clothes are all 0, so the identified clothing is a children's skirt.
[0046] Therefore, the present invention adopts the above-mentioned clothing recognition method based on the ResNet50 model, and effectively improves the accuracy and intelligence level of old clothing recognition by integrating physical standards and technological innovation, bringing new solutions to the field of old clothing processing.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A clothing recognition method based on the ResNet50 model, characterized in that: The following steps are involved: Step 1: Obtain the original data set and preprocess the obtained original data set to divide the original data set into a training set and a test set; Step 2: Build a model based on ResNet50; Step 3: Input the training set into the ResNet50 model built in step 2 for training; Step 4: Build your own clothing dataset and use it to fine-tune the model trained in step 3 to obtain the final ResNet50 model. Step 5: Input the items to be classified into the ResNet50 model for classification, and view the final classification results through the web page.
2. The clothing recognition method based on the ResNet50 model according to claim 1, characterized in that: The original data set includes categories and attributes; the self-built clothing data set includes clothing types, styles, and materials.
3. The clothing recognition method based on the ResNet50 model according to claim 2 is characterized in that: The ResNet50-based model built in step 2 includes 5 stages, namely Stage 0, Stage 1, Stage 2, Stage 3, and Stage 4.
4. The clothing recognition method based on the ResNet50 model according to claim 3 is characterized in that: Stage 0 is the preprocessing of the input. The input image goes through two layers of operations and the final result is input into Stage 1. The first layer operation is the convolution CONV convolution operation, and the second layer operation is the maximum pooling layer MAXPOOL pooling operation. The result after the first layer of convolution operation is processed by BN and ReLU activation functions before entering the second layer.
5. The clothing recognition method based on the ResNet50 model according to claim 4, characterized in that: Stage1, Stage2, Stage3, and Stage4 all include two Bottleneck structures, Bottleneck1 and Bottleneck2.
6. The clothing recognition method based on the ResNet50 model according to claim 5, characterized in that: Bottleneck1 includes four parameters: C, W, C1, and S. C represents the number of input channels, W represents the input size, C1 represents the number of output channels of the convolution layer, and S represents the step size in the convolution layer. Specifically, the input parameters pass through a convolution layer and three convolution blocks to output G(X) and F(X), respectively. G(X) and F(X) are added and then passed through the ReLU activation function to obtain the final output result.
7. The clothing recognition method based on the ResNet50 model according to claim 6, characterized in that: Bottleneck2 includes two parameters, C and W. C represents the number of input channels and W represents the input size. Specifically, the input parameters are output as F(X) after three convolution blocks. F(X) and x are added and the final output result is obtained through the ReLU activation function.
8. The clothing recognition method based on the ResNet50 model according to claim 7, characterized in that: The specific process of inputting the training set into the built ResNet50 model for training in step 3 is as follows: S31. Input the training set into the built ResNet50 model; S32. Determine whether the model converges by calculating the cross entropy loss function E, where the calculation expression of the cross entropy loss function is as follows: y i and p i The true label and predicted probability corresponding to the i-th category, n is the number of categories; S33. If the model reaches convergence, save the trained model; if the model does not reach convergence, update the parameters and return to S31 to continue execution until the model reaches convergence.
9. The clothing recognition method based on the ResNet50 model according to claim 8, characterized in that: The web page in step 5 is composed of RESTful API, Flask and Gradio.