Clothes detection method and device, electronic equipment and storage medium

By constructing and training the capsule network model, automatic clothing detection is realized, and the problems of low efficiency and high cost of manual testing in the prior art are solved, and the efficiency and accuracy of clothing detection are improved.

CN119723102AActive Publication Date: 2025-03-28NANJING YIMU INTELLIGENT TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411654363.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-28
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

Existing clothes stackers require manual detection and identification of clothing attribute information, resulting in lower efficiency and accuracy and higher cost.

Method used

A clothing detection method is proposed. By obtaining the clothing images to be detected, building and training a capsule network model, using this model to output the clothing detection results, and achieving automatic clothing detection.

Benefits of technology

It improves the efficiency and accuracy of clothing inspection and reduces the cost of manual participation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723102A_ABST
    Figure CN119723102A_ABST
Patent Text Reader

Abstract

The invention discloses a clothes detection method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining a to-be-detected clothes image; acquiring a clothes detection model; and outputting a clothes detection result by using the clothes detection model according to the to-be-detected clothes image. The method can achieve the automatic detection of clothes through the clothes detection model, improves the clothes detection efficiency and accuracy, and can be widely applied to the technical field of image processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a clothing detection method, device, electronic device and storage medium. Background Art

[0002] In daily life, since clothes are flexible, it is easy to cause wrinkles or uneven folding when folding them, so people also have the need to use clothes folding machines. Existing clothes folding machines fold clothes according to clothing attribute information, so it is necessary to manually detect and identify the clothes, obtain the clothing attribute information, and enter the clothing attribute information into the clothes folding machine.

[0003] Manual detection of clothing attribute information has low efficiency and accuracy and high cost. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose a clothing detection method, device, electronic device and storage medium, which can realize automatic clothing detection and improve the efficiency and accuracy of clothing detection.

[0005] On the one hand, an embodiment of the present application provides a clothing detection method, the method comprising the following steps:

[0006] Acquire an image of clothing to be detected;

[0007] Obtain clothing detection model;

[0008] The clothing detection model is used to output a clothing detection result according to the clothing image to be detected.

[0009] In some embodiments, obtaining the clothing detection model specifically includes:

[0010] Build a capsule network model;

[0011] Acquire a sample data set; the sample data set includes a plurality of clothing detection images with clothing attribute labels;

[0012] The capsule network model is trained and optimized using the sample data set to obtain the corresponding clothing detection model.

[0013] In some embodiments, the using the sample data set to train and optimize the capsule network model to obtain the corresponding clothing detection model specifically includes:

[0014] Dividing the sample data set to determine a validation set and multiple batch training sets;

[0015] Inputting each of the batch training sets into the capsule network model in sequence, performing image feature learning using the capsule network model, determining a plurality of activated capsules in the capsule network model, and calculating the relative entropy corresponding to each of the activated capsules;

[0016] According to the relative entropy corresponding to each of the activated capsules in the capsule network model, optimizing the parameters of the capsule network model to obtain the corresponding clothing detection model;

[0017] The clothing detection model is evaluated using the validation set to determine a model evaluation result, and whether to stop training the clothing detection model is determined according to the model evaluation result.

[0018] In some embodiments, the clothing detection model includes a first feature extraction module, a second feature extraction module and a third feature extraction module, and the use of the clothing detection model to output a clothing detection result according to the clothing image to be detected specifically includes:

[0019] Inputting the clothing image to be detected into the clothing detection model, performing image feature extraction on the clothing image to be detected using the first feature extraction module, and outputting a corresponding first clothing detection feature image;

[0020] The first clothing detection feature image is transmitted to the second feature extraction module, and the second feature extraction module is used to extract image features from the first clothing detection feature image, and output a corresponding image feature vector and a second clothing detection feature image corresponding to the image feature vector;

[0021] The image feature vector and the second clothing detection feature image are input into the third feature extraction module, and the third feature extraction module is used to extract and integrate local image features, and a clothing detection image feature vector and a clothing detection result image corresponding to the clothing detection image feature vector are output.

