Object recognition model generation method and apparatus, electronic device, and storage medium
By redistributing sample weights and training the model in industrial manufacturing scenarios, the problem of declining model generalization performance and accuracy in incremental learning is solved, achieving more efficient object recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-11-25
- Publication Date
- 2026-07-21
AI Technical Summary
In industrial manufacturing scenarios, due to the small differences between classes, incremental learning cannot effectively mitigate catastrophic forgetting, leading to reduced model generalization performance and decreased object recognition accuracy.
By acquiring the new samples corresponding to the current task, weights are redistributed based on the task sequence number, and it is determined that the weight of the currently retained samples is greater than the weight of the new samples. The retained samples and new samples are used to train the historical object recognition model to form the target object recognition model.
It improves the generalization performance and object recognition accuracy of the target object recognition model, and avoids inter-task confusion and catastrophic forgetting in incremental learning.
Smart Images

Figure CN116958620B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to methods, apparatus, electronic devices and storage media for generating object recognition models. Background Technology
[0002] In industrial manufacturing, emerging technologies such as artificial intelligence and deep learning are commonly used for quality inspection of product appearance. However, in practical applications, as time goes on, more sample defect data is collected on the production line, while older data may become unusable due to storage limitations, leading to catastrophic forgetting during model training. In existing technologies, the small inter-class differences in industrial manufacturing scenarios mean that incremental learning cannot effectively mitigate catastrophic forgetting. Consequently, as the number of training iterations increases, the model's generalization performance and object recognition accuracy decrease. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, and storage medium for generating object recognition models, which can improve the generalization performance of target object recognition models and the accuracy of object recognition.
[0004] On the one hand, this application provides a method for generating an object recognition model, the method comprising:
[0005] Obtain the currently added sample corresponding to the current task; the currently added sample is determined based on the newly added identification type of the target object;
[0006] Based on the task sequence number identifier corresponding to the current task, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently newly added samples; the weights of the currently retained samples are greater than the weights of the currently newly added samples, and the difference between the weights of the currently retained samples and the weights of the currently newly added samples is associated with the task sequence number identifier;
[0007] Based on the weight of the currently retained sample, the current retained sample is determined from the historical samples; the historical samples are determined based on the retained sample corresponding to the previous task sequence number, the newly added sample corresponding to the previous task sequence number, and the weight of the previously added sample.
[0008] Based on the currently retained samples and the currently newly added samples, the historical object recognition model corresponding to the historical samples is trained to obtain the target object recognition model.
[0009] On the other hand, this application provides an object recognition method, the method comprising:
[0010] Obtain the object to be identified;
[0011] The object to be identified is input into the target object recognition model generated by the object recognition model generation method described above, and the object recognition result corresponding to the object to be identified is obtained.
[0012] On the other hand, an apparatus for generating an object recognition model is provided, the apparatus comprising:
[0013] The newly added sample acquisition module is used to acquire the currently added sample corresponding to the current task; the currently added sample is determined based on the newly added identification type of the target object;
[0014] The weight redistribution module is used to redistribute sample weights based on the task sequence number identifier corresponding to the current task, and determine the weights of currently retained samples and currently added samples; the weights of currently retained samples are greater than the weights of currently added samples, and the difference between the weights of currently retained samples and the weights of currently added samples is associated with the task sequence number identifier;
[0015] The retained sample determination module is used to determine the current retained sample from the historical samples based on the weight of the current retained sample; the historical samples are determined based on the retained sample corresponding to the previous task sequence number, the newly added sample corresponding to the previous task sequence number, and the weight of the previously added sample;
[0016] The model training module is used to train the historical object recognition model corresponding to the historical sample based on the currently retained sample and the currently added sample, so as to obtain the target object recognition model.
[0017] On the other hand, an object recognition device is provided, the device comprising:
[0018] The object information acquisition module is used to acquire object information of the object to be identified;
[0019] The object recognition module is used to input the object information into the target object recognition model generated based on the object recognition model generation method described above, and to obtain the object recognition result corresponding to the object to be recognized.
[0020] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a method for generating an object recognition model as described above or an object recognition method as described above.
[0021] On the other hand, a computer-readable storage medium is provided, the storage medium including a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a method for generating an object recognition model as described above or an object recognition method as described above.
[0022] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods or object recognition methods provided in various alternative implementations of the above-described object recognition model.
[0023] This application provides a method, apparatus, electronic device, and storage medium for generating an object recognition model. The method includes: reallocating sample weights based on the task sequence identifier corresponding to the current task; determining the weights of currently retained samples and newly added samples, ensuring that the weights of currently retained samples are greater than the weights of newly added samples; and determining currently retained samples from historical samples based on the weights of currently retained samples. Based on the currently retained samples and newly added samples, the method trains a historical object recognition model corresponding to the historical samples to obtain a target object recognition model. This method can avoid inter-task confusion and catastrophic forgetting of historical object recognition models during incremental learning through updatable non-uniform sample caching, thereby improving the generalization performance and object recognition accuracy of the target object recognition model. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A schematic diagram illustrating an application scenario of the object recognition model generation method provided in this application embodiment;
[0026] Figure 2 A flowchart illustrating the method for generating an object recognition model as provided in this application embodiment;
[0027] Figure 3 A schematic diagram illustrating the change in the number of currently retained samples in the method for generating the object recognition model provided in this application embodiment;
[0028] Figure 4 A flowchart illustrating the weight reallocation based on target difference in the method for generating the object recognition model provided in this application embodiment;
[0029] Figure 5 A schematic diagram of cache management based on task sequence number identifier in the method for generating the object recognition model provided in the embodiments of this application;
[0030] Figure 6 A flowchart illustrating the weight reallocation based on update differences in the object recognition model generation method provided in this application embodiment;
[0031] Figure 7 A flowchart illustrating model training based on inter-task decay learning rate in the object recognition model generation method provided in this application embodiment;
[0032] Figure 8 A flowchart illustrating model training based on a learning rate that decays within the same task in the method for generating an object recognition model provided in this application embodiment;
[0033] Figure 9 A schematic diagram illustrating the learning rate decay during the training process of each current task in the object recognition model generation method provided in the embodiments of this application;
[0034] Figure 10 This is a flowchart illustrating the process of obtaining training samples and training the model in the object recognition model generation method provided in this application embodiment.
[0035] Figure 11 A flowchart illustrating the object recognition method provided in this application embodiment;
[0036] Figure 12 This is a schematic diagram illustrating incremental learning of the object recognition model in the method for generating the object recognition model provided in the embodiments of this application;
[0037] Figure 13 A schematic diagram of the structure of the object recognition model generation device provided in the embodiments of this application;
[0038] Figure 14 This is a schematic diagram of the structure of the object recognition device provided in the embodiments of this application;
[0039] Figure 15 This is a schematic diagram of the hardware structure of a device for implementing the method provided in the embodiments of this application. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0041] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. Furthermore, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein.
[0042] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0043] Please see Figure 1 This illustration shows an application scenario of the object recognition model generation method provided in this application embodiment. The application scenario includes a client 110 and a server 120. The server 120 obtains the currently added sample corresponding to the current task from the client 110. Based on the task sequence number identifier corresponding to the current task, the server 120 performs weight reallocation on the sample weights to determine the weights of the currently retained samples and the currently added samples. The server 120 can determine the currently retained samples from historical samples based on the weights of the currently retained samples, and train the historical object recognition model corresponding to the historical samples based on the currently retained samples and the currently added samples to obtain the target object recognition model. The server 120 can also obtain the object information of the object to be recognized sent by the client 110 and perform object recognition based on the target object recognition model.
[0044] In this embodiment, the client 110 includes physical devices such as smartphones, desktop computers, tablets, laptops, in-vehicle terminals, digital assistants, and smart wearable devices, and may also include software running on the physical device, such as applications. The operating system running on the physical device in this embodiment may include, but is not limited to, Android, iOS, Linux, Unix, and Windows.
[0045] In this embodiment, server 120 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0046] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0047] In this embodiment, server 120 can generate an object recognition model and recognize objects using artificial intelligence (AI) technology. AI is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.
[0048] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0049] Please see Figure 2 It demonstrates a method for generating an object recognition model, applicable to the server side, the method comprising:
[0050] S210. Obtain the currently added sample corresponding to the current task; the currently added sample is determined based on the newly added recognition type of the target object;
[0051] In some embodiments, the current task is a newly added recognition task for the target object, and the newly added sample can be image information corresponding to a newly added recognition type of the target object, such as image information of a newly added defect recognition type of the industrial product during defect detection. The current task can be a newly added object recognition task, and the current task can include at least one newly added sample corresponding to each of the newly added recognition types.
[0052] S220. Based on the task sequence number identifier corresponding to the current task, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently newly added samples; the weights of the currently retained samples are greater than the weights of the currently newly added samples, and the difference between the weights of the currently retained samples and the weights of the currently newly added samples is associated with the task sequence number identifier;
[0053] In some embodiments, historical samples are a subset of cached samples from the samples corresponding to the identification type before the addition of a new identification type. The weight of the currently retained sample is used to determine the currently retained sample from the historical sample, and the weight of the currently added sample is used to determine the newly cached sample from the currently added sample. The newly cached sample and the currently retained sample can serve as historical samples corresponding to the new samples of the next task.
[0054] S230. Determine the current retained sample from the historical samples based on the weight of the current retained sample; the historical samples are determined based on the retained sample corresponding to the previous task number identifier, the newly added sample corresponding to the previous task number identifier, and the weight of the previously added sample;
[0055] In some embodiments, the previous task sequence number identifier is the task sequence number identifier corresponding to the newly added task in the previous period. The historical sample includes the newly added cached sample corresponding to the previous task sequence number identifier and the retained sample corresponding to the task sequence number identifier before the previous task sequence number identifier. The newly added cached sample corresponding to the previous task sequence number identifier is determined based on the newly added sample corresponding to the previous task sequence number identifier and the weight of the previously added sample. Based on the weight of the currently retained sample, the currently retained sample can be determined from the historical sample. The historical sample may include at least one target sample corresponding to a task sequence number identifier, and the target sample corresponding to each task sequence number identifier is a portion of the newly added samples corresponding to each task sequence number identifier. Figure 3 As shown, Figure 3This diagram illustrates the change in the number of currently retained samples. When the newly added sample corresponding to Task 2 is obtained, the newly added sample corresponding to Task 1 is considered a historical sample. Based on the weight of the currently retained samples, a portion of the newly added sample corresponding to Task 1 is extracted from the historical samples to obtain the currently retained samples. The remaining storage space stores a portion of the newly added sample corresponding to Task 2. When the newly added sample corresponding to Task 3 is obtained, a portion of the newly added sample corresponding to Task 1 and a portion of the newly added sample corresponding to Task 2 are combined to obtain the historical samples. Based on the weight of the currently retained samples, a portion of the samples corresponding to Task 1 and a portion of the samples corresponding to Task 2 are extracted from the historical samples to obtain the currently retained samples. The remaining storage space stores a portion of the newly added sample corresponding to Task 3.
[0056] S240. Based on the currently retained samples and the currently added samples, train the historical object recognition model corresponding to the historical samples to obtain the target object recognition model.
[0057] In some embodiments, based on the currently retained samples and the newly added samples, incremental learning can be performed through playback to train the historical object recognition model corresponding to the historical samples, thereby obtaining the target object recognition model. The target object recognition model can recognize the newly added recognition type while maintaining the recognition accuracy for the recognition types before the newly added recognition type.
[0058] In some embodiments, see Figure 4 The historical samples include target samples corresponding to multiple task sequence numbers, and the difference in the number of target samples corresponding to adjacent task sequence numbers is the target difference. The target samples corresponding to each task sequence number are a subset of the newly added samples corresponding to each task sequence number. Based on the task sequence number corresponding to the current task, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently added samples, including:
[0059] S410. Based on the task sequence number identifier, determine the target distance between the newly added sample and the target sample corresponding to the starting task sequence number identifier;
[0060] In some embodiments, the target distance can be the temporal distance between the task sequence number identifier and the starting task sequence number identifier. The target distance is determined by the difference between the current task's storage time and the starting task's storage time when the task is stored in the cache in chronological order, or by the difference between the current task's generation time and the starting task's generation time when tasks are generated in chronological order. The target distance between target samples corresponding to adjacent task sequence number identifiers can be set to 1. For example, if the task sequence number identifier is 3, and the current task is the third task stored in the cache in chronological order, then the target distance between the newly added sample and the target sample corresponding to the starting task sequence number identifier is 2.
[0061] S420. Based on the target distance and target difference, determine the new weight difference information corresponding to the new sample;
[0062] In some embodiments, the target distance and the target difference can be multiplied to obtain a product, which is used as the new weight difference information between the new sample and the target sample corresponding to the starting task number identifier. The target difference is a preset fixed value. For example, if the task number identifier is 3, and the current task is the third task stored in the cache according to the time sequence, then the target distance between the new sample and the target sample corresponding to the starting task number identifier is 2. If the preset target difference is k, then the new weight difference information is 2k.
[0063] S430. Based on the newly added weight difference information, the historical weight difference information corresponding to the historical samples, and the preset sample size, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently added samples.
[0064] In some embodiments, based on the newly added weight difference information, the historical weight difference information corresponding to historical samples, and a preset sample size, the sample weights can be reallocated, that is, the sample size corresponding to the newly added samples and the sample size corresponding to the historical samples can be allocated. The preset sample size can be the total number of samples that can be stored in the replay buffer. Based on the weight of the currently retained samples, retained samples are obtained from the historical samples. Based on the weight of the currently added samples, newly cached samples are obtained from the added samples. The retained samples and newly cached samples are stored as cached samples in the replay buffer, serving as historical samples that identify the corresponding newly added samples in the next task sequence number.
[0065] The weight of the currently newly added sample can be the proportion of the number of samples in the cache that are currently newly added, while the weight of the currently retained sample can be the proportion of the number of samples in the cache that are currently retained. The specific formula is as follows, which can calculate the proportion of each sample stored in the replay cache after adding some samples from the newly added samples, thus obtaining the weight of the currently retained sample and the weight of the currently newly added sample.
[0066]
[0067] Where Y is the preset sample size, x is the sample size of each target sample or newly added cached sample after removing the corresponding weight difference information, and n is the task sequence number. The weight of the currently retained sample is... The weight of the newly added sample is
[0068] For example, if the task number is 3 and the newly added weight difference information is 2k, and the historical samples include the target sample corresponding to task number 1 and the target sample corresponding to task number 2, with historical weight difference information of 0 and k respectively, and the preset sample size is Y, then the weight of the currently retained sample and the weight of the currently added sample can be calculated using formulas, and the number of retained samples and the number of newly cached samples can be further calculated.
[0069] like Figure 5 As shown, Figure 5 This diagram illustrates cache management based on task sequence number. The samples corresponding to Task 1 differ from those corresponding to Task 2 by k samples, and the samples corresponding to Task 2 also differ from those corresponding to Task 3 by k samples. Furthermore, the samples corresponding to Task 3 differ from those corresponding to Task 1 by 2 target intervals. In the cache, storage space can be allocated to target samples corresponding to different tasks in a step-down manner, ensuring that target samples stored earlier occupy a larger amount of storage space, so that the number of target samples decreases sequentially according to time. The difference between two adjacent target samples is k allocation spaces, which is k sample counts. Each target sample can include multiple recognition types, and the number of samples corresponding to each recognition type within the same target sample is the same.
[0070] Based on the preset target difference and task sequence number, the sample weights are redistributed. By setting the target difference, a non-uniform sample cache can be formed, which ensures that the samples stored earlier have a larger number of samples. These samples can receive more attention during model training, avoiding catastrophic forgetting and task confusion in incremental learning, thereby improving the generalization performance of the target object recognition model.
[0071] In some embodiments, see Figure 6 The historical samples include target samples corresponding to multiple task sequence numbers. The target samples corresponding to each task sequence number are a subset of the newly added samples corresponding to each task sequence number. Based on the task sequence number corresponding to the current task, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently added samples, including:
[0072] S610. Based on the task sequence number identifier and the preset sample size, update the difference in the number of samples between target samples with adjacent task sequence number identifiers to obtain the updated difference;
[0073] In some embodiments, the difference in the number of samples between target samples with adjacent task number identifiers can be an adaptively updated difference. Based on the task number identifier and a preset sample size, the difference in the number of samples between target samples with adjacent task number identifiers can be updated to obtain an updated difference. The sum of the task number identifier and the task number identifiers corresponding to historical samples can be determined, and the preset sample size can be divided by this sum to obtain the updated difference. For example, if the task number identifier is 3, and the historical samples include the target sample corresponding to task number identifier 1 and the target sample corresponding to task number identifier 2, the value obtained by dividing the preset sample size by 6 can be used as the updated difference.
[0074] S620. Based on the updated difference and the preset sample size, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently added samples.
[0075] In some embodiments, based on the update difference and a preset sample size, the sample weights are redistributed according to the task number identifiers corresponding to the target samples in the historical samples to determine the current retained sample weights. Based on the update difference and a preset sample size, the sample weights are redistributed according to the task number identifiers corresponding to the newly added samples to determine the current newly added sample weights. For example, if the task number identifier is 3, and the historical samples include the target samples corresponding to task number identifier 1 and task number identifier 2, the value obtained by dividing the preset sample size by 6 can be used as the update difference K. Then, the ratio of the preset sample size to 3K and the ratio of the preset sample size to 2K can be used as the current retained sample weights, and the ratio of the preset sample size to K can be used as the current newly added sample weights, such that the difference in the number of samples corresponding to adjacent task number identifiers is the update difference.
[0076] Based on the weights of the currently retained samples, retrieve the retained samples from the historical samples. Based on the weights of the currently added samples, retrieve the newly cached samples from the added samples. Store the retained samples and the newly cached samples as cached samples in the replay buffer, and use them as historical samples to identify the corresponding newly added samples in the next task sequence number.
[0077] Based on the adaptively adjustable update difference and task sequence identifier, the sample weights are redistributed. By setting an adaptively adjustable target difference, a non-uniform sample cache is formed, which ensures that the samples stored earlier have a larger number of samples. These samples can receive more attention during model training, avoiding catastrophic forgetting and inter-task confusion in incremental learning, thereby improving the generalization performance of the target object recognition model.
[0078] In some embodiments, see Figure 7 Based on the currently retained samples and the currently added samples, the historical object recognition model corresponding to the historical samples is trained to obtain the target object recognition model, including:
[0079] S710. Based on the task number identifier, the preset learning rate is subjected to parameter decay processing to obtain the target learning rate corresponding to the newly added sample;
[0080] In some embodiments, upon acquiring a new sample, a preset learning rate can be attenuated to obtain a target learning rate for that new sample. The degree of learning rate attenuation for the new sample can be determined based on the task number, and the preset learning rate can be attenuated based on this attenuation to obtain the target learning rate. The target learning rate for each new sample is less than the target learning rate for the previous new sample. The specific formula is as follows:
[0081] lr_task = initial_lr × 0.9 task-1 Formula 2
[0082] Where lr_task is the target learning rate, initial_lr is the preset learning rate (which can be manually set), and task is the sequence identifier of the current task.
[0083] S720. Based on the currently retained samples and the currently added samples, train the historical object recognition model according to the target learning rate to obtain the target object recognition model.
[0084] In some embodiments, based on the currently retained samples and the currently added samples, the historical object recognition model can be trained in the first round according to the target learning rate. Then, the target learning rate is decayed, and a second round of model training is performed. That is, when training the model within the current task, the learning rate of the trained model can be adjusted after each round of training before the next round of training.
[0085] Decaying the learning rate between tasks can prevent the use of a large learning rate in incremental learning from increasing the probability of forgetting the recognition types before the new recognition type, thus ensuring the stability of model training and improving the accuracy of object recognition.
[0086] In some embodiments, see Figure 8 Based on the currently retained samples and the newly added samples, the historical object recognition model is trained according to the target learning rate to obtain the target object recognition model, which includes:
[0087] S810. Use the target learning rate as the current learning rate and the historical object recognition model as the current training model;
[0088] In some embodiments, in the first round of training, the target learning rate can be used as the current learning rate, and the historical object recognition model can be used as the current training model for model training.
[0089] S820. Based on the currently retained samples and the currently added samples, train the current training model according to the current learning rate to obtain the recognition model corresponding to the current training round; the current training round is the training round corresponding to the current learning rate;
[0090] In some embodiments, in the first round of training, the current learning rate is the target learning rate, the current training model is the historical object recognition model, and the historical object recognition model is trained according to the target learning rate based on the currently retained samples and the currently newly added samples to obtain the recognition model corresponding to the first training round.
[0091] In training rounds other than the first round, the current learning rate is obtained by decaying the learning rate corresponding to the previous training round, and the current training model is the recognition model corresponding to the previous training round. Based on the currently retained samples and the currently added samples, the current training model is trained according to the current learning rate to obtain the recognition model corresponding to the current training round.
[0092] S830. Based on the current parameter decay information, update the current learning rate to obtain the learning rate corresponding to the next training round of the current training round;
[0093] In some embodiments, the current parameter decay information can be determined based on the cosine function and the current training epoch. The current learning rate is then updated based on this decay information. The specific formula is as follows:
[0094]
[0095] Where lr_task is the current learning rate, lr is the updated current learning rate, t is the current training round, and T is the preset number of training rounds.
[0096] S840. Repeat the steps of training the current training model based on the currently retained samples and the currently added samples, according to the current learning rate, to obtain the recognition model corresponding to the current training round, and updating the parameters based on the current parameter decay information to obtain the learning rate corresponding to the next training round, until the training round reaches the preset number of training rounds. Then, use the recognition model corresponding to the training round that reaches the preset number of training rounds as the target object recognition model.
[0097] In some embodiments, the current learning rate is decayed after each model training iteration to obtain the learning rate for the next model training iteration. This process is repeated until a preset number of training iterations is reached. The recognition model corresponding to the last training iteration can be used as the target object recognition model. The preset number of training iterations can be a fixed value or an adaptively adjusted value based on different model types. Please refer to [link to relevant documentation]. Figure 9 ,like Figure 9 The diagram illustrates the learning rate decay during training for each current task. Decreasing the learning rate across multiple tasks, such as Task 1, Task 2, and Task 3, yields the target learning rate for each task. During model training for each task, the learning rate decays within each current task using a cosine function until the preset number of training epochs is met. Figure 9 25 times.
[0098] In the same task, after each round of model training, the target learning rate obtained after the inter-task decay process is decayed and updated, which can improve the accuracy of the target object recognition model.
[0099] In some embodiments, see Figure 10 Based on the currently retained samples and the currently added samples, the historical object recognition model corresponding to the historical samples is trained to obtain the target object recognition model, which also includes:
[0100] S1010. Obtain the training samples corresponding to multiple training rounds respectively; the training samples include a first number of samples obtained from the cached samples and a second number of samples obtained from the remaining samples; the cached samples include newly added cached samples determined from the currently added samples based on the weight of the currently added samples, and currently retained samples; the remaining samples are other samples in the currently added samples excluding the newly added cached samples;
[0101] In some embodiments, the first number of samples obtained from the cached samples and the second number of samples obtained from the remaining samples can be the same number or different numbers. For example, the first number of samples may be more than the second number of samples, or the second number of samples may be less than the first number of samples. The first number of samples and the second number of samples are combined into a mini-batch of samples for a training round, which is the training sample and input into the historical object recognition model for object recognition.
[0102] S1020. Input the samples to be trained into the historical object recognition model to perform object recognition and obtain the training recognition results;
[0103] In some embodiments, the historical object recognition model may include at least one feature extraction layer and a feature classification layer. The training samples are input into at least one feature extraction layer for feature extraction to obtain sample recognition features. These features are then input into the feature classification layer for classification processing to obtain the training recognition result. The feature classification layer may be a fully connected layer, and the training recognition result is output through the fully connected layer.
[0104] S1030. Based on the training recognition results and the sample annotation information corresponding to the samples to be trained, the historical object recognition model is trained according to the target learning rate to obtain the target object recognition model.
[0105] In some embodiments, the sample annotation information can be manually annotated. The sample annotation information includes the newly added recognition type corresponding to the current new sample and the recognition types corresponding to samples preceding the current new sample. Based on the training recognition results and the sample annotation information corresponding to the samples to be trained, supervised model training can be performed on the historical object recognition model according to the target learning rate to obtain the target object recognition model. The target object recognition model can recognize both the newly added recognition type and the recognition types corresponding to samples preceding the current new sample.
[0106] By training an incremental learning model based on playback using newly added and retained samples, additional storage space can be used to recall the recognition types before the addition of new recognition types, thereby improving the stability of training the historical object recognition model and further enhancing the accuracy of object recognition.
[0107] Please see Figure 11 It demonstrates an object recognition method applicable to the server side, the method comprising:
[0108] S1110. Obtain object information of the object to be identified;
[0109] S1120. Input the object information into the target object recognition model generated by the above object recognition model generation method to perform object recognition and obtain the object recognition result corresponding to the object to be recognized.
[0110] In some embodiments, object information of the object to be identified is obtained. This object information can be image information, video information, etc., such as image information of the product to be inspected in industrial inspection. The object information is input into a target object recognition model for object recognition. The target object recognition model can be a model obtained through incremental learning. If the object information of the object to be identified includes object information corresponding to a newly added recognition type, the target object recognition model can output the object recognition result corresponding to the newly added recognition type. Furthermore, if the object information of the object to be identified includes object information corresponding to recognition types before the newly added recognition type, the target object recognition model can also output the object recognition result corresponding to recognition types before the newly added recognition type.
[0111] Object recognition is performed using a target object recognition model. This model can recognize both newly added recognition types and existing recognition types, thus enriching the application scenarios of the target object recognition model and improving its reusability.
[0112] In some embodiments, see Figure 12 ,like Figure 12 The diagram illustrates incremental learning of the object recognition model. This object recognition model generation method can be applied to various industrial product defect detection scenarios, such as detecting new defects within the same product, detecting defects in new products on the same production line, and integrating different production lines. Incremental learning can be performed using the object recognition model generation method described above. The target object recognition model obtained after model training can then detect new defects within the same product, defects in new products on the same production line, and products on the integrated production line.
[0113] When performing defect detection on industrial products, the inter-class distance between different types of defects is less than a preset threshold, leading to class confusion in defect detection. To avoid class confusion, the currently added sample corresponding to the current defect detection task is obtained. This currently added sample includes the newly identified product defect type. Based on the currently added sample, the historical samples currently stored in the cache are updated. Historical samples are samples corresponding to the product defect identification type before the addition of the new product defect identification type, and may include at least one target sample corresponding to a historical product defect identification type. The weight of the currently added sample and the weight of the currently retained sample corresponding to the historical sample can be determined based on the difference in the number of samples between the task number identifier corresponding to the current defect detection task and the target samples corresponding to adjacent task number identifiers. The weight of the currently added sample can be the proportion of the currently added sample in the cache, and the weight of the currently retained sample can be the proportion of the historical sample in the cache. Based on the weight of the currently added sample, the newly cached sample corresponding to the currently added sample is obtained, and based on the weight of the currently retained sample, the currently retained sample corresponding to the historical sample is obtained. The difference in the number of samples between the target samples corresponding to adjacent task number identifiers can be a fixed target difference or an updated difference that can be adjusted according to the task number identifier. The weight of the currently retained samples is greater than the weight of the currently added samples, so the number of retained samples is greater than the number of newly cached samples. That is, the number of samples corresponding to the historical product defect identification type is greater than the number of samples corresponding to the newly added product defect identification type. When training the model to identify the newly added product defect type, the training can focus on the model's ability to identify the historical product defect type.
[0114] The first number of samples are obtained from the cached samples obtained by combining the retained samples and the newly added cached samples, and the second number of samples are obtained from the remaining samples of the newly added samples excluding the newly added cached samples, and the samples are combined to obtain the training samples.
[0115] Based on the task sequence number, the preset learning rate can be decayed using Formula 2 to obtain the target learning rate. This ensures that whenever a new product defect identification type is added, the target learning rate for that new type is lower than the target learning rate for the previous product defect identification type. Then, based on the training samples from the first model training, the historical object identification model corresponding to the historical samples can be trained for the first time according to the target learning rate. The target learning rate is then decayed again using Formula 3. Based on the training samples from the second model training, the identification model obtained after the first model training is trained for the second time according to the decayed target learning rate. This process is repeated until the preset number of training iterations is met, resulting in the target object identification model. This target object identification model can identify both historical product defect types and newly added product defect types.
[0116] This object recognition model generation method can also be applied to scenarios where new recognition categories can be added, such as video recommendation and image processing scenarios. In video recommendation scenarios, if a new video recommendation type is added, such as adding videos related to a specific activity, the model can be trained using the object recognition model generation method described above, enabling the target object recognition model to identify videos related to that activity and achieve more accurate recommendations. In image processing scenarios, if a new image processing type is added, such as adding filters, the model can be trained using the object recognition model generation method described above, enabling the target object recognition model to identify images corresponding to that image processing type.
[0117] This application provides a method for generating an object recognition model. The method includes: reallocating sample weights based on the task sequence number corresponding to the current task; determining the weights of currently retained samples and newly added samples, ensuring that the weights of currently retained samples are greater than the weights of newly added samples; and determining currently retained samples from historical samples based on the weights of currently retained samples. Based on the currently retained samples and newly added samples, training a historical object recognition model corresponding to the historical samples to obtain a target object recognition model. This method can avoid inter-task confusion and catastrophic forgetting of historical object recognition models during incremental learning through updatable, non-uniform sample caching, thereby improving the generalization performance and object recognition accuracy of the target object recognition model.
[0118] This application also provides an apparatus for generating an object recognition model; please refer to [link to relevant documentation]. Figure 13 The device includes:
[0119] The new sample acquisition module 1310 is used to acquire the current new sample corresponding to the current task; the current new sample is determined based on the new recognition type of the target object.
[0120] The weight redistribution module 1320 is used to redistribute sample weights based on the task sequence number identifier corresponding to the current task, and determine the weights of the currently retained samples and the weights of the currently newly added samples; the weights of the currently retained samples are greater than the weights of the currently newly added samples, and the difference between the weights of the currently retained samples and the weights of the currently newly added samples is associated with the task sequence number identifier;
[0121] The retained sample determination module 1330 is used to determine the current retained sample from the historical samples based on the weight of the current retained sample; the historical samples are determined based on the retained sample corresponding to the previous task sequence number, the newly added sample corresponding to the previous task sequence number, and the weight of the previously added sample.
[0122] The model training module 1340 is used to train the historical object recognition model corresponding to the historical samples based on the currently retained samples and the currently added samples, so as to obtain the target object recognition model.
[0123] In some embodiments, the historical samples include target samples corresponding to multiple task number identifiers, and the difference in the number of target samples corresponding to adjacent task number identifiers is the target difference; the target samples corresponding to each task number identifier are a subset of the newly added samples corresponding to each task number identifier; the weight redistribution module includes:
[0124] The target distance determination unit is used to determine the target distance between the newly added sample and the target sample corresponding to the starting task number identifier based on the task number identifier;
[0125] A new difference information determination unit is added, which is used to determine the new weight difference information corresponding to the new sample based on the target distance and target difference.
[0126] The first weight redistribution unit is used to redistribute sample weights based on the newly added weight difference information, the historical weight difference information corresponding to historical samples, and the preset sample size, and to determine the weights of currently retained samples and the weights of currently added samples.
[0127] In some embodiments, the historical samples include target samples corresponding to multiple task sequence numbers, and the target samples corresponding to each task sequence number are a subset of the newly added samples corresponding to each task sequence number. The weight redistribution module includes:
[0128] The update difference determination unit is used to update the difference in the number of samples between target samples with adjacent task number identifiers based on the task number identifier and the preset sample size, so as to obtain the updated difference.
[0129] The second weight redistribution unit is used to redistribute sample weights based on the updated difference and the preset sample size, and to determine the weights of currently retained samples and the weights of currently added samples.
[0130] In some embodiments, the model training module includes:
[0131] The learning rate decay unit is used to perform parameter decay processing on the preset learning rate based on the task number identifier to obtain the target learning rate corresponding to the newly added sample.
[0132] The model training unit is used to train the historical object recognition model based on the currently retained samples and the currently added samples, according to the target learning rate, to obtain the target object recognition model.
[0133] In some embodiments, the model training unit includes:
[0134] The current information determination unit is used to take the target learning rate as the current learning rate and the historical object recognition model as the current training model.
[0135] The model update unit is used to train the current training model based on the currently retained samples and the currently added samples, according to the current learning rate, to obtain the recognition model corresponding to the current training epoch; the current training epoch is the training epoch corresponding to the current learning rate.
[0136] The parameter update unit is used to update the current learning rate based on the current parameter decay information to obtain the learning rate corresponding to the next training round of the current training round.
[0137] The iterative unit is used to repeatedly train the current training model based on the currently retained samples and the currently added samples, according to the current learning rate, to obtain the recognition model corresponding to the current training round, and then update the parameters based on the current parameter decay information to obtain the learning rate corresponding to the next training round, until the training round reaches the preset number of training rounds. The recognition model corresponding to the training round at the preset number of training rounds is then used as the target object recognition model.
[0138] In some embodiments, the model training module further includes:
[0139] The training sample determination unit is used to obtain the training samples corresponding to multiple training rounds respectively; the training samples include a first number of samples obtained from the cached samples and a second number of samples obtained from the remaining samples; the cached samples include newly added cached samples determined from the currently added samples based on the weight of the currently added samples, and currently retained samples; the remaining samples are other samples in the currently added samples excluding the newly added cached samples;
[0140] The object recognition unit is used to input the samples to be trained into the historical object recognition model to perform object recognition and obtain the training recognition results.
[0141] The annotation information training unit is used to train the historical object recognition model according to the target learning rate based on the training recognition results and the sample annotation information corresponding to the sample to be trained, so as to obtain the target object recognition model.
[0142] This application also provides an object recognition device; please refer to [link to relevant documentation]. Figure 14 The device includes:
[0143] The object information acquisition module 1410 is used to acquire object information of the object to be identified.
[0144] The object recognition module 1420 is used to input the object information of the object to be recognized into the target object recognition model generated based on the object recognition model generation method described above, and to obtain the object recognition result corresponding to the object to be recognized.
[0145] The apparatus provided in the above embodiments can execute the methods provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be found in the object recognition model generation method or object recognition method provided in any embodiment of this application.
[0146] This embodiment also provides a computer-readable storage medium storing computer-executable instructions, which are loaded by a processor and executed by the object recognition model generation method or object recognition method described above in this embodiment.
[0147] This embodiment also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods or object recognition methods provided in various optional implementations of the above-described object recognition model.
[0148] This embodiment also provides an electronic device, which includes a processor and a memory, wherein the memory stores a computer program adapted to be loaded by the processor and executed by the processor to generate the object recognition model or object recognition method described above in this embodiment.
[0149] The device may be a computer terminal, a mobile terminal, or a server, and may also participate in constituting the apparatus or system provided in the embodiments of this application. For example... Figure 15 As shown, server 15 may include one or more processors 1502 (shown as 1502a, 1502b, ..., 1502n in the figure) (processor 1502 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPLD, etc.), a memory 1504 for storing data, and a transmission device 1506 for communication functions. In addition, it may also include: input / output interfaces (I / O interfaces) and network interfaces. Those skilled in the art will understand that... Figure 15 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 15 may also include... Figure 15 The more or fewer components shown, or having the same Figure 15 The different configurations shown.
[0150] It should be noted that the aforementioned one or more processors 1502 and / or other data processing circuitry are generally referred to herein as "data processing circuitry". This data processing circuitry may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the server 15.
[0151] The memory 1504 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method described in the embodiments of this application. The processor 1502 executes various functional applications and data processing by running the software programs and modules stored in the memory 1504, thereby realizing the above-described method for generating temporal behavior capture boxes based on self-attention networks. The memory 1504 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1504 may further include memory remotely located relative to the processor 1502, and these remote memories can be connected to the server 15 via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0152] The transmission device 1506 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 15. In one example, the transmission device 1506 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 1506 may be a Radio Frequency (RF) module for wireless communication with the Internet.
[0153] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but more or fewer operational steps may be included based on conventional or non-inventive labor. The steps and order listed in the embodiments are merely one possible execution order among many steps and do not represent the only execution order. In actual system or interrupt product execution, the methods shown in the embodiments or drawings can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment).
[0154] The structure shown in this embodiment is only a partial structure related to the solution of this application and does not constitute a limitation on the device to which the solution of this application is applied. Specific devices may include more or fewer components than shown, or combinations of certain components, or arrangements of different components. It should be understood that the methods, apparatuses, etc., disclosed in this embodiment can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or unit modules through some interfaces.
[0155] Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0156] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0157] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for generating an object recognition model, characterized in that, The method includes: Obtain the currently added sample corresponding to the current task; the currently added sample is determined based on the newly added recognition type of the target object, and the currently added sample is the image information corresponding to the newly added recognition type of the target object; Based on the task sequence number identifier corresponding to the current task, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently newly added samples. The weight of the currently retained samples is greater than the weight of the currently newly added samples. The difference between the weight of the currently retained samples and the weight of the currently newly added samples is associated with the task sequence number identifier. The weight redistribution is based on a target difference or an update difference. The target difference is the difference in the number of target samples corresponding to adjacent task sequence number identifiers. The target samples corresponding to each task sequence number identifier are a portion of the newly added samples corresponding to each task sequence number identifier. The update difference is obtained by updating the difference in the number of target samples between adjacent task sequence number identifiers based on the task sequence number identifier and a preset sample size. Based on the weight of the currently retained sample, the current retained sample is determined from the historical samples; the historical samples are determined based on the retained sample corresponding to the previous task sequence number, the newly added sample corresponding to the previous task sequence number, and the weight of the previously added sample. Based on the currently retained samples and the currently newly added samples, the historical object recognition model corresponding to the historical samples is trained to obtain the target object recognition model.
2. The method for generating an object recognition model according to claim 1, characterized in that, The historical samples include target samples corresponding to multiple task number identifiers, and the difference in the number of target samples corresponding to adjacent task number identifiers is the target difference; the target samples corresponding to each task number identifier are a portion of the newly added samples corresponding to each task number identifier. The step of redistributing sample weights based on the task sequence number identifier corresponding to the current task, and determining the weights of currently retained samples and newly added samples, includes: Based on the task sequence number identifier, determine the target distance between the newly added sample and the target sample corresponding to the starting task sequence number identifier; Based on the target distance and the target difference, determine the new weight difference information corresponding to the new sample; Based on the newly added weight difference information, the historical weight difference information corresponding to the historical samples, and the preset sample size, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the currently newly added samples.
3. The method for generating an object recognition model according to claim 1, characterized in that, The historical samples include target samples corresponding to multiple task sequence numbers. The target samples corresponding to each task sequence number are a subset of the newly added samples corresponding to each task sequence number. The step of redistributing sample weights based on the task sequence number corresponding to the current task to determine the weights of currently retained samples and currently added samples includes: Based on the task number identifier and the preset sample size, the difference in the number of samples between target samples with adjacent task number identifiers is updated to obtain the updated difference. Based on the updated difference and the preset sample size, the sample weights are redistributed to determine the weights of the currently retained samples and the weights of the newly added samples.
4. The method for generating an object recognition model according to claim 1, characterized in that, The step of training the historical object recognition model corresponding to the historical samples based on the currently retained samples and the currently added samples to obtain the target object recognition model includes: Based on the task number identifier, the preset learning rate is subjected to parameter decay processing to obtain the target learning rate corresponding to the currently added sample; Based on the currently retained samples and the currently newly added samples, the historical object recognition model is trained according to the target learning rate to obtain the target object recognition model.
5. The method for generating an object recognition model according to claim 4, characterized in that, The step of training the historical object recognition model based on the currently retained samples and the currently newly added samples, according to the target learning rate, to obtain the target object recognition model includes: The target learning rate is used as the current learning rate, and the historical object recognition model is used as the current training model. Based on the currently retained samples and the currently added samples, the current training model is trained according to the current learning rate to obtain the recognition model corresponding to the current training round; the current training round is the training round corresponding to the current learning rate. Based on the current parameter decay information, the current learning rate is updated to obtain the learning rate corresponding to the next training round of the current training round. The process of training the current training model based on the currently retained samples and the currently added samples, according to the current learning rate, to obtain the recognition model corresponding to the current training round, and then updating the current learning rate based on the current parameter decay information to obtain the learning rate corresponding to the next training round, is repeated until the training rounds reach a preset number of training rounds. The recognition model corresponding to the training round that reaches the preset number of training rounds is then used as the target object recognition model.
6. The method for generating an object recognition model according to any one of claims 1 to 5, characterized in that, The step of training the historical object recognition model corresponding to the historical samples based on the currently retained samples and the currently added samples to obtain the target object recognition model further includes: Obtain training samples corresponding to multiple training rounds respectively; the training samples include a first number of samples obtained from the cached samples and a second number of samples obtained from the remaining samples; the cached samples include newly added cached samples determined from the currently added samples based on the weight of the currently added samples, and the currently retained samples; the remaining samples are other samples in the currently added samples except for the newly added cached samples; The training samples are input into the historical object recognition model to perform object recognition, and the training recognition results are obtained. Based on the training recognition results and the sample annotation information corresponding to the sample to be trained, the historical object recognition model is trained according to the target learning rate to obtain the target object recognition model.
7. An object recognition method, characterized in that, The method includes: Obtain object information of the object to be identified, wherein the object information is image information or video information; The object information is input into the target object recognition model generated by the object recognition model generation method according to any one of claims 1 to 6, and the object recognition result corresponding to the object to be recognized is obtained.
8. An apparatus for generating an object recognition model, characterized in that, The device includes: The newly added sample acquisition module is used to acquire the currently added sample corresponding to the current task; the currently added sample is determined based on the newly added recognition type of the target object, and the currently added sample is the image information corresponding to the newly added recognition type of the target object; The weight redistribution module is used to redistribute sample weights based on the task sequence number identifier corresponding to the current task, and determine the weights of currently retained samples and currently added samples. The weights of currently retained samples are greater than the weights of currently added samples. The difference between the weights of currently retained samples and currently added samples is associated with the task sequence number identifier. The weight redistribution is based on a target difference or an update difference. The target difference is the difference in the number of target samples corresponding to adjacent task sequence number identifiers. The target samples corresponding to each task sequence number identifier are a subset of the newly added samples corresponding to each task sequence number identifier. The update difference is obtained by updating the difference in the number of target samples between adjacent task sequence number identifiers based on the task sequence number identifier and a preset sample size. The retained sample determination module is used to determine the current retained sample from the historical samples based on the weight of the current retained sample; the historical samples are determined based on the retained sample corresponding to the previous task sequence number, the newly added sample corresponding to the previous task sequence number, and the weight of the previously added sample; The model training module is used to train the historical object recognition model corresponding to the historical sample based on the currently retained sample and the currently added sample, so as to obtain the target object recognition model.
9. An object recognition device, characterized in that, The device includes: The object information acquisition module is used to acquire object information of the object to be identified, wherein the object information is image information or video information; An object recognition module is used to input the object information into a target object recognition model generated based on the object recognition model generation method according to any one of claims 1 to 6, and to obtain the object recognition result corresponding to the object to be recognized.
10. An electronic device, characterized in that, The electronic device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement a method for generating an object recognition model as described in any one of claims 1-6 or an object recognition method as described in claim 7.
11. A computer-readable storage medium, characterized in that, The storage medium includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the object recognition model generation method as described in any one of claims 1-6 or the object recognition method as described in claim 7.
Citation Information
Patent Citations
Sample selection method and device, storage medium and electronic equipment
CN111881973A
Production bottleneck prediction method based on incremental simple cycle unit and double attention
CN114154820A