An object recognition method, apparatus, device, and storage medium
By using fine-tuning techniques based on transfer learning, the basic recognition model is updated using training data of newly added objects. This solves the problem of excessively long training time when adding new objects, and achieves efficient recognition of both historical and newly added objects, overcoming the shortcomings of data isolation and low training efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI IFLY DIGITAL TECH CO LTD
- Filing Date
- 2022-07-13
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies take too long to retrain the recognition model when adding new objects, resulting in low efficiency, especially when the amount of data is huge. In addition, in some fields, the data of historical objects and new objects cannot be mixed for training.
We employ a fine-tuning technique based on transfer learning, using training data from newly added objects to update the parameters of the basic recognition model. We train the model using cross-entropy loss and probability distribution consistency loss, updating the model only with training data from newly added objects, and freezing the parameters of the basic model.
It shortens the training time, ensures accurate identification of historical and new objects, avoids slow training speed and data isolation problems caused by excessive data volume, and reduces the decline in the recognition effect of historical objects.
Smart Images

Figure CN115204287B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of object recognition technology, and in particular to an object recognition method, apparatus, device, and storage medium. Background Technology
[0002] In the field of object recognition, it is necessary to identify the object to which the target data belongs. For example, in the field of electromagnetic entity recognition, it is necessary to identify the electromagnetic entity to which the target electromagnetic data belongs, that is, to determine which electromagnetic entity among several electromagnetic entities the target electromagnetic data belongs to. Current object recognition schemes are mainly based on recognition models. That is, a recognition model is trained in advance using training samples labeled with object identifiers for each object, and then the trained recognition model is used to identify the object to which the target data belongs.
[0003] In certain object recognition fields, new objects may constantly emerge, resulting in new object data. For example, in the field of electromagnetic individual recognition, new electromagnetic individuals are constantly being deployed, generating electromagnetic data for these new individuals. When a new object appears, in order to accurately identify both the data of historical objects (objects before the new object) and the data of the new object, the current approach is to mix the training data of existing objects with the training data of the new object and retrain the recognition model.
[0004] However, as new objects are continuously generated, the amount of training data increases constantly, and training a model using such a massive amount of training data is extremely time-consuming. Therefore, although the above solution can solve the problem of identifying newly added objects, its efficiency is very low. Summary of the Invention
[0005] In view of this, the present invention provides an object recognition method, apparatus, device, and storage medium to solve the problem that when a new object is added, the training data of the existing object and the training data of the new object are mixed together to retrain the recognition model, which results in extremely time-consuming training due to the huge amount of data. The technical solution is as follows:
[0006] An object recognition method, comprising:
[0007] Acquire target data, which is the data to be identified of an object in an object set, the object set including historical objects and newly added objects;
[0008] Based on a pre-trained target recognition model, the object to which the target data belongs is identified; wherein:
[0009] The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample.
[0010] The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
[0011] Optionally, identifying the object to which the target data belongs based on the pre-trained target recognition model includes:
[0012] Based on the target recognition model, the probability that the object identifier of the target data is each object identifier in the object identifier set is predicted, wherein the object identifier set includes the object identifiers corresponding to each object in the object set;
[0013] The object to which the target data belongs is determined based on the probability that the object identifier of the target data is each object identifier in the object identifier set.
[0014] Optionally, the initial target recognition model is obtained by replicating the base recognition model, and the training process of the target recognition model includes:
[0015] Based on the target recognition model and the basic recognition model respectively, the probability that the object identifier of the first training sample is each object identifier in the object identifier set is predicted, resulting in a first probability distribution and a second probability distribution. The first probability distribution is the probability distribution predicted by the target recognition model for the first training sample, and the second probability distribution is the probability distribution predicted by the basic recognition model for the first training sample. The object identifier set includes the object identifiers corresponding to each object in the object set.
[0016] Based on the first probability distribution, the second probability distribution, and the object identifiers labeled on the first training sample, a first prediction loss and a second prediction loss are determined. The first prediction loss can characterize the similarity between the first probability distribution and the true probability distribution corresponding to the first training sample, and the second prediction loss can characterize the difference between the first probability distribution and the second probability distribution. The true probability distribution is determined by the object identifiers labeled on the corresponding first training sample.
[0017] The target recognition model is updated based on the first prediction loss and the second prediction loss.
[0018] Optionally, determining the first prediction loss and the second prediction loss based on the first probability distribution, the second probability distribution, and the object identifiers labeled in the first training samples includes:
[0019] Calculate the cross-entropy loss between the first probability distribution and the object identifier labeled in the first training sample, and use it as the first prediction loss;
[0020] Calculate the distance between the first probability distribution and the second probability distribution, and use it as the second prediction loss.
[0021] Optionally, the target recognition model includes: hidden layers and fully connected layers;
[0022] The step of updating the parameters of the target recognition model based on the first prediction loss and the second prediction loss includes:
[0023] Based on the first prediction loss and the second prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
[0024] Optionally, updating the parameters of the fully connected layer of the target recognition model based on the first prediction loss and the second prediction loss includes:
[0025] The first prediction loss and the second prediction loss are combined to obtain the total prediction loss;
[0026] Based on the total prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
[0027] Optionally, the target data is electromagnetic data, the objects in the object set are electromagnetic individuals, and the target recognition model is an electromagnetic individual recognition model;
[0028] or,
[0029] The target data is voice data, the objects in the object set are speakers, and the target recognition model is a speaker recognition model.
[0030] An object recognition device includes: a data acquisition module and an object recognition module;
[0031] The data acquisition module is used to acquire target data, which is the data to be identified of an object in an object set, and the object set includes historical objects and newly added objects.
[0032] The object recognition module is used to identify the object to which the target data belongs based on a pre-trained target recognition model; wherein:
[0033] The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample.
[0034] The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
[0035] An object recognition device includes: a memory and a processor;
[0036] The memory is used to store programs;
[0037] The processor is configured to execute the program to implement each step of the object recognition method described above.
[0038] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the object recognition method described in any of the preceding claims.
[0039] The object recognition method, apparatus, device, and storage medium provided by this invention can identify the object to which the target data belongs based on a pre-trained target recognition model after obtaining the target data. Since the target recognition model is trained only on the training data of newly added objects, the training time will be greatly shortened compared to retraining the recognition model by mixing the training data of historical objects with the training data of newly added objects. Because the target recognition model is trained with the goal of making the object identifier predicted by the training samples of newly added objects consistent with the object identifier labeled by the training samples of newly added objects, and making the probability distribution predicted by the training samples of newly added objects approximate the probability distribution predicted by the basic recognition model for the training samples of newly added objects, it can accurately identify the object to which the data of newly added objects belongs, as well as the object to which the data of historical objects belongs. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0041] Figure 1 This is a schematic diagram of the hardware architecture involved in the present invention;
[0042] Figure 2 A flowchart illustrating the object recognition method provided in an embodiment of the present invention;
[0043] Figure 3 A flowchart illustrating the training process of the target recognition model provided in an embodiment of the present invention;
[0044] Figure 4 A schematic diagram illustrating the training process of the target recognition model provided in an embodiment of the present invention;
[0045] Figure 5 This is a schematic diagram of the structure of the object recognition device provided in an embodiment of the present invention;
[0046] Figure 6 This is a schematic diagram of the structure of an object recognition device provided in an embodiment of the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] In situations where new objects are added to the object recognition field, a common and relatively simple approach to accurately identify both historical and new object data is to mix the training data of historical objects with the training data of new objects and retrain the recognition model.
[0050] While retraining the recognition model can solve the problem of recognizing new data (data on new objects), this method is extremely inefficient, greatly hindering the model from learning new data in real time. Furthermore, as the data volume increases, the demands on time and space also increase rapidly, ultimately causing the learning speed to lag behind the data update speed. In addition, in certain specific domains, the data of different business units are physically isolated from each other, making it impossible to mix the training data of historical objects with the training data of new objects.
[0051] In response to the problems existing in the current solution, the inventors of this case conducted research. The initial idea was to use fine-tuning technology based on the idea of transfer learning to incrementally learn the recognition model and gradually update the model.
[0052] Specifically, based on fine-tuning technology, the parameters of the basic recognition model (which is a recognition model trained using training data from historical objects) are updated using training data from newly added objects. When updating the parameters of the basic recognition model using training data from newly added objects, the inventors devised two approaches: first, fine-tuning all parameters of the basic recognition model using the training data from newly added objects, in which case the learning rate needs to be set very small; second, fixing most of the parameters of the basic recognition model and only fine-tuning the parameters of the last few layers of the basic recognition model using the training data from newly added objects. Both approaches are based on the cross-entropy loss between the probability distribution predicted by the model for the training samples of newly added objects and the object identifiers labeled on the training samples of newly added objects for parameter updates.
[0053] The above solution effectively addresses the problem of excessive training data volume and the physical isolation of data between different business units because it only requires training data from newly added objects and does not need to utilize training data from historical objects. However, the above solution has a fatal flaw:
[0054] For example, the updated Model 1, obtained by fine-tuning the basic recognition model using the training data of the newly added object 1, can better guarantee the recognition effect on the data of the newly added object 1 and the data of historical objects. However, when a new object 2 is added after the newly added object 1, the updated Model 2, obtained by fine-tuning the updated Model 1 using the training data of the newly added object 2, will have a significant decrease in the recognition effect on the data of historical objects (here, historical objects refer to objects before the newly added object 2, i.e., the newly added object 1 and the objects before the newly added object 1 mentioned above). In particular, the recognition effect on the data of the newly added object 1 will drop sharply. The above scheme will cause catastrophic forgetting of the data of the previously added objects when iterating and optimizing with multiple new data. The reason for this is that when fine-tuning for the first time, the operation of setting a small learning and freezing some parameters can better guarantee the recognition rate of the data of historical objects. However, since fine-tuning does not take into account the situation of multiple iterations, the model will deviate more and more from the basic recognition model with multiple fine-tunings, which will lead to a significant decrease in the recognition rate of the data of historical objects.
[0055] In view of the problems with the above approach, the inventors of this case conducted further research and, through continuous research, finally proposed a more effective object recognition method. This object recognition scheme perfectly overcomes the shortcomings of the above approach.
[0056] Before introducing the object recognition method provided by this invention, the hardware architecture involved in this invention will be described first.
[0057] In one possible implementation, such as Figure 1 As shown, the hardware architecture involved in this invention may include: electronic device 101 and server 102.
[0058] For example, electronic device 101 can be any electronic product that can interact with a user, such as a PC, laptop, tablet, handheld computer, PAD, etc.
[0059] It should be noted that, Figure 1 This is just one example; there can be many types of electronic devices, not limited to... Figure 1 The laptop in the middle.
[0060] For example, server 102 can be a single server, a server cluster consisting of multiple servers, or a cloud computing server center. Server 102 may include processors, memory, and network interfaces, etc.
[0061] For example, electronic device 101 can establish a connection and communicate with server 102 through a wireless communication network; for example, electronic device 101 can establish a connection and communicate with server 102 through a wired communication network.
[0062] Electronic device 101 can acquire target data (i.e. data to be identified) and send the target data to server 102. Server 102 identifies the object to which the target data belongs according to the object identification method provided by the present invention and sends the identification result to electronic device 101.
[0063] In another possible implementation, the hardware architecture involved in this invention may include an electronic device. The electronic device is an electronic product with strong data processing capabilities, such as a PC, laptop, or mobile phone. The electronic device identifies the object to which the target data belongs according to the object recognition method provided by this invention.
[0064] Those skilled in the art should understand that the above-described electronic devices and servers are merely examples, and other existing or future electronic devices or servers that are applicable to this invention should also be included within the scope of protection of this invention, and are hereby incorporated by reference.
[0065] The object recognition method provided by the present invention will be described in the following embodiments.
[0066] First Embodiment
[0067] Please see Figure 2 The diagram illustrates a flowchart of an object recognition method provided in an embodiment of the present invention, which may include:
[0068] Step S201: Obtain target data.
[0069] The target data is the identification data of an object in a set of objects in a specified domain. The set of objects includes historical objects and newly added objects. Newly added objects are those added after the historical objects. The specified domain can be, but is not limited to, the electromagnetic individual identification domain, the speaker identification domain, etc.
[0070] For example, if the specified domain is the electromagnetic individual identification domain, then the object set is the electromagnetic individual set, which includes historical electromagnetic individuals and newly added electromagnetic individuals. The newly added electromagnetic individuals are those added after the historical electromagnetic individuals, and the target data is the electromagnetic data of an electromagnetic individual in the electromagnetic individual set.
[0071] For example, if the specified domain is speaker recognition, then the object set is the speaker set, which includes historical speakers and newly added speakers. The newly added speaker is the speaker added after the historical speaker, and the target data is the voice data of a speaker in the speaker set.
[0072] Step S202: Based on the pre-trained target recognition model, identify the object to which the target data belongs.
[0073] For example, if the specified domain can be the electromagnetic individual identification domain, then the target identification model is the electromagnetic individual identification model. The target identification model obtained through pre-training identifies the object to which the target data belongs, that is, the electromagnetic individual to which the target data belongs is identified based on the electromagnetic individual obtained through pre-training.
[0074] For example, if the specified domain is speaker recognition, then the target recognition model is a speaker recognition model. The target recognition model is used to identify the object to which the target data belongs, that is, to identify the speaker to which the target data belongs.
[0075] Optionally, the target recognition model may use LSTM. Of course, this embodiment is not limited to this. For example, the target recognition model may also use CNN. This embodiment does not limit the specific form of the target recognition model.
[0076] In this embodiment, the target recognition model is trained using a first training sample labeled with object identifiers for newly added objects. The object identifiers labeled on the first training samples are the object identifiers corresponding to the objects to which the first training samples belong, and these object identifiers can uniquely identify the corresponding objects.
[0077] The training objectives of the target recognition model in this embodiment include a first objective and a second objective. The first objective is to make the object identifiers predicted by the target recognition model for the first training sample consistent with the object identifiers labeled in the first training sample, and to make the probability distribution predicted by the target recognition model for the first training sample consistent with the probability distribution predicted by the base recognition model for the first training sample. The probability distribution predicted for the first training sample refers to the probability distribution of the first training sample on the object identifiers corresponding to each object in the object set.
[0078] The object identifier set includes object identifiers corresponding to each object in the object set, and each object identifier uniquely identifies the corresponding object. For example, if the specified domain is electromagnetic individual identification, then the object identifier set is an electromagnetic individual identifier set, which includes electromagnetic individual identifiers corresponding to each electromagnetic individual in the electromagnetic individual set; similarly, if the specified domain is speaker identification, then the object identifier set is a speaker identifier set, which includes speaker identifiers corresponding to each speaker in the speaker set.
[0079] It should be noted that the basic recognition model described above is trained using second training samples of historical objects labeled with object identifiers. The initial target recognition model is a model capable of recognizing historical object data. Optionally, the initial target recognition model can be obtained by replicating the basic recognition model, that is, the target recognition model is trained using first training samples of newly added objects labeled with object identifiers.
[0080] It should also be noted that the first objective mentioned above is to enable the target recognition model to accurately predict the object to which the data of newly added objects belong, while the second objective mentioned above is to ensure that the target recognition model does not deviate from the basic recognition model and can accurately predict the object to which the data of historical objects belong.
[0081] In this embodiment, the process of identifying the object to which the target data belongs, based on a pre-trained target recognition model, may include:
[0082] Step S2021: Based on the target recognition model, predict the probability that the object identifier of the target data is each object identifier in the object identifier set.
[0083] Specifically, the target data is input into the target recognition model, which processes the input data and outputs the object identifier of the target data as the probability of each object identifier in the object identifier set.
[0084] Step S2022: Determine the object to which the target data belongs based on the probability of each object identifier in the object identifier set.
[0085] Specifically, the object with the highest probability output by the target recognition model can be identified as the object to which the target data belongs.
[0086] The object recognition method provided in this embodiment of the invention can identify the object to which the target data belongs based on a pre-trained object recognition model after obtaining the target data. Since the object recognition model is trained only on the training data of the newly added object, the training time will be greatly shortened compared to retraining the recognition model by mixing the training data of historical objects with the training data of the newly added object. The object recognition model is trained with the goal of making the object identifier predicted by the training samples of the newly added object consistent with the object identifier labeled by the training samples of the newly added object, and making the probability distribution predicted by the training samples of the newly added object approximate the probability distribution predicted by the basic recognition model for the training samples of the newly added object. Therefore, the object recognition model based on the trained object recognition model can accurately identify the object to which the data of the newly added object belongs, as well as the object to which the data of the historical object belongs.
[0087] Second Embodiment
[0088] As mentioned in the above embodiments, the target recognition model is obtained by using the first training sample of the newly added object labeled with the object identifier, and at the same time by training the basic recognition model. This embodiment introduces the training process of the target recognition model.
[0089] Please see Figure 3 The diagram illustrates the training process of the target recognition model, which may include:
[0090] Step S301: Obtain the first training sample from the first training set.
[0091] The first training set includes multiple first training samples of newly added objects.
[0092] In each iteration of training, one training sample can be obtained from the first training sample set for training. To improve training efficiency, preferably, N (N greater than or equal to 2) training samples can be obtained from the first training sample set for training. The specific value of N can be determined according to the specific situation. The following will use the example of obtaining N first training samples from the first training sample set for introduction.
[0093] Step S302a: Based on the target recognition model, predict the probability that the object identifier of the first training sample is each object identifier in the object identifier set, and obtain the probability distribution predicted by the target recognition model for the first training sample, which is used as the first probability distribution.
[0094] If N first training samples are obtained from the first training set, the probability that the object identifier of each first training sample is the object identifier in the object identifier set is predicted based on the target recognition model, and the probability distribution predicted by the target recognition model for each of the N first training samples is obtained.
[0095] Specifically, for each first training sample, such as Figure 4 As shown, the input is processed by the target recognition model to obtain the probability that the object identifier of the first training sample is each object identifier in the object identifier set. The probability predicted by the target recognition model for the i-th first training sample out of N first training samples can be expressed as p ic (x), i = 1, 2, ..., N; c = 1, 2, ..., M, where M is the total number of objects in the object set.
[0096] Step S302b: Based on the basic recognition model, predict the probability that the object identifier of the first training sample is each object identifier in the object identifier set, and obtain the probability distribution predicted by the basic recognition model for the first training sample, which is used as the second probability distribution.
[0097] If step S301 obtains N first training samples from the first training sample set, then based on the basic recognition model, the probability that the object identifier of each obtained first training sample is the object identifier in the object identifier set is predicted, thus obtaining the probability distribution predicted by the basic recognition model for each of the N first training samples.
[0098] Specifically, for each first training sample, such as Figure 4 As shown, the input is processed by the basic recognition model to obtain the probability that the object identifier of the first training sample is one of the object identifiers in the object identifier set. The probability predicted by the basic recognition model for the i-th first training sample out of N first training samples can be expressed as q. ic (x),i=1,2…,N,c=1,2…M.
[0099] Step S303a: Based on the first probability distribution and the object identifiers labeled on the first training samples, determine a first prediction loss that can characterize the similarity between the first probability distribution and the true probability distribution corresponding to the first training samples.
[0100] In this embodiment, the first prediction loss characterizes the similarity between the probability distribution predicted by the target recognition model for the first training sample and the true probability distribution corresponding to the first training sample. For example, the object identifier set includes object identifier 1, object identifier 2, object identifier 3, and object identifier 4. The probability distribution predicted by the target recognition model for a first training sample is {0.3, 0.5, 0.1, 0.1}, the object identifier labeled in the first training sample is object identifier 2, and the true probability distribution corresponding to the first training sample is {0, 1, 0, 0}. Therefore, the first prediction loss determined based on the predicted probability distribution {0.3, 0.5, 0.1, 0.1} and the true probability distribution {0, 1, 0, 0} characterizes the similarity between the predicted probability distribution {0.3, 0.5, 0.1, 0.1} and the true probability distribution {0, 1, 0, 0}.
[0101] Optional, such as Figure 4 As shown, the cross-entropy loss CE between the probability distribution predicted by the target recognition model for the first training sample and the object identifier labeled on the first training sample can be calculated. loss As the first prediction loss, the cross-entropy loss CE loss The calculation method is as follows:
[0102]
[0103] Among them, y ic (x) is the sign function. If the object identifier labeled in the i-th first training sample out of N first training samples is the c-th object identifier out of M object identifiers, then y icThe value of (x) is 1; otherwise, y ic The value of (x) is 0.
[0104] Step S303b: Determine a second prediction loss that can characterize the difference between the first probability distribution and the second probability distribution based on the first probability distribution and the second probability distribution.
[0105] Optional, such as Figure 4 As shown, the distance between the first probability distribution and the second probability distribution can be calculated, i.e., the consistency loss between the first probability distribution and the second probability distribution. loss , as the second predicted loss.
[0106] Optionally, the consistency loss between the first probability distribution and the second probability distribution. loss It can be calculated as follows:
[0107]
[0108] Step S304: Update the parameters of the target recognition model based on the first prediction loss and the second prediction loss.
[0109] It should be noted that the first prediction loss is used to ensure the accuracy of the target recognition model in recognizing newly added object data, while the second prediction loss is used to ensure that the deviation between the target recognition model and the basic recognition model is not too large, thereby ensuring the accuracy of the target recognition model in recognizing historical object data.
[0110] Specifically, the process of updating the parameters of the target recognition model based on the first prediction loss and the second prediction loss can include:
[0111] Step S3041: Combine the first prediction loss and the second prediction loss to obtain the total prediction loss.
[0112] Optionally, the first prediction loss and the second prediction loss can be directly summed to obtain the total prediction loss (Loss):
[0113] Loss=CE loss +Consistency loss (3)
[0114] Besides directly summing the first and second predicted losses, other methods can be used to fuse the first and second predicted losses. For example, the first and second predicted losses can be weighted and summed according to a set weight.
[0115] Step S3042: Update the parameters of the target recognition model based on the total prediction loss.
[0116] Optionally, the object recognition model may include hidden layers and fully connected layers. When updating the parameters of the object recognition model based on the total prediction loss, only the parameters of the fully connected layers may be updated. Since only the parameters of the fully connected layers are updated, the parameters of other parts are frozen during training. Furthermore, since a fine-tuning strategy is used, the learning rate needs to be set relatively small.
[0117] It should be noted that during the entire training process, only the parameters of the target recognition model are updated, while the parameters of the base recognition model are not updated. In other words, the parameters of the base recognition model are frozen. The base recognition model is only used to assist the training of the target recognition model, so that the target recognition model does not deviate from the base recognition model, thereby ensuring the target recognition model's recognition performance on historical object data.
[0118] The target recognition model is trained iteratively multiple times according to the process of steps S301 to S304 above until the training termination condition is met (such as reaching the preset number of training times, or the model converges).
[0119] The above training method enables the training of a target recognition model that can effectively recognize both new and historical objects using only the training data of the newly added objects.
[0120] Assuming the newly added object is Object 1, if Object 2 is subsequently added, the target recognition model trained using the training data of Object 1 will be used as the base recognition model. The training data of Object 2 will then be used for further training in the same manner. This training will result in a target recognition model that demonstrates good recognition performance for both Object 2 and historical objects (objects preceding Object 2). Similarly, if Object 3 is subsequently added, the target recognition model trained using the training data of Object 2 will be used as the base recognition model. The training data of Object 3 will then be used for further training in the same manner, and so on. Because the model training aims to make the predicted object identifiers for the training samples consistent with the labeled object identifiers, and to make the probability distribution predicted for the training samples approximate the probability distribution predicted by the base recognition model for the training samples, the recognition performance for both newly added and historical object data can be guaranteed regardless of the number of training rounds.
[0121] Third Embodiment
[0122] This invention also provides an object recognition device. The object recognition device provided in this invention will be described below. The object recognition device described below can be referred to in correspondence with the object recognition method described above.
[0123] Please see Figure 5The diagram shows a structural schematic of an object recognition device provided in an embodiment of the present invention, which may include a data acquisition module 501 and an object recognition module 502.
[0124] The data acquisition module 501 is used to acquire target data.
[0125] The target data is the data to be identified for an object in the object set, which includes historical objects and newly added objects. The newly added objects are those added after the historical objects.
[0126] The object recognition module 502 is used to identify the object to which the target data belongs based on a pre-trained target recognition model.
[0127] The target recognition model is trained using a first training sample labeled with object identifiers of the newly added object. The training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled on the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the base recognition model for the first training sample.
[0128] Wherein, the probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of historical objects.
[0129] Optionally, the object recognition module 502 includes a probability prediction module and an object determination module.
[0130] The probability prediction module is used to predict the probability that the object identifier of the target data is each object identifier in the object identifier set, based on the target recognition model.
[0131] The object identifier set includes the object identifiers corresponding to each object in the object set.
[0132] The object determination module is used to determine the object to which the target data belongs based on the probability that the object identifier of the target data is each object identifier in the object identifier set.
[0133] Optionally, the initial target recognition model is obtained by replicating the base recognition model.
[0134] The object recognition device provided in this embodiment of the invention may further include: a model training module. The model training module is used to train the object recognition model.
[0135] The model training module is specifically used for training the object recognition model:
[0136] Based on the target recognition model and the basic recognition model respectively, the probability that the object identifier of the first training sample is each object identifier in the object identifier set is predicted, resulting in a first probability distribution and a second probability distribution. The first probability distribution is the probability distribution predicted by the target recognition model for the first training sample, and the second probability distribution is the probability distribution predicted by the basic recognition model for the first training sample. The object identifier set includes the object identifiers corresponding to each object in the object set.
[0137] Based on the first probability distribution, the second probability distribution, and the object identifiers labeled on the first training sample, a first prediction loss and a second prediction loss are determined. The first prediction loss can characterize the similarity between the first probability distribution and the true probability distribution corresponding to the first training sample, and the second prediction loss can characterize the difference between the first probability distribution and the second probability distribution. The true probability distribution is determined by the object identifiers labeled on the corresponding first training sample.
[0138] The target recognition model is updated based on the first prediction loss and the second prediction loss.
[0139] Optionally, when determining the first prediction loss and the second prediction loss based on the first probability distribution, the second probability distribution, and the object identifiers labeled in the first training samples, the model training module is specifically used for:
[0140] Calculate the cross-entropy loss between the first probability distribution and the object identifier labeled in the first training sample, and use it as the first prediction loss;
[0141] Calculate the distance between the first probability distribution and the second probability distribution, and use it as the second prediction loss.
[0142] Optionally, the target recognition model includes: hidden layers and fully connected layers;
[0143] When updating the parameters of the target recognition model based on the first prediction loss and the second prediction loss, the model training module is specifically used for:
[0144] Based on the first prediction loss and the second prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
[0145] Optionally, when the model training module updates the parameters of the fully connected layer of the target recognition model based on the first prediction loss and the second prediction loss, it is specifically used for:
[0146] The first prediction loss and the second prediction loss are combined to obtain the total prediction loss;
[0147] Based on the total prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
[0148] Optionally, the target data is electromagnetic data, the objects in the object set are electromagnetic individuals, and the target recognition model is an electromagnetic individual recognition model;
[0149] Alternatively, the target data may be speech data, the objects in the object set may be speakers, and the target recognition model may be a speaker recognition model.
[0150] The object recognition device provided in this embodiment of the invention can identify the object to which the target data belongs based on a pre-trained target recognition model after obtaining target data. Since the target recognition model is trained only on the training data of newly added objects, the training time will be greatly shortened compared to retraining the recognition model by mixing the training data of historical objects with the training data of newly added objects. The target recognition model is trained with the goal of making the object identifier predicted by the training samples of newly added objects consistent with the object identifier labeled by the training samples of newly added objects, and making the probability distribution predicted by the training samples of newly added objects approximate the probability distribution predicted by the basic recognition model for the training samples of newly added objects. Therefore, the target recognition model based on the trained model can accurately identify the object to which the data of newly added objects belongs, and can also accurately identify the object to which the data of historical objects belongs.
[0151] Fourth embodiment
[0152] This invention also provides an object recognition device; please refer to [link to relevant documentation]. Figure 6 The diagram shows the structure of the object recognition device, which may include: at least one processor 601, at least one communication interface 602, at least one memory 603 and at least one communication bus 604.
[0153] In this embodiment of the invention, the number of processor 601, communication interface 602, memory 603, and communication bus 604 is at least one, and processor 601, communication interface 602, and memory 603 communicate with each other through communication bus 604.
[0154] The processor 601 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
[0155] The memory 603 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;
[0156] The memory stores a program, which the processor can call. The program is used for:
[0157] Acquire target data, which is the data to be identified of an object in an object set, the object set including historical objects and newly added objects;
[0158] Based on a pre-trained target recognition model, the object to which the target data belongs is identified; wherein:
[0159] The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample.
[0160] The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
[0161] Optionally, the refined and extended functions of the program can be found in the description above.
[0162] Fifth embodiment
[0163] This invention also provides a readable storage medium that stores a program suitable for execution by a processor, the program being used for:
[0164] Acquire target data, which is the data to be identified of an object in an object set, the object set including historical objects and newly added objects;
[0165] Based on a pre-trained target recognition model, the object to which the target data belongs is identified; wherein:
[0166] The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample.
[0167] The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
[0168] Optionally, the refined and extended functions of the program can be found in the description above.
[0169] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0170] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0171] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An object recognition method, characterized in that, include: Acquire target data, which is the data to be identified of an object in an object set, the object set including historical objects and newly added objects; Based on a pre-trained target recognition model, the object to which the target data belongs is identified; wherein: The target data is the electromagnetic data of an electromagnetic individual in a set of electromagnetic individuals, the target recognition model is an electromagnetic individual recognition model, and the object to which the target data belongs is the electromagnetic individual to which the target data belongs; or, the target data is the speech data of a speaker in a set of speakers, the target recognition model is a speaker recognition model, and the object to which the target data belongs is the speaker to which the target data belongs. The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample. The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
2. The object recognition method according to claim 1, characterized in that, The target recognition model, based on pre-trained data, identifies the object to which the target data belongs, including: Based on the target recognition model, the probability that the object identifier of the target data is each object identifier in the object identifier set is predicted, wherein the object identifier set includes the object identifiers corresponding to each object in the object set; The object to which the target data belongs is determined based on the probability that the object identifier of the target data is each object identifier in the object identifier set.
3. The object recognition method according to claim 1, characterized in that, The initial target recognition model is obtained by replicating the base recognition model; The training process of the target recognition model includes: Based on the target recognition model and the basic recognition model respectively, the probability that the object identifier of the first training sample is each object identifier in the object identifier set is predicted, resulting in a first probability distribution and a second probability distribution. The first probability distribution is the probability distribution predicted by the target recognition model for the first training sample, and the second probability distribution is the probability distribution predicted by the basic recognition model for the first training sample. The object identifier set includes the object identifiers corresponding to each object in the object set. Based on the first probability distribution, the second probability distribution, and the object identifiers labeled on the first training sample, a first prediction loss and a second prediction loss are determined. The first prediction loss can characterize the similarity between the first probability distribution and the true probability distribution corresponding to the first training sample, and the second prediction loss can characterize the difference between the first probability distribution and the second probability distribution. The true probability distribution is determined by the object identifiers labeled on the corresponding first training sample. The target recognition model is updated based on the first prediction loss and the second prediction loss.
4. The object recognition method according to claim 3, characterized in that, The step of determining the first prediction loss and the second prediction loss based on the first probability distribution, the second probability distribution, and the object identifiers labeled in the first training samples includes: Calculate the cross-entropy loss between the first probability distribution and the object identifier labeled in the first training sample, and use it as the first prediction loss; Calculate the distance between the first probability distribution and the second probability distribution, and use it as the second prediction loss.
5. The object recognition method according to claim 4, characterized in that, The target recognition model includes: hidden layers and fully connected layers; The step of updating the parameters of the target recognition model based on the first prediction loss and the second prediction loss includes: Based on the first prediction loss and the second prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
6. The object recognition method according to claim 5, characterized in that, The step of updating the parameters of the fully connected layer of the target recognition model based on the first prediction loss and the second prediction loss includes: The first prediction loss and the second prediction loss are combined to obtain the total prediction loss; Based on the total prediction loss, the parameters of the fully connected layer of the target recognition model are updated.
7. An object recognition device, characterized in that, include: Data acquisition module and object recognition module; The data acquisition module is used to acquire target data, which is the data to be identified of an object in an object set, and the object set includes historical objects and newly added objects. The object recognition module is used to identify the object to which the target data belongs based on a pre-trained target recognition model; wherein: The target data is the electromagnetic data of an electromagnetic individual in a set of electromagnetic individuals, the target recognition model is an electromagnetic individual recognition model, and the object to which the target data belongs is the electromagnetic individual to which the target data belongs; or, the target data is the speech data of a speaker in a set of speakers, the target recognition model is a speaker recognition model, and the object to which the target data belongs is the speaker to which the target data belongs. The target recognition model is obtained by training the initial target recognition model with the first training sample labeled with the object identifier of the newly added object; the training objectives of the target recognition model include: making the object identifier predicted for the first training sample consistent with the object identifier labeled for the first training sample, and making the probability distribution predicted for the first training sample approximate the probability distribution predicted by the basic recognition model for the first training sample. The probability distribution is the probability distribution of each object in the object set corresponding to the object identifier; the basic recognition model is trained using the second training samples of the historical objects labeled with object identifiers; the initial target recognition model is a model that can recognize the data of the historical objects.
8. An object recognition device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the object recognition method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the object recognition method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Voice recognition method, server and computer-readable storage medium
CN110634472A
Neural network training method, data processing method and related equipment
CN113159315A