[0022] In some embodiments, the step of sequentially inputting each of the batch training sets into the capsule network model, using the capsule network model to perform image feature learning, determining a plurality of activated capsules in the capsule network model, and calculating the relative entropy corresponding to each of the activated capsules specifically includes:

[0023] Sorting each of the batch training sets to determine a sorted list, and obtaining the batch training set that ranks first in the sorted list as the current training set;

[0024] Construct an array of activation capsules;

[0025] Training the capsule network model using the current training set, and determining a number of activation capsules from a plurality of feature extraction capsules included in the capsule network model, wherein the activation capsule outputs a current feature vector corresponding to the current training set, and a normalized modulus of the feature vector is greater than a given activation threshold;

[0026] Calculating, according to the current feature vector of each activated capsule, a central value of a probability distribution of the feature vector of each activated capsule corresponding to the current training set;

[0027] Obtaining the capsule identifier of each of the activated capsules, binding the current training set, the capsule identifier of each of the activated capsules, and the central value of the probability distribution of the feature vector corresponding to each of the activated capsules, and storing them in the activated capsule array set;

[0028] When it is determined that the current training set is not the last batch training set in the sorted list, obtaining a next batch training set as the current training set, and then returning to the step of training the capsule network model using the current training set to determine a number of activation capsules from a plurality of feature extraction capsules included in the capsule network model until it is determined that the current training set is the last batch training set in the sorted list;

[0029] When it is determined that the current training set is the batch training set ranked last in the sorted list, for each of the batch training sets, a plurality of activation capsules corresponding to the batch training set and a central value of the probability distribution of the feature vector corresponding to the batch training set of each activation capsule are determined from the activation capsule array set, a mean value of the probability distribution of the historical feature vectors corresponding to the activation capsules is obtained, and the relative entropy of each activation capsule corresponding to the batch training set is calculated according to the mean value of the probability distribution of the historical feature vectors of each activation capsule and the central value of the probability distribution of the feature vector corresponding to the batch training set.

[0030] In some embodiments, the step of optimizing parameters of the capsule network model according to the relative entropy corresponding to each activated capsule in the capsule network model to obtain the corresponding clothing detection model specifically includes:

[0031] For each of the batch training sets, determining a plurality of the activated capsules corresponding to the batch training set, and obtaining the relative entropy of each of the activated capsules corresponding to the batch training set;

[0032] Get the loss function;

[0033] According to the relative entropy of the activated capsule corresponding to the batch training set, the loss function is used to optimize the parameters of the capsule network model.

[0034] In some embodiments, performing model evaluation on the clothing detection model using the validation set, determining a model evaluation result, and determining whether to stop training the clothing detection model according to the model evaluation result specifically includes:

[0035] Get multiple model evaluation metrics;

[0036] Using the validation set to perform model evaluation on the clothing detection model, and determining a model evaluation value corresponding to each of the model evaluation indicators;

[0037] When the model evaluation values ​​corresponding to the model evaluation indicators all exceed a given evaluation qualification threshold, the training of the clothing detection model is stopped; otherwise, the training of the clothing detection model continues.

[0038] On the other hand, an embodiment of the present application provides a clothing detection device, the device comprising:

[0039] The first module is used to obtain the image of clothing to be detected;

[0040] The second module is used to obtain a clothing detection model;

[0041] The third module is used to output a clothing detection result according to the clothing image to be detected by using the clothing detection model.

[0042] On the other hand, an embodiment of the present application provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned clothing detection method when executing the computer program.

[0043] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the clothing detection method described above is implemented.

[0044] The embodiments of the present application include at least the following beneficial effects: The present application provides a clothing detection method, device, electronic device and storage medium, which obtains a clothing detection model by acquiring a clothing image to be detected, and outputs a clothing detection result based on the clothing image to be detected using the clothing detection model. The present application can use the clothing detection model to realize automatic clothing detection, thereby improving the efficiency and accuracy of clothing detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0047] Figure 1 is a flow chart of a clothing detection method provided in an embodiment of the present application;

