A workwear recognition method combining continuous learning and effectively resisting forgetting disaster
By combining image autoencoders and gradient boosting with knowledge distillation, the problems of forgetting disaster and excessive resource consumption in continuous learning are solved, achieving high efficiency, plasticity and stability of the work uniform recognition model, avoiding data privacy issues, and improving the model's generalization ability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU EMBEDDED MASCH TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies struggle to effectively combat the curse of forgetting during continuous learning, especially the bias problem caused by the imbalance between old and new class samples during model updates. Furthermore, they suffer from excessive resource consumption, data privacy issues, and difficulties in balancing model plasticity and stability.
An image autoencoder is used to encode and compress intermediate features, and a new model is constructed by combining it with a gradient boosting method. The model is then compressed back to a single backbone state through knowledge distillation. Self-supervised training is used to enhance the feature representation ability of the initial model, and historical sample features are used reasonably to control the amount of parameter expansion.
It effectively alleviates the forgetting of old categories, reduces training resource consumption, solves data privacy issues, and improves the model's plasticity and generalization ability.
Smart Images

Figure CN122156783A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of continuous learning in computer vision, and in particular to a method for identifying work clothes that combines continuous learning and effectively resists the disaster of forgetting. Background Technology
[0002] In image recognition tasks, due to the constantly changing application scenarios and the continuous emergence of new categories, convolutional neural network models typically need to continuously learn new category data. However, due to limitations in storage space and data privacy issues, historical category samples may not be fully preserved or may be limited in number. This leads to a severe imbalance in the number of samples between the old and new categories during model update training, causing the model to tend to learn the features of new category samples while weakening its ability to recognize old categories. This phenomenon is academically known as "catastrophic forgetting."
[0003] How to resist disaster-induced forgetting during continuous learning has become a research hotspot in the field of computer vision. Current work either struggles with the balance between maintaining the model's plasticity for new categories and its stability for old categories, or it comes at a high cost in terms of resource consumption.
[0004] Currently, the mainstream methods of continuous learning mainly fall into three directions:
[0005] 1. It focuses on data and uses methods such as data replay, but this also brings about data privacy issues;
[0006] 2. Using the model as the core, adjust the parameters according to their importance to alleviate bias or directly extend the network to obtain stronger feature representation capabilities;
[0007] 3. Algorithm-centric approach, represented by knowledge distillation methods, including logical distillation, feature distillation, and relational distillation.
[0008] For example, Solution 1: Paper "Learnable Expansion-and-Compression Network for Few-shot Class-Incremental" In its paper "Learning," LEC-Net proposes a learnable extended-compressed network (LEC-Net) that aims to simultaneously address catastrophic forgetting and model overfitting within a unified framework. By tentatively expanding network nodes, LEC-Net enhances feature representation capabilities, mitigating feature drift issues from the perspective of model regularization. By compressing the expanded network nodes, LEC-Net strives to minimize the increase in model parameters, mitigating overfitting from the perspective of compact representation.
[0009] Scheme 1 can be classified as direction 2, and has the following disadvantages: (1) Expanding parameters during the training phase is an overall model expansion, which may lead to excessive consumption of training resources; (2) Compression is achieved by compressing nodes through learnable parameters, but the overall parameters will still increase in the end.
[0010] For example, Solution 2, patent application titled "A Method and System for Staging and Segmenting Colorectal Cancer MR Images Based on Continuous Learning" (patent application number 202311292172.6), leverages the advantages of a U-shaped network model using a fully convolutional neural network (FCN) in colorectal cancer segmentation, while also addressing the difficulties in model training and the catastrophic forgetting problem caused by insufficient manually labeled data from physicians. To address these issues, this patent proposes a method and system for staging and segmenting colorectal cancer MR images based on continuous learning, adapting to the introduction of new labeled data and mitigating catastrophic forgetting.
[0011] Option 2 can be classified as direction 3, and has the following disadvantages: (1) It mainly adopts the data replay method, which cannot avoid data privacy issues; (2) It continuously learns on a single backbone without expanding new parameters and lacks sufficient plasticity.
[0012] For example, Scheme 3, patent application titled "A Behavioral Recognition Method for Alleviating Forgetting of Old Classes Based on New Class Feature Space," patent application number 202311241281.5, firstly, through a keyframe extraction algorithm and a preprocessing frame interpolation algorithm, constructs a memory set that efficiently balances the size of the memory set and the number of replay samples. While consuming the same amount of storage space as other methods, this patent can store more replay samples in the memory set, thus effectively alleviating the catastrophic forgetting of old classes during incremental learning. Secondly, when updating the model in reverse at a new stage, neurons sensitive to old classes are randomly frozen, and training is exited early, effectively preventing the model from excessively losing features of old classes. By slightly shifting the model's feature space for new classes, more features of old classes are retained. Although this slightly sacrifices the model's recognition performance for new classes, it significantly improves the model's recognition performance for old classes.
[0013] Scheme 3 can be classified as direction 1, and has the following disadvantages: (1) It also uses historical data to maintain the classification ability of old samples; (2) It cannot balance the plasticity of the model to new categories and the stability of old categories.
[0014] For example, Solution 4, with the patent application titled "A Brain-Inspired Continuous Learning Fault Diagnosis Method for Train Transmission Systems" and patent application number 202211498411.9, provides a brain-inspired continuous learning fault diagnosis method for train transmission systems. This method simulates the memory and generation of neural synapses in the human brain, designing a growth mechanism for synaptic representation structures to achieve brain-inspired continuous learning-based fault diagnosis of train transmission systems. Specifically, it freezes existing feature extraction branches and uses a small number of old class sample examples to alleviate "catastrophic forgetting"; simultaneously, it introduces new feature extraction branches to provide plasticity to the model, learning new fault features under the guidance of a multi-objective loss function, thus improving the upper limit of the model's learning ability. Furthermore, this mechanism integrates end-to-end network pruning, dynamically adjusting the scale of structure growth according to task difficulty to alleviate the problem of structured redundancy in the model during progressive learning.
[0015] Scheme 4 can be classified as direction 1 and 2, and has the following disadvantages: (1) It also uses historical data to maintain the classification ability of old samples. (2) Although there is a pruning process, the model still cannot avoid continuous growth.
[0016] The disadvantages of the aforementioned prior art are summarized as follows:
[0017] (1) A single backbone does not have the ability to expand new parameters and lacks sufficient plasticity, which will limit the learning of new categories.
[0018] (2) There are extended parameters but no reasonable compression. The continuous expansion of the model leads to serious storage consumption.
[0019] (3) The unreasonable use of historical data, or the direct use of historical data, leads to data privacy issues; or the lack of training aids from old category data leads to the forgetting of old categories in the training of new models.
[0020] (4) Unable to properly balance the plasticity and stability of the model. Summary of the Invention
[0021] The purpose of this invention is to overcome the shortcomings and deficiencies of the prior art and provide a work uniform identification method that combines continuous learning and effectively resists the disaster of forgetting.
[0022] The objective of this invention is achieved through the following technical solution:
[0023] A method for identifying work uniforms that combines continuous learning and effectively resists the disaster of forgetting includes the following steps:
[0024] S1. In the initial stage, collect T0 stage uniform category data, construct a T0 stage uniform classification model, and perform self-supervised training on the T0 stage uniform classification model in combination with the T0 stage uniform category data.
[0025] S2. Divide the backbone in the trained T0 stage work uniform classification model into a deep model and a shallow model. Construct an image autoencoder between the deep model and the shallow model, and train the image autoencoder. Encode and compress the intermediate features output by the shallow model through the trained image autoencoder to obtain compressed features.
[0026] S3. In the continuous learning task phase, collect Tt stage workwear category data, decode the compressed features, reuse the shallow model in the trained T0 stage workwear classification model, and extend the deep model to build a new model; based on the new model, construct the Tt stage workwear classification model through the gradient boosting method, and train the Tt stage workwear classification model according to the Tt stage workwear category data and the decoded compressed features.
[0027] S4. The trained Tt stage work uniform classification model is compressed using knowledge distillation to obtain the final Tt stage work uniform classification model, and the final Tt stage work uniform classification model is used for work uniform recognition.
[0028] Step S1 involves training a target detection model for the upper body of a work uniform based on the YOLOv5s model. The detection target is defined as the upper body of a pedestrian, with the region extending from the pedestrian's neck to their buttocks, and the outer sides of their arms to the left and right. For an input image frame, Output the upper body bounding box of the pedestrian in the image; crop the image of the upper body bounding box region of the pedestrian, filter out redundant, occluded and blurred images, and then classify them according to different work clothes, and collect the data of different work clothes categories in the initial stage, that is, the T0 stage.
[0029] Constructing a T0 stage work uniform classification model , It consists of a backbone and a linear classifier, where the backbone is a ResNet50; a self-supervised training method is used. The training will be conducted as follows:
[0030] In the T0 stage, images from one category of workwear data are rotated by three predefined angles to obtain three new categories. Then, one category image is randomly added to another category and fused to obtain a new category. When the number of workwear categories in the T0 stage is K, the data is augmented to 3K + K(K-1) / 2 categories using a self-supervised training method. The augmented data is then used to train the workwear classification model. Conduct training.
[0031] Step S2 is as follows:
[0032] S21. The trained work uniform classification model The backbone is divided into shallow and deep models. The first three blocks of the backbone are divided into shallow models. The last block module is divided into deep models. ;
[0033] S22. Construct an image autoencoder between the deep model and the shallow model. Intermediate features acting on the output of shallow models ,in, It is a shallow model. For sample data, intermediate features are encoded and decoded. The image autoencoder consists of two parts: an encoder and a decoder. The encoder downsamples the input intermediate features multiple times to obtain compressed features z; the decoder upsamples the compressed features z multiple times to recover the lossless intermediate features. ;
[0034] S23. Train the image autoencoder, let For sample data, Assign labels to the sample data; design an optimization function for the image autoencoder, with the specific calculation formula as follows:
[0035] (1)
[0036] (2)
[0037] in, Euclidean distance. Let KL divergence be the KL divergence. Parameters for the work uniform classification model;
[0038] Furthermore, the image autoencoder training process also employs a self-supervised training method;
[0039] S24. Sample 20 images from each category of the work uniform category data to obtain category sampling data. After the work clothes classification model After processing the shallow model and the encoder part of the trained image autoencoder, the compressed feature z is obtained, and the specific calculation formula is as follows:
[0040] (3)
[0041] Step S3 is specifically as follows:
[0042] S31. Collect data on different workwear categories during the continuous learning task phase, i.e., the Tt phase, according to the method described in step S1.
[0043] S32. Decode and recover the compressed feature z. The recovered feature is: The specific calculation formula is as follows:
[0044] (4)
[0045] S33. Constructing a Tt-stage uniform classification model based on gradient boosting method. And determine the training loss function as follows:
[0046] (5)
[0047] in, For the training data of the Tt task phase, For the new model, For sample data, The category labels corresponding to the sample data. The loss function; by finding a new model To reduce with truth value The differences between them;
[0048] It consists of two parts: the backbone and a linear classifier. Let the backbone be... The linear classifier is Then there is
[0049] (6)
[0050] Where T represents transpose;
[0051] Let the new model Reuse The shallow model in the backbone, denoted as ,expand The deep model in the backbone, denoted as... and includes a linear classifier , It can be further broken down into , Indicates the weight of the old category parameter. Indicates the weight of the new category parameter. It can be represented as
[0052] (7)
[0053] Combining formulas (5), (6), and (7), the following can be constructed under ideal conditions: The details are as follows:
[0054] (8)
[0055] in, A zero matrix used for alignment. The output feature length;
[0056] Transforming formula (8) yields The output is expressed as:
[0057] (9)
[0058] Build The optimization function, , , , These are frozen parameters; the trainable modules are... The trainable module parameters are collectively referred to as Design optimization function 1, the specific calculation formula is as follows:
[0059] (10)
[0060] At the same time, knowledge distillation is used to ensure Output distribution on old category data and To maintain consistency, design optimization function 2, with the specific calculation formula as follows:
[0061] (11)
[0062] Using the workwear category data from stage Tt and the features recovered after decoding in step S32 Combining optimization function 1 and optimization function 2 to Unlike the T0 phase training, supervised training does not require the use of self-supervised methods.
[0063] In step S4, the final Tt stage uniform classification model is: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Compression is performed using knowledge distillation to compress the workwear classification model. Transferring knowledge to the single backbone model before expansion ;make The trainable parameters are The objective function for optimizing the knowledge distillation process is designed, and the specific calculation formula is as follows:
[0064] (12)
[0065] The final Tt stage workwear classification model is obtained through the distillation process. .
[0066] Meanwhile, this invention provides:
[0067] A server includes a processor and a memory, the memory storing at least one program that is loaded and executed by the processor to implement the above-described workwear identification method that combines continuous learning and effectively resists the disaster of forgetting.
[0068] A computer-readable storage medium storing at least one program, which is loaded and executed by a processor to implement the above-described workwear identification method that combines continuous learning and effectively resists the disaster of forgetting.
[0069] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0070] 1. In the continuous learning task phase, this invention freezes the shallow model and expands the deep model. A gradient boosting method is used to construct a Tt-stage model. The Tt-stage model is trained using new category data from the Tt stage and decoded compressed features. Finally, knowledge distillation is used to compress the model back to a single backbone state. Compared with existing technologies, this invention rationally utilizes parameter expansion, ensuring the plasticity of the workwear classification model while controlling the number of parameters expanded during the model training phase, thus reducing training resource consumption.
[0071] 2. This invention uses an image autoencoder to encode and compress the intermediate features of the T0 stage, and decodes and recovers them for training in the Tt stage. It makes reasonable use of the intermediate features of historical samples, solves the privacy problem of historical data, and at the same time alleviates the degree of forgetting of old categories by the clothing classification model.
[0072] 3. This invention incorporates self-supervised learning to train the workwear classification model in the initial stage, which makes the model more capable of feature representation in the initial stage, obtains more general feature expression capabilities, avoids overfitting in the initial stage, and improves the model's generalization ability in subsequent stages. Attached Figure Description
[0073] Figure 1 This is a flowchart of the work uniform recognition method that combines continuous learning and effectively resists the disaster of forgetting, as described in this invention.
[0074] Figure 2 A diagram illustrating the expansion of data categories for self-supervised learning.
[0075] Figure 3 A schematic diagram of the deep and shallow model partitioning and the image autoencoder structure.
[0076] Figure 4 The flowchart for the training of the work uniform classification model in stage T0.
[0077] Figure 5This is a schematic diagram of the final work uniform classification model obtained during the continuous learning task phase.
[0078] Figure 6 The training flowchart for the Tt stage of the work uniform classification model.
[0079] Figure 7 This is a diagram of the backbone architecture in the workwear classification model.
[0080] Figure 8 This is a partial diagram of the backbone architecture in the workwear classification model. Detailed Implementation
[0081] The present invention will be further described in detail below with reference to the embodiments and accompanying drawings, but the embodiments of the present invention are not limited thereto.
[0082] like Figure 1 A method for identifying work uniforms that combines continuous learning and effectively resists the disaster of forgetting includes the following steps:
[0083] S1. In the initial stage, collect T0 stage uniform category data, construct a T0 stage uniform classification model, and perform self-supervised training on the T0 stage uniform classification model in combination with the T0 stage uniform category data.
[0084] S2. Divide the backbone in the trained T0 stage work uniform classification model into a deep model and a shallow model. Construct an image autoencoder between the deep model and the shallow model, and train the image autoencoder. Encode and compress the intermediate features output by the shallow model through the trained image autoencoder to obtain compressed features.
[0085] S3. In the continuous learning task phase, collect Tt stage workwear category data, decode the compressed features, reuse the shallow model in the trained T0 stage workwear classification model, and extend the deep model to build a new model; based on the new model, construct the Tt stage workwear classification model through the gradient boosting method, and train the Tt stage workwear classification model according to the Tt stage workwear category data and the decoded compressed features.
[0086] S4. The trained Tt stage work uniform classification model is compressed using knowledge distillation to obtain the final Tt stage work uniform classification model, and the final Tt stage work uniform classification model is used for work uniform recognition.
[0087] Training a model for detecting objects in upper body work clothes The The YOLOv5s model defines the detection target as the upper body of a pedestrian, with the detection region extending from the pedestrian's neck to their buttocks, and the outer sides of their arms to the left and right. For an input image frame, Output the upper body bounding box of the pedestrian in the image; crop the upper body bounding box region of the pedestrian image, filter out redundant, occluded and blurred images, and then classify them according to different work clothes, collect the data of different work clothes categories in the initial stage, namely the T0 stage, to facilitate the subsequent training of the work clothes classification model. The T0 stage is the initial stage.
[0088] like Figure 4 T0 stage work uniform classification model The model consists of a backbone and a linear classifier, with the backbone being ResNet50. Considering the need for continuous learning, the initial training phase should aim to enhance the model's feature representation capabilities in stage T0, acquiring more general feature representation abilities, while avoiding overfitting in stage T0 and improving the model's generalization ability in subsequent tasks. To achieve this, this invention employs a self-supervised training method. Conduct training, such as Figure 2 As shown, specifically:
[0089] Images of a certain category in the workwear category data are analyzed from three angles. Rotating the image yields three new categories; merging one category with another by randomly adding them together creates a new category; with an initial number of workwear category data points of K, self-supervised training can effectively expand the number of categories to 3K+K(K-1) / 2; all of these will be used as new categories in the workwear classification model. Training reduces overfitting to previously learned classes and improves the model's discriminative ability.
[0090] Step S2 is as follows:
[0091] S21, such as Figure 3 As shown, the work clothes classification model The backbone can be divided into shallow and deep models, which can be implemented directly through code. Among the models trained in different categories, the shallow model shows higher similarity than the deep model. This is mainly because the shallow model tends to extract general features, while the deep model tends to extract task-specific features. Therefore, in the continuous learning process, expanding the shallow model leads to lower efficiency.
[0092] Classification model of work clothes The purpose of the backbone is: (1) to input the image of the work clothes category data into The image autoencoder is used to encode the intermediate features of the shallow output to obtain compressed encoded features. These encoded features can be saved for model training in subsequent stages, effectively reducing storage consumption and protecting data privacy. (2) In the continuous learning process of the work clothes classification model in different stages, the shallow model shows higher similarity than the deep model. This is mainly because the shallow model tends to extract general features, while the deep model tends to extract task-specific features. Therefore, in the continuous learning process, expanding the shallow model brings lower efficiency. Based on this, in the Tt stage, the deep model is expanded, rather than the model as a whole. The Tt stage is the continuous learning stage. Specifically, the work clothes classification model adopted in this invention ,like Figure 7 and Figure 8 The backbone used is ResNet50, and the first three blocks are shallow models. That is, INPUT to Surface3 is the shallow model; the last block is the deep model. That is, Stage 4 to OUTPUT is a deep model;
[0093] S22. Construct an image autoencoder between the deep model and the shallow model. Intermediate features acting on the output of shallow models The image autoencoder performs encoding and decoding of intermediate features. It consists of an encoder and a decoder. The encoder comprises multiple sets of (conv+bn+relu) convolution operators, which downsample the input intermediate features multiple times to obtain compressed features z. The decoder comprises multiple sets of (convtrans+bn+relu) deconvolution operators, which upsample the compressed features z multiple times, aiming to recover lossless intermediate features. The image autoencoder does not work in the reasoning and recognition stage of the clothing classification model; it mainly works before and after training in each task stage. Before training, it decodes and recovers the compressed feature z, and after training, it encodes and saves the sampled data of each category.
[0094] S23. Train the image autoencoder, assuming... This is sample data, specifically the workwear category data collected in S1. For the corresponding labels; the training of the autoencoder needs to achieve two objectives: (1) input intermediate features With self-encoder output Basically the same; (2) self-encoder output Input work uniform classification model deep model The classification results and the true values Approximation; let the parameters in the autoencoder be The optimization function is designed as follows:
[0095] (1)
[0096] (2)
[0097] in, For the uniform classification model parameters, argmin indicates that the function reaches its minimum value in its domain. Euclidean distance. This is the KL divergence, a method for measuring the difference between two probability distributions;
[0098] Similarly, in order to improve the generalization ability of the autoencoder and prevent overfitting, the training process also adopts a self-supervised training method.
[0099] S24. To mitigate the loss of classification ability for old categories during model training in subsequent stages, the sampled data for each category in the current stage task are encoded and saved. Considering storage limitations, 20 images are currently sampled for each category; more specifically, the category sampling data... After the work clothes classification model After processing the shallow model and the encoder part of the trained image autoencoder, the compressed feature z is obtained, i.e.:
[0100] (3)
[0101] S25. For a given frame of input image, the upper body clothing target detection model. The output image contains bounding boxes of the upper body of pedestrians. Each bounding box is tracked and assigned an ID. The ID may be newly added or a historical ID that has been saved. This indicates that the bounding box is in a tracking state. Each bounding box is then fed into the work clothes classification model. The classification result of work clothes for each envelope is obtained. The classification result of work clothes for each ID after multiple consecutive frames is counted. If more than 80% of the frequency is identified as a certain type of work clothes C, then the identification result corresponding to that ID is determined to be C.
[0102] Step S3 is specifically as follows:
[0103] S31. For an input image frame... Output the upper body bounding box of pedestrians in the image; crop these regions, filter out redundant, occluded and blurred images, classify them according to different work clothes, and collect data of different work clothes categories in the continuous learning task stage, i.e., the Tt stage, to facilitate the training of the work clothes classification model in the future.
[0104] S32. Decode and recover the compressed features. For each sample compressed feature z, input it into the decoder part of the autoencoder for decoding, and let the recovered feature be... Then we have:
[0105] (4)
[0106] S33. Some previous continuous learning and research work has involved the previous stage model, namely the T0 stage work uniform classification model. Fine-tuning the model using new phase task data directly impacts the model's ability to identify older categories; some also... Simply freezing retains inherent capabilities but loses flexibility for new categories; this invention draws on the characteristics of shallow and deep models and modifies the gradient boosting method, namely, by extending... The backbone in the middle becomes an extension The deep model part of the backbone is then frozen. Meanwhile, the shallow model part is related to the already frozen part. For reuse, only the deep model portion can be trained and learned; more specifically, such as Figure 5 and Figure 6 As shown, a Tt-stage uniform classification model is constructed based on the gradient boosting method. The training loss function is determined, and the specific calculation formula is as follows:
[0107] (5)
[0108] in, For the training data of the Tt task phase, The sample data is the training data for the Tt task stage, which is obtained and composed of S24, S31, and S32 together. The category labels corresponding to the sample data; Given the loss function, the gradient boosting method aims to find new models. To reduce with truth value The differences between them; To find the expected value, calculate the average. It consists of two parts: the backbone and a linear classifier. Let the backbone be... The linear classifier is Then there is
[0109] (6)
[0110] Where T represents transpose; let the new model Reuse The shallow model in the backbone, denoted as ,expand The deep model in the backbone, denoted as... and includes a linear classifier , It can be further broken down into , Indicates the weight of the old category parameter. This represents the weight of the new category parameter, where the old category refers to data before stage Tt, and the new category refers to data at stage Tt; then It can be represented as
[0111] (7)
[0112] Considering that neural networks have strong feature learning capabilities, it is assumed that... It can effectively reduce with truth value The differences between them, combined with formulas (5), (6), and (7), can be constructed under ideal conditions. as follows:
[0113] (8)
[0114] in, A zero matrix used for alignment. The output feature length; Indicates the search for new models To reduce with truth value The difference between them, so ;
[0115] Transforming formula (8) yields Output expression:
[0116] (9)
[0117] From formula (9), we can see that The output consists of two parts: the upper part is the old category features, which are then processed... make up with truth value The differences between them prompted Learn more key classification information; the lower half contains new category features, making... Maintaining plasticity; the above characteristics can effectively reduce the degree of catastrophic forgetting in the continuous learning process while maintaining the model's plasticity to new categories;
[0118] After building After that, it is necessary to build Optimization function: , , , These are frozen parameters; the trainable modules are... The trainable parameters are collectively referred to as Then the optimization function 1 is defined as follows:
[0119] (10)
[0120] At the same time, in order to ensure To ensure the classification capability of old categories, this invention employs knowledge distillation. Output distribution on old category data and To maintain consistency, i.e., optimize function 2:
[0121] (11)
[0122] Using the workwear category data from stage Tt and the old category sample decoding data from step S32 By combining the two optimization functions mentioned above, supervised training optimization is performed. Unlike the T0 phase training, the training process does not require the use of self-supervised methods.
[0123] In step S4, the workwear classification model for stage Tt is compressed. If the gradient boosting method is continuously used to build the workwear classification model, the number of model parameters will increase continuously with the continuous learning at different stages, which is extremely detrimental to storage consumption and will also bring discontinuity between old and new categories in the feature space. It is necessary to compress the gradient boosted model and remove redundant parameters. This invention mainly uses knowledge distillation to compress the workwear classification model. Transferring knowledge to the single backbone model before expansion That is, Resnet50; let The trainable parameters are The optimization objective function for the knowledge distillation process is shown below:
[0124] (12)
[0125] Through the above distillation process, the final Tt stage workwear classification model is obtained. ;
[0126] In this invention, the old category refers to the workwear category data in stage T0, and the new category refers to the workwear category data in stage Tt; the encoding and storage of sampling data for each category in stage Tt and the workwear detection and identification process are the same as steps S24 and S25, respectively.
[0127] Meanwhile, this invention provides:
[0128] A server includes a processor and a memory, the memory storing at least one program that is loaded and executed by the processor to implement the above-described workwear identification method that combines continuous learning and effectively resists the disaster of forgetting.
[0129] A computer-readable storage medium storing at least one program, which is loaded and executed by a processor to implement the above-described workwear identification method that combines continuous learning and effectively resists the disaster of forgetting.
[0130] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A method for identifying work clothes that combines continuous learning and effectively resists the disaster of forgetting, characterized in that, Includes the following steps: S1. In the initial stage, collect T0 stage uniform category data, construct a T0 stage uniform classification model, and perform self-supervised training on the T0 stage uniform classification model in combination with the T0 stage uniform category data. S2. Divide the backbone in the trained T0 stage work uniform classification model into a deep model and a shallow model. Construct an image autoencoder between the deep model and the shallow model, and train the image autoencoder. Encode and compress the intermediate features output by the shallow model through the trained image autoencoder to obtain compressed features. S3. In the continuous learning task phase, collect Tt stage workwear category data, decode the compressed features, reuse the shallow model in the trained T0 stage workwear classification model, and extend the deep model to build a new model; based on the new model, construct the Tt stage workwear classification model through the gradient boosting method, and train the Tt stage workwear classification model according to the Tt stage workwear category data and the decoded compressed features. S4. The trained Tt stage work uniform classification model is compressed using knowledge distillation to obtain the final Tt stage work uniform classification model, and the final Tt stage work uniform classification model is used for work uniform recognition.
2. The work uniform recognition method according to claim 1, which combines continuous learning and effectively resists the disaster of forgetting, is characterized in that, Step S1 involves training a target detection model for upper body work clothes based on the YOLOv5s model. The detection target is defined as the upper body of a pedestrian, with the region extending from the pedestrian's neck to their buttocks, and the outer sides of their arms to the left and right. For an input image frame, Output the bounding box of the upper body of the pedestrian in the image; The upper body bounding box region of the pedestrian image is extracted, redundant, occluded and blurred images are filtered out, and then classified according to different work clothes to collect data of different work clothes categories in the initial stage, namely the T0 stage. Constructing a T0 stage work uniform classification model , It consists of a backbone and a linear classifier, where the backbone is a ResNet50; a self-supervised training method is used. The training will be conducted as follows: In the T0 stage, images from one category of workwear data are rotated by three predefined angles to obtain three new categories. Then, one category image is randomly added to another category and fused to obtain a new category. When the number of workwear categories in the T0 stage is K, the data is augmented to 3K + K(K-1) / 2 categories using a self-supervised training method. The augmented data is then used to train the workwear classification model. Conduct training.
3. The work uniform recognition method according to claim 1, which combines continuous learning and effectively resists the disaster of forgetting, is characterized in that... Step S2 is as follows: S21. The trained work uniform classification model The backbone is divided into shallow and deep models. The first three blocks of the backbone are divided into shallow models. The last block module is divided into deep models. ; S22. Construct an image autoencoder between the deep model and the shallow model. Intermediate features acting on the output of shallow models ,in, It is a shallow model. For sample data, intermediate features are encoded and decoded. The image autoencoder consists of two parts: an encoder and a decoder. The encoder downsamples the input intermediate features multiple times to obtain compressed features z; the decoder upsamples the compressed features z multiple times to recover the lossless intermediate features. ; S23. Train the image autoencoder, let For sample data, Assign labels to the sample data; design an optimization function for the image autoencoder, with the specific calculation formula as follows: ;(1) ;(2) in, Euclidean distance. Let KL divergence be the KL divergence. Parameters for the work uniform classification model; Furthermore, the image autoencoder training process also employs a self-supervised training method; S24. Sample 20 images from each category of the work uniform category data to obtain category sampling data. After the work clothes classification model After processing the shallow model and the encoder part of the trained image autoencoder, the compressed feature z is obtained, and the specific calculation formula is as follows: (3)。 4. The work uniform recognition method according to claim 1, which combines continuous learning and effectively resists the disaster of forgetting, is characterized in that... Step S3 is specifically as follows: S31. Collect data on different workwear categories during the continuous learning task phase, i.e., the Tt phase, according to the method described in step S1. S32. Decode and recover the compressed feature z. The recovered feature is: The specific calculation formula is as follows: ; (4) S33. Constructing a Tt-stage uniform classification model based on gradient boosting method. And determine the training loss function as follows: ;(5) in, For the training data of the Tt task phase, For the new model, For sample data, The category labels corresponding to the sample data. The loss function; by finding a new model To reduce with truth value The differences between them; It consists of two parts: the backbone and a linear classifier. Let the backbone be... The linear classifier is Then there is ;(6) Where T represents transpose; Let the new model Reuse The shallow model in the backbone, denoted as ,expand The deep model in the backbone, denoted as... and includes a linear classifier , It can be further broken down into , Indicates the weight of the old category parameter. Indicates the weight of the new category parameter. It can be represented as ;(7) Combining formulas (5), (6), and (7), the following can be constructed under ideal conditions: The details are as follows: ;(8) in, A zero matrix used for alignment. The output feature length; Transforming formula (8) yields The output is expressed as: ;(9) Build The optimization function, , , , These are frozen parameters; the trainable modules are... The trainable module parameters are collectively referred to as Design optimization function 1, the specific calculation formula is as follows: ; (10) At the same time, knowledge distillation is used to ensure Output distribution on old category data and To maintain consistency, design optimization function 2, with the specific calculation formula as follows: ;(11) Using the workwear category data from stage Tt and the features recovered after decoding in step S32 Combining optimization function 1 and optimization function 2 to Unlike the T0 phase training, supervised training does not require the use of self-supervised methods.
5. The work uniform recognition method according to claim 1, which combines continuous learning and effectively resists the disaster of forgetting, is characterized in that... In step S4, the final Tt stage uniform classification model is: [The text abruptly ends here, likely due to an incomplete sentence or a formatting error.] Compression is performed using knowledge distillation to compress the workwear classification model. Transferring knowledge to the single backbone model before expansion ;make The trainable parameters are The objective function for optimizing the knowledge distillation process is designed, and the specific calculation formula is as follows: ;(12) The final Tt stage workwear classification model is obtained through the distillation process. .
6. A server, characterized in that, The server includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the workwear identification method according to any one of claims 1 to 5, which combines continuous learning and effectively resists the disaster of forgetting.
7. A computer-readable storage medium, characterized in that, The storage medium stores at least one program, which is loaded and executed by a processor to implement the workwear identification method according to any one of claims 1 to 5, which combines continuous learning and effectively resists the disaster of forgetting.