[0048] Figure 2 Schematic diagram of the structure of the capsule network model in the embodiment of the present application;

[0049] Figure 3 is a structural schematic diagram of a clothing detection device provided in an embodiment of the present application;

[0050] Figure 4 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the 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 the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0052] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0053] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0055] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.

[0056] 1) Capsule model: The Capsule model, also known as the capsule network, is designed to solve the problems existing in traditional convolutional neural networks (CNNs), especially the limitations of information loss and feature extraction.

[0057] 2) CNN model: The CNN model (convolutional neural network) is a feed-forward artificial neural network that is particularly suitable for processing grid-structured data. It is widely used in computer vision problems such as image classification. The core of CNN is to extract and learn data features through convolutional layers, pooling layers, and fully connected layers. The convolutional layer performs convolution operations on the input data by sliding a small window (convolution kernel) to extract local features.

[0058] 3) CapsNet architecture: CapsNet (capsule network) is a deep learning model proposed by Geoffrey Hinton and his team, which aims to solve some limitations of traditional convolutional neural networks (CNN) in image recognition, such as ignoring relative position information and losing details. CapsNet improves feature representation by using capsule structure and handles the relationship between features through dynamic routing algorithm.

[0059] Reference Figure 1 , Figure 1 This is an optional flow chart of a clothing detection method provided in an embodiment of the present application. The method may include but is not limited to steps S101 to S103:

[0060] Step S101, obtaining an image of clothing to be detected;

[0061] Step S102, obtaining a clothing detection model;

[0062] Step S103: outputting a clothing detection result according to the clothing image to be detected by using the clothing detection model.

[0063] In some embodiments, step S102 may include but is not limited to steps S201 to S203:

[0064] Step S201, constructing a capsule network model;

[0065] Step S202, obtaining a sample data set; the sample data set includes a plurality of clothing detection images with clothing attribute labels;

[0066] Step S203: Use the sample data set to train and optimize the capsule network model to obtain a corresponding clothing detection model.

[0067] In some embodiments, the capsule network model is built based on the CapsNet architecture, including a CNN model and a Capsule model. The basic unit of the Capsule model is a "capsule" instead of a traditional neuron. Each capsule contains multiple neurons and represents features in the form of a vector. The modulus of the vector represents the importance of the feature. Unlike traditional neural networks, the Capsule model transmits information through transformations between vectors and a dynamic routing mechanism, rather than a simple weighted summation. This design enables the Capsule model to better handle image transformations such as rotation and scaling, and to better capture the relationship between substructures.

[0068] Optionally, refer to Figure 2 , Figure 2 It is an optional structural diagram of the capsule network model in the embodiment of the present application, which includes a lightweight neural network EfficientNetV2, a Primary Caps Layer and a Capsule model. The Capsule model includes two layers of Capsule Layers. The first layer Capsule Layer1 is used to extract local features of the image, and the second layer Capsule Layer2 is used to integrate and learn the local features of the image extracted by the first layer Capsule Layer1. The clothing image to be detected is input into the capsule network model, and the forward propagation calculation is performed on the clothing image to be detected. It is transmitted in sequence according to the order of lightweight neural network-Primary Caps Layer-Capsule model, and finally the corresponding clothing detection result is output.

[0069] Lightweight neural networks can include but are not limited to CNN models such as EfficientNetV2. These neurons output a vector instead of a traditional scalar value. This vector contains information about the location and posture of the detected object. Capsule Layer is an important part of the capsule model. The capsule layer includes multiple capsules. Each capsule receives input from the previous layer and is processed through an affine transformation and a nonlinear activation function (such as a squashing function) to finally output a vector. This vector contains not only the representation of the feature, but also the location information of the feature in space, so that the capsule model can better handle the rotation and deformation of the image and improve the robustness of the network.

[0070] The Primary Caps Layer is an important component in the CapsNet architecture. It is usually composed of multiple neurons, each of which is responsible for detecting a specific area in the image. These neurons output a vector instead of a traditional scalar value. This vector contains information about the position and posture of the detected object.

[0071] In some embodiments, specifically, the Primary Caps Layer in the above-mentioned capsule network model removes the original convolution calculation compared with the traditional Primary Caps Layer, and directly transforms the feature image output by the lightweight neural network. For example, the number of channels (dim) of the feature vector output by each capsule in the Capsule Layer is set to 8, and the channel dimension (channel dim) of the feature image output by the previous layer of lightweight neural network is divided into groups of 8, and each group is combined into the dim of the capsule.

[0072] In some embodiments, step S203 may include but is not limited to steps S301 to S304:

[0073] Step S301, dividing the sample data set to determine a validation set and multiple batches of training sets;

[0074] Step S302, inputting each batch of training sets into the capsule network model in sequence, using the capsule network model to learn image features, determining multiple activated capsules in the capsule network model and calculating the relative entropy corresponding to each activated capsule;

[0075] Step S303, optimizing the parameters of the capsule network model according to the relative entropy corresponding to each activated capsule in the capsule network model to obtain a corresponding clothing detection model;

[0076] Step S304, using the verification set to perform model evaluation on the clothing detection model, determine the model evaluation result, and determine whether to stop training the clothing detection model according to the model evaluation result.

[0077] In some embodiments, the sample data set includes multiple clothing detection images annotated with clothing attribute information. The clothing attribute information may include but is not limited to the color, type, material, etc. of the clothing. The colors include black, white, red, green, etc., the types include shirts, casual pants, jeans, etc., and the materials include plush, chemical fiber, silk, etc.

[0078] In some embodiments, step S302 may include, but is not limited to, steps S401 to S407:

[0079] Step S401, sorting each batch of training sets, determining a sorting list, and obtaining the batch of training sets ranked first in the sorting list as the current training set;

[0080] Step S402, constructing an activation capsule array set;

[0081] Step S403, training the capsule network model using the current training set, and determining a number of activation capsules from the multiple feature extraction capsules included in the capsule network model, wherein the activation capsule outputs a current feature vector corresponding to the current training set, and the normalized modulus of the feature vector is greater than a given activation threshold;

[0082] Step S404, calculating the central value of the probability distribution of the feature vector of each activated capsule corresponding to the current training set according to the current feature vector of each activated capsule;

[0083] Step S405, obtaining the capsule identifier of each activated capsule, binding the current training set, the capsule identifier of each activated capsule and the central value of the probability distribution of the feature vector corresponding to each activated capsule, and storing them in the activated capsule array set;

[0084] Step S406, when it is determined that the current training set is not the last batch training set in the sorted list, the next batch training set is obtained as the current training set, and then the process returns to step S403 until it is determined that the current training set is the last batch training set in the sorted list;

[0085] Step S407, when it is determined that the current training set is the last batch training set ranked in the sorted list, for each batch training set, multiple activation capsules corresponding to the batch training set and the central value of the probability distribution of the feature vector corresponding to each activation capsule of the batch training set are determined from the activation capsule array set, the mean of the probability distribution of the historical feature vectors corresponding to the activation capsules is obtained, and the relative entropy of each activation capsule corresponding to the batch training set is calculated according to the mean of the probability distribution of the historical feature vectors of each activation capsule and the central value of the probability distribution of the feature vector corresponding to the batch training set.

[0086] In some embodiments, the capsule network model is trained using the current training set, the feature extraction capsule extracts local features of the feature image, outputs the corresponding current feature vector, normalizes the current feature vector, and calculates the modulus corresponding to the normalized current feature vector. When the modulus is greater than a given activation threshold, such as 0.5, the feature extraction capsule is determined as the activation capsule under the current training set.

[0087] In some embodiments, the capsule network model is trained using each batch of training sets, and the central value of the probability distribution of the feature vectors of each feature extraction capsule (such as the above capsule) corresponding to each batch of training sets is stored. After the training of the capsule network model is completed using each batch of training sets, the mean value of the probability distribution of the historical feature vectors corresponding to each feature extraction capsule (such as the above capsule) is calculated according to the central value of the probability distribution of the feature vectors of each feature extraction capsule (such as the above capsule) corresponding to each batch of training sets. Optionally, the mean value of the probability distribution of the historical feature vectors is calculated by the following formula:

[0088]

[0089] Among them, Q j (x) is the mean probability distribution of the historical feature vector corresponding to the jth feature extraction capsule, P j,k (x) is the center value of the probability distribution of the feature vector of the j-th feature extraction capsule corresponding to the k-th batch training set, and n is the number of batch training sets.

[0090] In some embodiments, step S303 may include but is not limited to steps S501 to S503:

[0091] Step S501, for each batch training set, determining a plurality of activated capsules corresponding to the batch training set, and obtaining a relative entropy of each activated capsule corresponding to the batch training set;

[0092] Step S502, obtaining a loss function;

[0093] Step S503, according to the relative entropy of the activated capsule corresponding to the batch training set, the loss function is used to optimize the parameters of the capsule network model.

[0094] In some embodiments, the relative entropy is a KL distance, which is also called KL divergence or relative entropy, and is defined as the amount of information loss caused when using distribution q to approximate distribution p. Optionally, the relative entropy of each activated capsule is calculated by the following formula:

[0095]

[0096] Among them, D i (P / Q) is the relative entropy of the i-th activated capsule in the batch training set, P i (x) is the center value of the probability distribution of the feature vector of the i-th activated capsule, Q i (x) is the mean probability distribution of the historical feature vector of the i-th activated capsule.

[0097] The loss function Loss is calculated by the following formula:

[0098]

[0099] Among them, S is the number of activated capsules in the batch training set. According to the relative entropy of each activated capsule in the batch training set, the mean relative entropy of the batch training set, i.e., Loss, is calculated, and the Loss is passed to the capsule network model for parameter optimization.

[0100] In some embodiments, step S304 may include but is not limited to steps S601 to S603:

[0101] Step S601, obtaining multiple model evaluation indicators;

[0102] Step S602, using the validation set to perform model evaluation on the clothing detection model, and determining the model evaluation value corresponding to each model evaluation indicator;

[0103] Step S603: when the model evaluation values ​​corresponding to the model evaluation indicators all exceed the given evaluation qualification threshold, stop training the clothing detection model; otherwise, continue training the clothing detection model.

[0104] In some embodiments, model evaluation indicators may include but are not limited to accuracy, precision, recall, F1 score, etc.

[0105] In some embodiments, step S103 may include but is not limited to steps S701 to S703:

[0106] Step S701, inputting the clothing image to be detected into the clothing detection model, using the first feature extraction module to extract image features of the clothing image to be detected, and outputting the corresponding first clothing detection feature image;

[0107] Step S702, transferring the first clothing detection feature image to the second feature extraction module, using the second feature extraction module to extract image features from the first clothing detection feature image, and outputting a corresponding image feature vector and a second clothing detection feature image corresponding to the image feature vector;

[0108] Step S703, input the image feature vector and the second clothing detection feature image into the third feature extraction module, use the third feature extraction module to extract and integrate local image features, and output the clothing detection image feature vector and the clothing detection result image corresponding to the clothing detection image feature vector.

[0109] In some embodiments, the first feature extraction module is a lightweight neural network, such as the above-mentioned EfficientNetV2, the second feature extraction module is the above-mentioned Primary Caps Layer, and the third feature extraction module is the above-mentioned Capsule model. The Capsule model includes two layers of Capsule Layer. The first layer of Capsule Layer is used to extract local features of the image, and the second layer of Capsule Layer is used to integrate local features of the image.

[0110] In some embodiments, the above clothing detection method has the following advantages compared with the prior art:

[0111] 1) Effectively improve the recognition accuracy of high-speed networks, combine the Capsule model with lightweight neural networks, and improve the accuracy of clothing detection;

[0112] 2) By calculating the relative entropy of the activated capsules, the parameters of the capsule network model are optimized, so that the model can more effectively converge to the features that play a role in the final result, effectively jump out of the local minimum, and improve the effectiveness of model training and the detection accuracy of the model;

[0113] 3) The introduction of the Capsule model can appropriately reduce the scale of the CNN model, while improving the reasoning speed, it does not affect the network model detection efficiency and improves the model reasoning speed.

[0114] Reference Figure 3 , Figure 3 : is an optional structural diagram of a clothing detection device provided in an embodiment of the present application. The device can be used to implement the above clothing detection method. The device may include:

[0115] The first module is used to obtain the image of clothing to be detected;

[0116] The second module is used to obtain a clothing detection model;

[0117] The third module is used to output clothing detection results based on the clothing image to be detected using the clothing detection model.

[0118] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0119] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above clothing detection method when executing the computer program. The electronic device can be any smart terminal including a tablet computer.

[0120] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0121] See also Figure 4 , Figure 4 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0122] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (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 application;

[0123] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the clothing detection method of the embodiment of this application;

[0124] Input / output interface 903, used to implement information input and output;

[0125] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0126] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0127] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0128] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned clothing detection method is implemented.

[0129] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0130] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0131] The embodiments of the present application provide a clothing detection method, device, electronic device and storage medium, which obtains a clothing image to be detected, obtains a clothing detection model, and uses the clothing detection model to output clothing detection results according to the clothing image to be detected. The embodiments of the present application can use the clothing detection model to realize automatic clothing detection, thereby improving the efficiency and accuracy of clothing detection.

[0132] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0133] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0134] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0135] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0136] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0137] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0138] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0139] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0140] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0141] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method may be implemented in a computer program using standard programming techniques including a non-transitory computer-readable storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner - according to the methods and drawings described in the specific embodiments. Each program may be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if desired, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose.

[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0143] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A clothing detection method, characterized in that: The method comprises the following steps: Acquire an image of clothing to be detected; Obtain clothing detection model; The clothing detection model is used to output a clothing detection result according to the clothing image to be detected.

2. The clothing detection method according to claim 1, characterized in that: The obtaining of the clothing detection model specifically includes: constructing a capsule network model; Acquire a sample data set; the sample data set includes a plurality of clothing detection images with clothing attribute labels; The capsule network model is trained and optimized using the sample data set to obtain the corresponding clothing detection model.

3. The clothing detection method according to claim 2, characterized in that: The using the sample data set to train and optimize the capsule network model to obtain the corresponding clothing detection model specifically includes: Dividing the sample data set to determine a validation set and multiple batch training sets; Inputting each of the batch training sets into the capsule network model in sequence, performing image feature learning using the capsule network model, determining a plurality of activated capsules in the capsule network model, and calculating the relative entropy corresponding to each of the activated capsules; According to the relative entropy corresponding to each of the activated capsules in the capsule network model, optimizing the parameters of the capsule network model to obtain the corresponding clothing detection model; The clothing detection model is evaluated using the validation set to determine a model evaluation result, and whether to stop training the clothing detection model is determined according to the model evaluation result.

4. The clothing detection method according to claim 1, characterized in that: The clothing detection model includes a first feature extraction module, a second feature extraction module and a third feature extraction module. The use of the clothing detection model to output a clothing detection result according to the clothing image to be detected specifically includes: Inputting the clothing image to be detected into the clothing detection model, performing image feature extraction on the clothing image to be detected using the first feature extraction module, and outputting a corresponding first clothing detection feature image; The first clothing detection feature image is transmitted to the second feature extraction module, and the second feature extraction module is used to extract image features from the first clothing detection feature image, and output a corresponding image feature vector and a second clothing detection feature image corresponding to the image feature vector; The image feature vector and the second clothing detection feature image are input into the third feature extraction module, and the third feature extraction module is used to extract and integrate local image features, and a clothing detection image feature vector and a clothing detection result image corresponding to the clothing detection image feature vector are output.

5. The clothing detection method according to claim 3, characterized in that: The step of sequentially inputting each of the batch training sets into the capsule network model, using the capsule network model to perform image feature learning, determining a plurality of activated capsules in the capsule network model, and calculating the relative entropy corresponding to each of the activated capsules specifically includes: Sorting each of the batch training sets to determine a sorted list, and obtaining the batch training set that ranks first in the sorted list as the current training set; Construct an array of activation capsules; Training the capsule network model using the current training set, and determining a number of activation capsules from a plurality of feature extraction capsules included in the capsule network model, wherein the activation capsule outputs a current feature vector corresponding to the current training set, and a normalized modulus of the feature vector is greater than a given activation threshold; Calculating, according to the current feature vector of each activated capsule, a central value of a probability distribution of the feature vector of each activated capsule corresponding to the current training set; Obtaining the capsule identifier of each of the activated capsules, binding the current training set, the capsule identifier of each of the activated capsules, and the central value of the probability distribution of the feature vector corresponding to each of the activated capsules, and storing them in the activated capsule array set; When it is determined that the current training set is not the last batch training set in the sorted list, obtaining a next batch training set as the current training set, and then returning to the step of training the capsule network model using the current training set to determine a number of activation capsules from a plurality of feature extraction capsules included in the capsule network model until it is determined that the current training set is the last batch training set in the sorted list; When it is determined that the current training set is the batch training set ranked last in the sorted list, for each of the batch training sets, a plurality of activation capsules corresponding to the batch training set and a central value of the probability distribution of the feature vector corresponding to the batch training set of each activation capsule are determined from the activation capsule array set, a mean value of the probability distribution of the historical feature vectors corresponding to the activation capsules is obtained, and the relative entropy of each activation capsule corresponding to the batch training set is calculated according to the mean value of the probability distribution of the historical feature vectors of each activation capsule and the central value of the probability distribution of the feature vector corresponding to the batch training set.

6. The clothing detection method according to claim 3, characterized in that: The step of optimizing parameters of the capsule network model according to the relative entropy corresponding to each activated capsule in the capsule network model to obtain the corresponding clothing detection model specifically includes: For each of the batch training sets, determining a plurality of the activated capsules corresponding to the batch training set, and obtaining the relative entropy of each of the activated capsules corresponding to the batch training set; Get the loss function; According to the relative entropy of the activated capsule corresponding to the batch training set, the loss function is used to optimize the parameters of the capsule network model.

7. The clothing detection method according to claim 3, characterized in that: The using the validation set to perform model evaluation on the clothing detection model, determining a model evaluation result, and determining whether to stop training the clothing detection model according to the model evaluation result specifically includes: Get multiple model evaluation metrics; Using the validation set to perform model evaluation on the clothing detection model, and determining a model evaluation value corresponding to each of the model evaluation indicators; When the model evaluation values ​​corresponding to the model evaluation indicators all exceed a given evaluation qualification threshold, the training of the clothing detection model is stopped; otherwise, the training of the clothing detection model continues.

8. A clothing detection device, characterized in that: The device comprises: The first module is used to obtain the image of clothing to be detected; The second module is used to obtain a clothing detection model; The third module is used to output a clothing detection result according to the clothing image to be detected by using the clothing detection model.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the clothing detection method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the clothing detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for generating images through text by introducing capsule network

    CN112765316A

  • Clothing classification method and system based on capsule network

    CN113205061A

  • Equipment fault recognition model training and recognition method, system and device and medium

    CN113592071A

  • Method, device and equipment for acquiring clothes attribute information

    CN115115867A

  • Safety hosting service method based on knowledge graph and domain adaptation

    CN115146299A

Cited By

  • Clothing inspection method and apparatus, electronic device, and storage medium

    WO2026108050A1