WO2021244521A1 - 模型训练、对象分类方法和装置、电子设备及存储介质 - Google Patents
模型训练、对象分类方法和装置、电子设备及存储介质 Download PDFInfo
- Publication number
- WO2021244521A1 WO2021244521A1 PCT/CN2021/097643 CN2021097643W WO2021244521A1 WO 2021244521 A1 WO2021244521 A1 WO 2021244521A1 CN 2021097643 W CN2021097643 W CN 2021097643W WO 2021244521 A1 WO2021244521 A1 WO 2021244521A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- vector
- classification
- label
- penalty factor
- parameter
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Definitions
- This application relates to the field of deep learning technology, specifically, to a model training, object classification method and device, electronic equipment, and storage medium.
- deep learning technology With the continuous development of deep learning technology, its application range is becoming wider and wider.
- deep learning technology has been well applied in the field of image recognition, such as the use of deep learning technology to recognize and classify images.
- the purpose of this application is to provide a model training, object classification method and device, electronic equipment and storage medium to improve the problem of low classification accuracy of object classification models trained in related technologies.
- An object classification model training method including:
- the classification loss is calculated based on the similar probability parameter, and a preset neural network model is trained based on the classification loss to obtain an object classification model, wherein the sample object is a sample image, and the object classification model is used to The type of image is determined by classification.
- the classification algorithm includes an exponential function
- the step of calculating the similarity probability parameter between each object vector and each label vector based on a preset classification algorithm includes:
- For each object vector calculate the first similarity parameter between the object vector and the target label vector based on the first exponential function, where the sample label corresponding to the target label vector has a corresponding relationship with the sample object corresponding to the object vector , And in the first exponential function, the value of the exponent has a linear relationship with the vector angle between the object vector and the target label vector;
- For each object vector calculate the second similarity parameter between the object vector and each of the other label vectors based on the second exponential function, where the other label vectors are label vectors other than the target label vector in all label vectors;
- the first similarity parameter and the second similarity parameter of the object vector are processed based on the normalization function to obtain the similarity probability parameter.
- the first exponential function includes one or more of a first multiplicative penalty factor, a second multiplicative penalty factor, and an additive penalty factor;
- the value of the first multiplicative penalty factor is related to the degree of aggregation between classes of the classification
- the second multiplicative penalty factor is related to the number of classes of the classification
- the additive penalty factor is related to the accuracy of the classification.
- the method further includes:
- the value of the first multiplicative penalty factor has a positive correlation with the degree of aggregation between classes of the classification
- the second multiplicative penalty factor has a positive correlation with the number of classes of the classification
- the additive There is a positive correlation between the penalty factor and the accuracy of classification.
- the first exponential function includes:
- ⁇ is the first similarity parameter
- a is the first multiplicative penalty factor
- s is the second multiplicative penalty factor
- b is the additive penalty factor
- ⁇ yt is the object vector and The vector angle between the target label vectors.
- the method further includes:
- the value of the exponent has a cosine nonlinear relationship with the angle between the object vector and the label vector
- the second exponential function include:
- s is the second multiplicative penalty factor
- ⁇ j is the object vector and the other label vector The angle between the vectors.
- the classification algorithm includes a logarithmic function.
- the value of the true number has a linear relationship with the vector angle between the object vector and the label vector.
- an embodiment of the present application also provides an object classification method, including:
- the embodiment of the application also provides an object classification model training device, including:
- the vector obtaining module is used to obtain the object vector corresponding to each sample object and the label vector corresponding to each sample label, where there are multiple sample objects and have a one-to-one correspondence with multiple sample labels;
- the parameter calculation module is used to calculate the similar probability parameter between each object vector and each label vector based on a preset classification algorithm.
- the value of the function is related to the object vector and label.
- the vector angle between vectors has a linear relationship;
- the model training module is used to calculate the classification loss based on the similar probability parameter, and train a preset neural network model based on the classification loss to obtain an object classification model, wherein the sample object is a sample image, and the object
- the classification model is used to classify and determine the type of target image.
- the classification algorithm includes an exponential function
- the parameter calculation module is further configured to:
- For each object vector calculate the first similarity parameter between the object vector and the target label vector based on the first exponential function, where the sample label corresponding to the target label vector has a corresponding relationship with the sample object corresponding to the object vector , And in the first exponential function, the value of the exponent has a linear relationship with the vector angle between the object vector and the target label vector;
- For each object vector calculate the second similarity parameter between the object vector and each of the other label vectors based on the second exponential function, where the other label vectors are label vectors other than the target label vector in all label vectors;
- the first similarity parameter and the second similarity parameter of the object vector are processed based on the normalization function to obtain the similarity probability parameter.
- the first exponential function includes one or more of a first multiplicative penalty factor, a second multiplicative penalty factor, and an additive penalty factor;
- the value of the first multiplicative penalty factor is related to the degree of aggregation between classes of the classification
- the second multiplicative penalty factor is related to the number of classes of the classification
- the additive penalty factor is related to the accuracy of the classification.
- the device further includes a factor assignment module configured to:
- the value of the first multiplicative penalty factor has a positive correlation with the degree of aggregation between classes of the classification
- the second multiplicative penalty factor has a positive correlation with the number of classes of the classification
- the additive There is a positive correlation between the penalty factor and the accuracy of classification.
- the first exponential function includes:
- ⁇ is the first similarity parameter
- a is the first multiplicative penalty factor
- s is the second multiplicative penalty factor
- b is the additive penalty factor
- ⁇ yt is the object vector and The vector angle between the target label vectors.
- the device further includes a second exponential function generating module configured to:
- the value of the exponent has a non-linear cosine relationship with the vector angle between the object vector and other label vectors
- the second exponential function includes:
- s is the second multiplicative penalty factor
- ⁇ j is the object vector and the other label vector The angle between the vectors.
- an embodiment of the present application also provides an object classification device, including:
- the object input module is configured to input the obtained target object into a preset object classification model, where the object classification model is obtained through training based on the above-mentioned object classification model training device;
- the object classification module is configured to perform type recognition processing on the target object through the object classification model to obtain the object type of the target object, where the target object is a target image.
- an embodiment of the present application also provides an electronic device, including:
- Memory configured to store computer programs
- the processor connected to the memory is configured to execute the computer program stored in the memory to implement the above-mentioned object classification model training method or the above-mentioned object classification method.
- an embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored.
- the computer program is executed, the foregoing object classification model training method or the foregoing object classification method is implemented. .
- FIG. 1 is a structural block diagram of an electronic device provided by an embodiment of the application.
- Fig. 2 is a schematic flowchart of a method for training an object classification model provided by an embodiment of the application.
- FIG. 3 is a schematic flowchart of each sub-step included in step S120 in FIG. 2.
- FIG. 4 is a schematic flowchart of other steps included in the object classification model training method provided by an embodiment of the application.
- FIG. 5 is a schematic diagram of two functional relationships having a linear relationship and a non-linear relationship between the vector angle and the value of the exponent provided by an embodiment of the application.
- FIG. 6 is another flowchart of other steps included in the object classification model training method provided by an embodiment of the application.
- FIG. 7 is a schematic flowchart of an object classification method provided by an embodiment of the application.
- FIG. 8 is a block diagram of functional modules included in the object classification model training apparatus provided by an embodiment of the application.
- FIG. 9 is a block diagram of functional modules included in the object classification apparatus provided by an embodiment of the application.
- Icon 10-electronic equipment; 12-memory; 14-processor; 100-object classification model training device; 110-vector acquisition module; 120-parameter calculation module; 130-model training module; 200-object classification device; 210- Object input module; 220-object classification module.
- an embodiment of the present application provides an electronic device 10.
- the electronic device 10 may include a memory 12 and a processor 14.
- the memory 12 and the processor 14 are directly or indirectly electrically connected to realize data transmission or interaction.
- the memory 12 may store at least one software function module that may exist in the form of software or firmware.
- the processor 14 may be used to execute an executable computer program stored in the memory 12, such as the aforementioned software function module, so as to implement the object classification model training method provided by the embodiment of the present application (described later).
- the object classification model or implement the object classification method provided in the embodiment of the present application (as described later)
- to obtain the object type of the target object to obtain the object type of the target object.
- the memory 12 may be, but is not limited to, a random access memory (Random Access Memory, RAM), a read only memory (Read Only Memory, ROM), a programmable read only memory (Programmable Read-Only Memory, PROM), Erasable Programmable Read-Only Memory (EPROM), Electrical Erasable Programmable Read-Only Memory (EEPROM), etc.
- RAM Random Access Memory
- ROM read only memory
- PROM Programmable Read-Only Memory
- EPROM Erasable Programmable Read-Only Memory
- EEPROM Electrical Erasable Programmable Read-Only Memory
- the processor 14 may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), a system on chip (System on Chip, SoC), etc.; or Is a digital signal processor (Digital Signal Processing, DSP), application specific integrated circuit (ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic Devices, discrete hardware components.
- CPU central processing unit
- NP Network Processor
- SoC System on Chip
- Is a digital signal processor Digital Signal Processing, DSP
- ASIC application specific integrated circuit
- FPGA Field Programmable Gate Array
- the electronic device 10 may be a server with data processing capabilities.
- the structure shown in FIG. 1 is only for illustration, and the electronic device 10 may also include more or less components than that shown in FIG. 1, or have a configuration different from that shown in FIG. 1, for example, A communication unit used for information interaction with other devices, such as information interaction with other databases to obtain sample objects, or information interaction with terminal devices to obtain target objects.
- the embodiment of the present application does not perform information interaction on the structure of the electronic device 10 limit.
- an embodiment of the present application also provides an object classification model training method applicable to the above-mentioned electronic device 10.
- the method steps defined in the process related to the object classification model training method can be implemented by the electronic device 10, that is, the electronic device can execute the object classification model training method provided in the embodiments of the present application.
- the main steps S110 to S130 shown in FIG. 2 will be described in detail below.
- Step S110 Obtain an object vector corresponding to each sample object and a label vector corresponding to each sample label.
- the electronic device 10 when the electronic device 10 needs to train the preset neural network model, it may first obtain the object vector corresponding to each sample object, and obtain the label vector corresponding to the sample label corresponding to each sample object. .
- the sample object may be multiple, and may have a one-to-one correspondence with multiple sample labels. That is, multiple object vectors and multiple label vectors can be obtained.
- Step S120 Calculate the similarity probability parameter between each object vector and each label vector based on a preset classification algorithm.
- the electronic device 10 may calculate the relationship between each object vector and each label vector based on a preset classification algorithm.
- the similarity probability parameter may be calculated from a preset classification algorithm.
- the value of the function has a linear relationship with the vector angle between the object vector and the label vector; that is, the foregoing is used to calculate the similarity probability between the object vector and the label vector
- the parameter classification algorithm includes at least a function with a linear relationship.
- the embodiment of the present application does not limit the specific expression of the function having a linear relationship, and the specific expression can be set according to actual conditions.
- step S130 a classification loss is calculated based on the similar probability parameter, and a preset neural network model is trained based on the classification loss to obtain an object classification model.
- the electronic device 10 may first calculate the classification loss based on the similar probability parameter, and then perform the preset neural network model based on the classification loss. Train to get the object classification model.
- the sample object may be a sample image, so that the object classification model can be used to classify and determine the type of the target image.
- the value of the exponential function used has a cosine non-linear relationship with the angle between the object vector and the label vector.
- the value of the index has large fluctuations, which makes the calculation result of classification loss fluctuate greatly and it is difficult to effectively converge.
- the classification algorithm since the classification algorithm includes a function with a linear relationship, when the similar probability parameter obtained based on the classification algorithm is used to calculate the classification loss, it can be guaranteed that the calculated loss can be Convergence smoothly, so that the recognition and classification performance of the object classification model trained based on the classification loss is also relatively stable, ensuring that the object classification models obtained by training have high classification accuracy, and then improving the objects trained in related technologies
- the classification model is prone to the problem of low classification accuracy.
- the above-mentioned model training method provided by the embodiments of the present disclosure is suitable for this multi-classification.
- the field has good application effects and high practical value.
- step S110 the specific method for obtaining the object vector is not limited, and can be selected according to actual application requirements.
- sample object is a sample image
- multiple sample images can be obtained first, and then based on the feature extraction layer (such as an encoder) in the neural network model, for each sample image Perform feature extraction processing to obtain multiple image features, and then use the image classification layer in the neural network model (such as fully connected layers, FC) to perform feature classification processing on each image feature, and finally obtain multiple image features.
- the image vector (that is, the object vector).
- step S110 the specific method for obtaining the label vector is not limited, and can also be selected according to actual application requirements.
- sample labels corresponding to multiple sample objects can also be directly obtained, and then each sample label is vectorized to obtain multiple label vectors, as shown below:
- Wi represents the label vector of the i-th sample label
- n represents the number of label vectors, that is, there are n label vectors.
- step S120 it should be noted that the specific method of calculating the similar probability parameter is not limited, and can also be selected according to actual application requirements, for example, based on the function of the classification algorithm having the above linear relationship.
- the specific content is different, and there are different options.
- the function with the above linear relationship may be an exponential function.
- the value of the exponent has a linear relationship with the angle between the object vector and the label vector.
- the function with the above linear relationship can also be a non-exponential function, such as a logarithmic function (or other functions).
- a logarithmic function or other functions.
- the classification algorithm may or may not include an exponential function.
- the specific content of the classification algorithm is also not limited, so that the specific method for calculating the similar probability parameter can also be selected in different ways.
- the first similarity parameter between the object vector and the target label vector, the object vector and each other label vector except the target label vector can be calculated based on the same exponential function.
- the exponential functions included in the classification algorithm all have the following relationship: the value of the exponent has a linear relationship with the vector angle between the object vector and the label vector.
- step S120 may include step S121, step S122, and step S123.
- the specific content is as follows.
- Step S121 For each object vector, calculate a first similarity parameter between the object vector and the target label vector based on the first exponential function.
- the object vector and the object vector can be calculated based on a preset first exponential function. Corresponding similar parameters between the target label vectors, obtain the corresponding first similar parameters. In this way, based on multiple object vectors, multiple first similar parameters can be obtained.
- the sample label corresponding to the target label vector may have a corresponding relationship with the sample object corresponding to the object vector, and in the first exponential function, the value of the exponent is the vector between the object vector and the target label vector The angle has a linear relationship.
- Step S122 For each object vector, calculate a second similarity parameter between the object vector and each other label vector based on the second exponential function.
- Other label vectors are also label vectors other than the above-mentioned target label vector.
- step S110 after obtaining multiple object vectors and multiple label vectors based on step S110, for each object vector, it is also possible to calculate the relationship between the object vector and each object vector based on a preset second exponential function. In addition to the above-mentioned target label vector, similar parameters between other label vectors are obtained to obtain at least one corresponding second similar parameter. In this way, based on multiple object vectors, multiple second similar parameters can be obtained.
- the other label vectors may be label vectors other than the target label vector among all label vectors.
- a label vector when used as the target label vector of an object vector, it can also be used as another label vector of another object vector.
- Step S123 For each object vector, the first similarity parameter and the second similarity parameter of the object vector are processed based on the normalization function to obtain the similarity probability parameter. That is, the first similarity parameter and the second similarity parameter of each object vector are normalized to obtain the similarity probability parameter.
- step S121 and step S122 After obtaining a first similarity parameter and at least one second similarity parameter of each object vector based on step S121 and step S122, for each object vector, based on a preset normalization function, One first similarity parameter and at least one second similarity parameter corresponding to the object vector are processed to obtain a corresponding similarity probability parameter.
- the first similarity parameter and the second similarity parameter are calculated based on the first exponential function and the second exponential function respectively, because in the exponential function, as the independent variable increases, the comparison will be obtained.
- the large function value allows the first similar parameter and the second similar parameter calculated based on different vector angles to have a larger value range. In this way, in the application of multi-classification, the classification can be made more accurate and more accurate. streamline.
- step S121 to calculate the first similar parameter is not limited, and can be selected according to actual application requirements.
- the inventor of the present application has discovered through long-term research that a type can be set when calculating the first similarity parameter.
- the multiplicative penalty factor of. That is, the first multiplicative penalty factor may be set in the first exponential function, and the value of the first multiplicative penalty factor is related to the degree of aggregation between classes of the classification.
- a second multiplicative penalty factor can be set in the first exponential function, and the value of the second multiplicative penalty factor is related to the number of classes.
- an additive penalty factor can be set in the first exponential function, and the value of the additive penalty factor is related to the accuracy of classification.
- the trained object classification model in order to enable the trained object classification model to have good adaptability to the inter-class aggregation, number of classes and accuracy of classification, in the first exponential function, it may include a first multiplicative penalty factor, a second multiplicative penalty factor, and an additive penalty factor.
- the object classification model training method may further include step S140 and step S150, and the specific content is as follows.
- Step S140 Obtain a first parameter configuration instruction generated in response to the user's first parameter configuration operation.
- the electronic device 10 may also obtain the first parameter configuration instruction generated in advance.
- the first parameter configuration instruction may be (electronic device 10, or other device) generated in response to the user's first parameter configuration operation.
- the user can generate the first parameter configuration instruction through the first parameter configuration operation.
- the user can input the first multiplicative penalty of the desired configuration through a designated port (such as a parameter configuration input box of a designated interface presented by the electronic device 10).
- the specific values of the factor, the second multiplicative penalty factor, and the additive penalty factor are completed, and the first parameter configuration operation is completed. At this time, the specific value carrying the first multiplicative penalty factor, the second multiplicative penalty factor, and the additive penalty factor is generated.
- the first parameter configuration instruction of the value is generated.
- step S150 the first multiplicative penalty factor, the second multiplicative penalty factor, and the additive penalty factor are respectively assigned values based on the first parameter configuration instruction.
- the electronic device 10 may also perform a penalty on the first multiplicative penalty factor and the second multiplicative penalty based on the first parameter configuration instruction.
- the penalty factor and the additive penalty factor are respectively assigned values.
- the inventors of the present application have discovered that the value of the first multiplicative penalty factor has a positive correlation with the degree of aggregation between classes of the classification, and the second multiplicative penalty factor has a positive correlation with the number of classes of the classification. There is a positive correlation between them, and there is a positive correlation between the additive penalty factor and the accuracy of classification.
- a larger first multiplicative penalty factor can be set.
- a larger second multiplicative penalty factor can be set.
- a larger additive penalty factor can be set in the object classification model used for network payment verification.
- the classification accuracy is required. The requirements are high, therefore, a larger additive penalty factor can be set for the first exponential function in the model training process to ensure the reliability of payment verification.
- the specific content of the first exponential function is not limited, as long as it satisfies the above-mentioned "the value of the exponent has a linear relationship with the vector angle between the object vector and the target label vector, including the first multiplicative penalty factor. , The second multiplicative penalty factor and the additive penalty factor" conditions.
- the first exponential function may include:
- ⁇ may be the first similarity parameter
- a may be the first multiplicative penalty factor
- s may be the second multiplicative penalty factor
- b may be the additive penalty factor
- ⁇ yt may be The vector angle between the object vector and the target label vector.
- the vector included angle between the object vector and the corresponding target label vector can be determined, and then, In combination with the above-mentioned first exponential function, the similarity probability parameter between the object vector and the target label vector can be calculated.
- an exponential function based on the linear relationship between the value of the index and the angle of the vector provided by the embodiment of the present application, and the exponential function having a nonlinear relationship between the value of the index and the angle of the vector are shown, Among them, in FIG. 5, the nonlinear relationship is a cosine nonlinear relationship as an example, and the two exponential functions shown in FIG. 5 both include a multiplicative penalty factor and an additive penalty factor. It can be clearly seen from Figure 5 that in an exponential function with cosine nonlinearity, the value of the exponent fluctuates greatly with the change of the vector angle. This will lead to the use of only the exponential function when training the neural network model.
- the calculated classification loss is unstable, and the problem of unstable gradient descent occurs, which makes it difficult for training to effectively converge.
- the obtained object classification model is prone to have the problem of low recognition and classification accuracy.
- an exponential function with a linear relationship between the value of the exponent and the vector angle between the object vector and the label vector is added in the model training, the calculated classification loss can be converged relatively smoothly. In this way, because the classification loss can converge smoothly, the recognition and classification performance of the object classification model trained based on the classification loss is also relatively stable, ensuring that the trained object classification model has high classification accuracy, thereby avoiding only using The exponential function containing the non-linear relationship makes the calculation result of the classification loss fluctuate greatly and it is difficult to effectively converge.
- step S122 to calculate the second similar parameter is not limited, and can be selected according to actual application requirements.
- the specific manner of calculating the second similar parameter based on whether the value of the exponent in the second exponential function has a linear relationship with the vector angle between the object vector and other label vectors, the specific manner of calculating the second similar parameter There can be different options.
- the value of the exponent in the second exponential function, may have a linear relationship with the vector angle between the object vector and the label vector.
- the value of the exponent is related to the object vector and other label vectors. The angle between the vectors may not have a linear relationship, that is, a nonlinear relationship.
- the specific method for calculating the second similarity parameter may also have different choices.
- no penalty factor may be set in the second exponential function.
- a second multiplicative penalty factor may be included.
- the second multiplicative penalty factor has a positive correlation with the number of classes to be classified.
- a large second multiplicative penalty factor can be set.
- the object classification model training method may further include step S160 and step S170, and the specific content is as follows.
- Step S160 Obtain a second parameter configuration instruction generated in response to the user's second parameter configuration operation.
- the electronic device 10 may also first obtain the second parameter configuration instruction generated in advance.
- the second parameter configuration instruction may be (electronic device 10, or other device) generated in response to the user's second parameter configuration operation.
- the user can generate the second parameter configuration instruction through the second parameter configuration operation, for example, the user can input the function expression of the exponential function of the desired configuration through a designated port (such as the parameter configuration input box of the designated interface presented by the electronic device 10) Formula and parameter value, at this time, a second parameter configuration instruction carrying the function expression of the exponential function and the parameter value is generated.
- Step S170 Perform configuration processing on the exponential function based on the second parameter configuration instruction to obtain a second exponential function.
- the electronic device 10 may also perform configuration processing on a preset exponential function based on the second parameter configuration instruction to obtain a second exponential function .
- the first type of second parameter configuration instruction can be generated to configure the linear relationship.
- the second exponential function When it is required that the value of the exponent in the second exponential function has a non-linear relationship with the vector angle between the object vector and other label vectors, a second type of second parameter configuration instruction can be generated to configure the non-linear relationship The second exponential function. In practical applications, it can be flexibly set according to requirements. For example, the user can directly set whether the value of the index and the vector angle between the object vector and other label vectors have a linear relationship according to requirements when performing the second parameter configuration operation.
- the aforementioned nonlinear relationship may be an inverse trigonometric function relationship, such as a nonlinear relationship based on an inverse cosine relationship.
- the aforementioned nonlinear relationship may also be a trigonometric function relationship, such as a nonlinear relationship based on a cosine relationship.
- the second exponential function may include:
- It may be the second similarity parameter
- s may be a second multiplicative penalty factor
- ⁇ j may be the object vector and the The vector angle between other label vectors.
- the “linear relationship” may mean that the change trend between the value of the index and the angle of the vector is fixed, that is, the slope of the formed functional relationship is a fixed value.
- step S123 to calculate the similar probability parameter is not limited, and can be selected according to actual application requirements.
- the sum of a first similarity parameter corresponding to the object vector and all the corresponding second similarity parameters can be calculated first, and then the first similarity can be calculated.
- the quotient of the parameter and the sum that is, the former divided by the latter, so that the similar probability parameter of the object vector can be obtained.
- the weighted sum of all the second similar parameters corresponding to the object vector can be calculated first (that is, the weight coefficient can be preset and configured), and then the weight can be calculated The sum value is the sum value of a first similar parameter corresponding to the object vector, and then the quotient of the first similar parameter and the sum value is calculated. In this way, the similar probability parameter of the object can also be obtained.
- step S130 the specific method for training the neural network model is not limited, and can be selected according to actual application requirements.
- the neural network model can be trained directly based on the calculated classification loss according to the backpropagation algorithm (Backpropagation algorithm, BP algorithm, which is a supervised learning algorithm), that is, the backpropagation algorithm (Backpropagation algorithm, BP algorithm, which is a supervised learning algorithm), that is, the The neural network model includes a feature extraction layer and an image classification layer for converting the sample object into a corresponding object vector.
- backpropagation algorithm Backpropagation algorithm, BP algorithm, which is a supervised learning algorithm
- an embodiment of the present application also provides an object classification method applicable to the above-mentioned electronic device 10.
- the method steps defined in the process related to the object classification method can be implemented by the electronic device 10. The specific process shown in FIG. 7 will be described in detail below.
- Step S210 Input the obtained target object into a preset object classification model.
- the electronic device 10 may first input the target object into a preset object classification model.
- the target object may be a target image.
- the object classification model may be obtained by training an initial neural network model based on the aforementioned object classification model training method.
- Step S220 Perform type recognition processing on the target object through the object classification model to obtain the object type of the target object.
- the electronic device 10 may perform type recognition processing on the target object through the object classification model, thereby obtaining the target object's Object type.
- the object classification model may be an image recognition model for recognizing the target image, such as performing facial feature recognition to determine the face in the target image Whether it belongs to a certain person.
- the recognition and classification performance is relatively stable, and the classification accuracy is relatively high.
- an embodiment of the present application also provides an object classification model training device 100, which may be configured as the above-mentioned electronic device 10.
- the object classification model training device 100 may include a vector obtaining module 110, a parameter calculation module 120, and a model training module 130.
- the vector obtaining module 110 may be configured to obtain an object vector corresponding to each sample object and a label vector corresponding to each sample label, where there are multiple sample objects and have a one-to-one correspondence with multiple sample labels.
- the vector obtaining module 110 may be configured to perform step S110 shown in FIG. 2, and for related content of the vector obtaining module 110, reference may be made to the foregoing description of step S110.
- the parameter calculation module 120 may be configured to calculate the similarity probability parameter between each object vector and each label vector based on a preset classification algorithm, wherein, in at least part of the functions included in the classification algorithm, the value of the function is equal to The vector angle between the object vector and the label vector has a linear relationship.
- the parameter calculation module 120 may be configured to perform step S120 shown in FIG. 2. For related content of the parameter calculation module 120, reference may be made to the foregoing description of step S120.
- the model training module 130 may be configured to calculate a classification loss based on the similar probability parameter, and train a preset neural network model based on the classification loss to obtain an object classification model, wherein the sample object is a sample image
- the object classification model is configured to classify and determine the type of the target image.
- the model training module 130 may be configured to perform step S130 shown in FIG. 2. For related content of the model training module 130, reference may be made to the foregoing description of step S130.
- the value of the exponential function used has a cosine non-linear relationship with the angle between the object vector and the label vector.
- the value of the index has large fluctuations, which makes the calculation result of classification loss fluctuate greatly and it is difficult to effectively converge.
- the classification algorithm since the classification algorithm includes a function with a linear relationship, when the similar probability parameter obtained based on the classification algorithm is used to calculate the classification loss, the calculation can be guaranteed.
- the loss obtained can converge smoothly, so that the recognition and classification performance of the object classification model trained based on the classification loss is also relatively stable, ensuring that the object classification model obtained by training has high classification accuracy, thereby improving the related technology
- the object classification model obtained by training is prone to the problem of low classification accuracy.
- the above-mentioned model training method provided by the embodiments of the present disclosure is suitable for this multi-classification.
- the field has good application effects and high practical value.
- the classification algorithm includes an exponential function
- the parameter calculation module is further configured to:
- For each object vector calculate the first similarity parameter between the object vector and the target label vector based on the first exponential function, where the sample label corresponding to the target label vector has a corresponding relationship with the sample object corresponding to the object vector , And in the first exponential function, the value of the exponent has a linear relationship with the vector angle between the object vector and the target label vector;
- For each object vector calculate the second similarity parameter between the object vector and each of the other label vectors based on the second exponential function, where the other label vectors are label vectors other than the target label vector in all label vectors;
- the first similarity parameter and the second similarity parameter of the object vector are processed based on the normalization function to obtain the similarity probability parameter.
- the first exponential function includes one or more of a first multiplicative penalty factor, a second multiplicative penalty factor, and an additive penalty factor;
- the value of the first multiplicative penalty factor is related to the degree of aggregation between classes of the classification
- the second multiplicative penalty factor is related to the number of classes of the classification
- the additive penalty factor is related to the accuracy of the classification.
- the device further includes a factor assignment module configured to:
- the value of the first multiplicative penalty factor has a positive correlation with the degree of aggregation between classes of the classification
- the second multiplicative penalty factor has a positive correlation with the number of classes of the classification
- the additive There is a positive correlation between the penalty factor and the accuracy of classification.
- the first exponential function includes:
- ⁇ is the first similarity parameter
- a is the first multiplicative penalty factor
- s is the second multiplicative penalty factor
- b is the additive penalty factor
- ⁇ yt is the object vector and The vector angle between the target label vectors.
- the device further includes a second exponential function generating module configured to:
- the value of the exponent has a non-linear cosine relationship with the vector angle between the object vector and other label vectors
- the second exponential function includes:
- s is the second multiplicative penalty factor
- ⁇ j is the object vector and the other label vector The angle between the vectors.
- the classification algorithm includes a logarithmic function.
- the value of the true number has a linear relationship with the vector angle between the object vector and the label vector.
- an embodiment of the present application also provides an object classification apparatus 200, which may be configured as the above-mentioned electronic device 10.
- the object classification device 200 may include an object input module 210 and an object classification module 220.
- the object input module 210 can be configured to input the obtained target object into a preset object classification model, where the object classification model can be obtained by training based on the above-mentioned object classification model training device.
- the object input module 210 can be configured to perform step S210 shown in FIG.
- the object classification module 220 may be configured to perform type recognition processing on the target object through the object classification model to obtain the object type of the target object, where the target object is a target image.
- the object classification module 220 may be configured to perform step S220 shown in FIG. 7.
- step S220 For related content of the object classification module 220, reference may be made to the foregoing description of step S220.
- the object classification model used in the above object classification device is trained based on the aforementioned object classification model training device, the recognition and classification performance is relatively stable, and the classification accuracy is relatively high.
- a computer-readable storage medium stores a computer program that executes the above-mentioned object classification model when the computer program is running. The individual steps of the training method.
- a computer-readable storage medium stores a computer program, and the computer program executes the above-mentioned object classification method when the computer program is running. The various steps.
- the model training, object classification method and device, electronic equipment, and storage medium when calculating the classification loss, adopt a classification algorithm that includes a function with a linear relationship, so that the calculated classification loss can be compared. Converge smoothly. In this way, because the classification loss can converge smoothly, the recognition and classification performance of the object classification model trained based on the classification loss is also relatively stable, ensuring that the object classification model obtained by training has a high classification accuracy, thereby avoiding the use of current Some model training techniques make the calculation results of classification loss have large fluctuations and are difficult to effectively converge. Then, the object classification model trained in related techniques is prone to poor classification accuracy, especially when applied to humans. In face recognition classification, because there are many types of face images (for example, there are 100,000 types for 1 million people), it has a better application effect for this multi-classification field and has a higher practical value.
- each block in the flowchart or block diagram may represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more modules for realizing the specified logical function.
- Executable instructions may also occur in a different order from the order marked in the drawings.
- each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or actions Or it can be realized by a combination of dedicated hardware and computer instructions.
- the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
- the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer readable storage medium.
- the technical solution of this application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, an electronic device, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes.
- ROM read-only memory
- RAM random access memory
- the terms "including”, “including” or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, It also includes other elements that are not explicitly listed, or elements inherent to the process, method, article, or equipment. If there are no more restrictions, the element defined by the sentence "including a" does not exclude the existence of other identical elements in the process, method, article, or equipment that includes the element.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computational Linguistics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请提供的模型训练、对象分类方法和装置、电子设备及存储介质,涉及深度学习技术领域。在本申请中,首先,获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量。其次,基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系。然后,基于相似概率参数计算得到分类损失,并基于分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,样本对象为样本图像,对象分类模型用于对目标图像的类型进行分类确定。通过上述方法,可以改善现有技术中训练得到的对象分类模型容易出现分类准确度不高的问题。
Description
相关申请的交叉引用
本申请要求于2020年6月4日提交中国专利局的申请号为2020105000003、名称为“模型训练、对象分类方法和装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及深度学习技术领域,具体而言,涉及一种模型训练、对象分类方法和装置、电子设备及存储介质。
随着深度学习技术的不断发展,其应用范围也越来越广,例如,深度学习技术在图像识别领域中就得到了很好的应用,如利用深度学习技术对图像进行识别分类。
经发明人研究发现,基于相关技术训练得到的对象分类模型,在对图像进行识别分类时,容易出现分类准确度不高的问题。
发明内容
有鉴于此,本申请的目的在于提供一种模型训练、对象分类方法和装置、电子设备及存储介质,以改善相关技术中训练得到的对象分类模型容易出现分类准确度不高的问题。
为实现上述目的,本申请实施例采用如下技术方案:
一种对象分类模型训练方法,包括:
获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量,其中,该样本对象为多个,且与多个样本标签具有一一对应关系;
基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在该分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系;
基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,所述样本对象为样本图像,所述对象分类模型用于对目标图像的类型进行分类确定。
可选地,在上述对象分类模型训练方法中,所述分类算法包括指数函数,所述基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数的步骤,包括:
针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数, 其中,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系,且在该第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系;
针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数,其中,该其它标签向量为全部标签向量中所述目标标签向量以外的标签向量;
针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。
可选地,在上述对象分类模型训练方法中,所述第一指数函数中包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子中的一种或多种;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度相关,所述第二乘性惩罚因子与分类的类数量相关,所述加性惩罚因子与分类的准确度相关。
可选地,所述方法还包括:
获得响应用户的第一参数配置操作生成的第一参数配置指令;
基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
可选地,在上述对象分类模型训练方法中,所述第一指数函数包括:
其中,χ为所述第一相似参数,a为所述第一乘性惩罚因子,s为所述第二乘性惩罚因子,b为所述加性惩罚因子,θ
yt为所述对象向量和所述目标标签向量之间的向量夹角。
可选地,在上述对象分类模型训练方法中,该方法还包括:
获得响应用户的第二参数配置操作生成的第二参数配置指令;
基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数,其中,在该第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有非线性关系。
可选地,在上述对象分类模型训练方法中,在所述第二指数函数中,指数的值与对象向量和标签向量之间的向量夹角具有余弦的非线性关系,所述第二指数函数包括:
可选地,所述分类算法包括对数函数,在所述对数函数中,真数的值与对象向量和标签向量之间的向量夹角具有线性关系。
在上述基础上,本申请实施例还提供了一种对象分类方法,包括:
将获得的目标对象输入至预设的对象分类模型,其中,该对象分类模型基于上述的对象分类模型训练方法进行训练得到;
通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型,其中,该目标对象为目标图像。
本申请实施例还提供了一种对象分类模型训练装置,包括:
向量获得模块,用于获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量,其中,该样本对象为多个,且与多个样本标签具有一一对应关系;
参数计算模块,用于基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在该分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系;
模型训练模块,用于基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,所述样本对象为样本图像,所述对象分类模型用于对目标图像的类型进行分类确定。
可选地,所述分类算法包括指数函数,所述参数计算模块进一步配置成:
针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数,其中,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系,且在该第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系;
针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数,其中,该其它标签向量为全部标签向量中所述目标标签向量以外的标签向量;
针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。
可选地,所述第一指数函数中包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子中的一种或多种;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度相关,所述第二乘性惩罚因子与分类的类数量相关,所述加性惩罚因子与分类的准确度相关。
可选地,所述装置还包括因子赋值模块,配置成:
获得响应用户的第一参数配置操作生成的第一参数配置指令;
基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
可选地,所述第一指数函数包括:
其中,χ为所述第一相似参数,a为所述第一乘性惩罚因子,s为所述第二乘性惩罚因子,b为所述加性惩罚因子,θ
yt为所述对象向量和所述目标标签向量之间的向量夹角。
可选地,所述装置还包括第二指数函数生成模块,配置成:
获得响应用户的第二参数配置操作生成的第二参数配置指令;
基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数,其中,在该第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有非线性关系。
可选地,在所述第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有余弦的非线性关系,所述第二指数函数包括:
在上述基础上,本申请实施例还提供了一种对象分类装置,包括:
对象输入模块,配置成将获得的目标对象输入至预设的对象分类模型,其中,该对象分类模型基于上述的对象分类模型训练装置进行训练得到;
对象分类模块,配置成通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型,其中,该目标对象为目标图像。
在上述基础上,本申请实施例还提供了一种电子设备,包括:
存储器,配置成存储计算机程序;
与所述存储器连接的处理器,配置成执行该存储器存储的计算机程序,以实现上述的对象分类模型训练方法,或实现上述的对象分类方法。
在上述基础上,本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被执行时,实现上述的对象分类模型训练方法,或实现上述的对象分类方法。
为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
为了更清楚地说明本申请的技术方案,下面将对其中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实现方式,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它相关的附图。
图1为本申请实施例提供的电子设备的结构框图。
图2为本申请实施例提供的对象分类模型训练方法的流程示意图。
图3为图2中步骤S120包括的各子步骤的流程示意图。
图4为本申请实施例提供的对象分类模型训练方法包括的其它步骤的流程示意图。
图5为本申请实施例提供的向量夹角与指数的值之间具有线性关系和非线性关系的两种函数关系示意图。
图6为本申请实施例提供的对象分类模型训练方法包括的其它步骤的另一流程示意图。
图7为本申请实施例提供的对象分类方法的流程示意图。
图8为本申请实施例提供的对象分类模型训练装置包括的功能模块的方框示意图。
图9为本申请实施例提供的对象分类装置包括的功能模块的方框示意图。
图标:10-电子设备;12-存储器;14-处理器;100-对象分类模型训练装置;110-向量获得模块;120-参数计算模块;130-模型训练模块;200-对象分类装置;210-对象输入模块;220-对象分类模块。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例只是本申请的一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。
因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
如图1所示,本申请实施例提供了一种电子设备10。其中,该电子设备10可以包括存储器12和处理器14。
详细地,所述存储器12和处理器14之间直接或间接地电性连接,以实现数据的传输或交互。例如,相互之间可通过一条或多条通讯总线或信号线实现电性连接。所述存储器12中可以存储有至少一个可以以软件或固件(firmware)的形式,存在的软件功能模块。所述处理器14可以用于执行所述存储器12中存储的可执行的计算机程序,如前述的软件功能模块,从而实现本申请实施例(如后文所述)提供的对象分类模型训练方法,以得到对象分类模型,或实现本申请实施例(如后 文所述)提供的对象分类方法,以得到目标对象的对象类型。
可选地,所述存储器12可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。
并且,所述处理器14可以是一种通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)、片上系统(System on Chip,SoC)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
可以理解,所述电子设备10可以是一种具有数据处理能力的服务器。
并且,图1所示的结构仅为示意,所述电子设备10还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置,例如,还可以包括用于与其它设备进行信息交互的通信单元,如与其它数据库进行信息交互,以获得样本对象,或与终端设备进行信息交互,以获得目标对象,本申请实施例对电子设备10的结构不进行限制。
结合图2,本申请实施例还提供一种可应用于上述电子设备10的对象分类模型训练方法。其中,所述对象分类模型训练方法有关的流程所定义的方法步骤,可以由所述电子设备10实现,也即,可由电子设备执行本申请实施例提供的对象分类模型训练方法。下面将对图2所示的主要步骤S110~步骤S130,进行详细阐述。
步骤S110,获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量。
在本实施例中,所述电子设备10在需要对预设的神经网络模型进行训练时,可以先获得每一个样本对象对应的对象向量,并获得每一个样本对象对应的样本标签对应的标签向量。
其中,所述样本对象可以为多个,且与多个样本标签可以具有一一对应关系。也就是说,可以获得多个对象向量和多个标签向量。
步骤S120,基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数。
在本实施例中,在基于步骤S110获得所述多个对象向量和所述多个标签向量之后,所述电子设备10可以基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数。
其中,在所述分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系;也即,上述用于计算对象向量与标签向量之间的相似概率参数的分类算法至少包含有具有线性关系的函数。本申请实施例对该具有线性关系的函数的具体表达式不进行限定,具体可根据实际情况进行设置。
步骤S130,基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络 模型进行训练,得到对象分类模型。
在本实施例中,在基于步骤S120得到所述相似概率参数之后,所述电子设备10可以先基于该相似概率参数计算得到分类损失,然后,再基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型。
其中,所述样本对象可以为样本图像,如此,使得所述对象分类模型可以用于对目标图像的类型进行分类确定。
由于大多相关的模型训练技术所采用的分类算法中基本采用非线性关系的函数,诸如,采用的指数函数的指数的值与对象向量和标签向量之间的向量夹角具有余弦非线性关系,因而该指数的值具有较大的波动,使得分类损失的计算结果存在波动较大、难以有效的收敛。相比之下,基于本公开实施例提供的上述方法,由于分类算法中包括具有线性关系的函数,使得基于该分类算法得到的相似概率参数用于计算分类损失时,可以保证计算得到的损失可以平稳的进行收敛,从而使得基于该分类损失训练得到的对象分类模型的识别分类性能也较为稳定,保证训练得到的对象分类模型都具有较高的分类准确度,进而改善相关技术中训练得到的对象分类模型容易出现分类准确度不高的问题。特别是在应用于人脸识别分类时,由于人脸图像的类型较多(如100万个人,就有10万个类型),使得本公开实施例提供的上述模型训练方法对于这种多分类的领域具有较好的应用效果,实用价值较高。
第一方面,对于步骤S110需要说明的是,获得所述对象向量的具体方式不受限制,可以根据实际应用需求进行选择。
例如,基于所述样本对象的具体形式不同,可以有不同的选择。诸如,在一种可以替代的示例中,在所述样本对象为样本图像时,可以先获得多个样本图像,再基于神经网络模型中的特征提取层(如编码器),对每一个样本图像均进行特征提取处理,得到多个图像特征,然后,再通过神经网络模型中的图像分类层(如全连接层,fully connected layers,FC)对每一个图像特征进行特征分类处理,最终得到多个图像向量(即所述对象向量)。
并且,在步骤S110中,获得所述标签向量的具体方式也不受限制,也可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,可以直接获取已经对多个样本对象对应的样本标签进行向量化处理得到的标签向量。又例如,在另一种可以替代的示例中,也可以直接获取多个样本对象对应的样本标签,然后,再对每一个样本标签进行向量化处理,得到多个标签向量,如下所示:
[W1、W2、W3、...、Wi、...、Wn];
其中,Wi表示第i个样本标签的标签向量,n表示标签向量的数量,即有n个标签向量。
第二方面,对于步骤S120需要说明的是,计算所述相似概率参数的具体方式也不受限制,也可以根据实际应用需求进行选择,例如,基于所述分类算法中具有上述线性关系的函数的具体内容 不同,可以有不同的选择。
其中,一方面,在所述分类算法中,具有上述线性关系的函数,可以为指数函数,如此,在该指数函数中,指数的值与对象向量和标签向量之间的向量夹角具有线性关系。另一方面,在所述分类算法中,具有上述线性关系的函数也可以为非指数函数,如对数函数(也可以是其它函数),如此,在该对数函数中,真数的值与对象向量和标签向量之间的向量夹角具有线性关系。
也就是说,所述分类算法既可以包括指数函数,也可以不包括指数函数。其中,基于所述分类算法中具有线性关系的函数为指数函数的示例,所述分类算法的具体内容也不受限制,使得计算所述相似概率参数的具体方式也可以有不同的选择。
例如,在一种可以替代的示例中,可以基于相同的指数函数分别计算对象向量与目标标签向量之间的第一相似参数、对象向量与每一个除目标标签向量之外的其它标签向量之间的第二相似参数,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系。
也就是说,在上述示例中,所述分类算法包括的指数函数都具有如下关系:指数的值与对象向量和标签向量之间的向量夹角具有线性关系。
又例如,在另一种可以替代的示例中,为了使得训练得到的对象分类模型具有较好的识别分类能力,也即,为了使得计算得到的对象向量与目标标签向量之间的第一相似参数能够充分的表征该对象向量与该目标标签向量之间的真实关系(如参数的值为1),结合图3,步骤S120可以包括步骤S121、步骤S122和步骤S123,具体内容如下所述。
步骤S121,针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数。
在本实施例中,在基于步骤S110得到多个所述对象向量和多个所述标签向量之后,可以针对每一个对象向量,基于预设的第一指数函数,计算该对象向量与该对象向量对应的目标标签向量之间的相似参数,得到对应的第一相似参数。如此,基于多个对象向量,可以得到多个第一相似参数。
其中,所述目标标签向量对应的样本标签与该对象向量对应的样本对象之间可以具有对应关系,且在所述第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系。
步骤S122,针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数。其它标签向量也即是除了上述目标标签向量之外的标签向量。
在本实施例中,在基于步骤S110得到多个所述对象向量和多个所述标签向量之后,针对每一个对象向量,还可以基于预设的第二指数函数,计算该对象向量与每一个除了上述目标标签向量之外的其它标签向量之间的相似参数,得到对应的至少一个第二相似参数。如此,基于多个对象向量,可以得到多个第二相似参数。
其中,所述其它标签向量可以为全部标签向量中,所述目标标签向量以外的标签向量。也就是说,一个标签向量在作为一个对象向量的目标标签向量时,也可以作为另一个对象向量的其它标签 向量。
步骤S123,针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。也即,对每个对象向量的第一相似参数和第二相似参数进行归一化处理,得到相似概率参数。
在本实施例中,在基于步骤S121和步骤S122得到每一个对象向量的一个第一相似参数和至少一个第二相似参数之后,可以针对每一个对象向量,基于预设的归一化函数,对该对象向量对应的一个第一相似参数和至少一个第二相似参数进行处理,得到对应的相似概率参数。
如此,基于多个对象向量,可以得到多个相似概率参数。
其中,在上述示例中,分别基于第一指数函数和第二指数函数计算所述第一相似参数和所述第二相似参数,由于在指数函数中,随着自变量的增大,会得到较大的函数值,使得基于不同的向量夹角计算得到的第一相似参数和第二相似参数可以有较大的数值范围,如此,在多分类的应用中,可以使得分类更为准确、更为精细化。
可选地,执行步骤S121以计算所述第一相似参数的具体方式不受限制,可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,若对分类的类间聚合度有特定的需求,经过本申请的发明人的长期研究发现,可以在计算所述第一相似参数时,设置一种类型的乘性惩罚因子。也即,可以在第一指数函数中设置第一乘性惩罚因子,第一乘性惩罚因子的数值与分类的类间聚合度相关。
又例如,在另一种可以替代的示例中,若对分类的类数量具有特定的需求,经过本申请的发明人的长期研究发现,可以在计算所述第一相似参数时,设置另一种类型的乘性惩罚因子。也即,可以在第一指数函数中设置第二乘性惩罚因子,第二乘性惩罚因子的数值与分类的类数量相关。
再例如,在另一种可以替代的示例中,若对分类的准确度具有特定的需求,经过本申请的发明人的长期研究发现,可以在计算所述第一相似参数时,设置一种加性惩罚因子。也即,可以在第一指数函数中设置加性惩罚因子,加性惩罚因子的数值与分类的准确度相关。
基于此,在一种具体的应用示例中,为了使得训练得到的对象分类模型能够对分类的类间聚合度、类数量和准确度都具有较好的适应能力,所述第一指数函数中,在指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系的基础上,可以包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子。
因此,为了使得第一指数函数满足上述的需求,结合图4,所述对象分类模型训练方法还可以包括步骤S140和步骤S150,具体内容如下所述。
步骤S140,获得响应用户第一参数配置操作生成的第一参数配置指令。
在本实施例中,在进行神经网络模型的训练之前,所述电子设备10还可以先获得预先生成的第一参数配置指令。其中,该第一参数配置指令,可以是(电子设备10,或其它设备)响应用户的 第一参数配置操作生成。换言之,用户可以通过第一参数配置操作生成第一参数配置指令,诸如,用户可以通过指定端口(诸如电子设备10呈现的指定界面的参数配置输入框中)输入所需配置的第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子的具体数值,完成第一参数配置操作,此时生成了携带有第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子的具体数值的第一参数配置指令。
步骤S150,基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理。
在本实施例中,在基于步骤S140获得所述第一参数配置指令之后,所述电子设备10还可以基于该第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理。
其中,经过本申请的发明人的研究发现,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
也就是说,在对分类的类间聚合度具有较高的需求时,可以设置一个较大的第一乘性惩罚因子。在对分类的类数量具有较高的需求时,可以设置一个较大的第二乘性惩罚因子,例如,在对象分类模型用于对人脸进行识别时,因为可能涉及到需要对上千万的不同人脸图像进行分类识别,需要对分类的类数量有较高要求,因而,在模型训练过程中可以为第一指数函数设置较大的第二乘性惩罚因子。在对分类的准确度具有较高的需求时,可以设置一个较大的加性惩罚因子,例如,在对象分类模型用于网络支付验证中,为了保证财产的高安全性,需要对分类准确度要求较高,因而,在模型训练过程中可以为第一指数函数设置较大的加性惩罚因子,以保证支付验证的可靠性。
可以理解的是,所述第一指数函数的具体内容不受限制,只要满足上述的“指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系,包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子”的条件即可。
基于此,在一种具体的应用示例中,所述第一指数函数可以包括:
其中,χ可以为所述第一相似参数,a可以为所述第一乘性惩罚因子,s可以为所述第二乘性惩罚因子,b可以为所述加性惩罚因子,θ
yt可以为所述对象向量和所述目标标签向量之间的向量夹角。
也就是说,在基于步骤S110获得多个所述对象向量和多个所述标签向量之后,可以针对每一个对象向量,确定该对象向量与对应的目标标签向量之间的向量夹角,然后,再结合上述的第一指数函数可以计算出,该对象向量与该目标标签向量之间的相似概率参数。
如图5所示,示意出了基于本申请实施例提供的指数的值与向量夹角之间具有线性关系的指数 函数,以及指数的值与向量夹角之间具有非线性关系的指数函数,其中,图5中以非线性关系是余弦非线性关系为例进行示意,且图5中所示的两种指数函数都包括乘性惩罚因子和加性惩罚因子。从图5中可明显获知,在具有余弦非线性的指数函数中,指数的值随着向量夹角的变化存在较大的波动,如此,会导致仅采用该指数函数对神经网络模型进行训练时,计算得到的分类损失不稳定,出现梯度下降不稳定的问题,进而使得训练难以进行有效地收敛,导致训练结束之后,得到的对象分类模型容易存在识别分类的准确度较低的问题。如果在模型训练过中加入了指数的值与对象向量和标签向量之间的向量夹角具有线性关系的指数函数,则能够使得计算得到的分类损失可以比较平稳的进行收敛。如此,由于分类损失可以平稳的进行收敛,使得基于该分类损失训练得到的对象分类模型的识别分类性能也较为稳定,保证训练得到的对象分类模型都具有较高的分类准确度,从而避免仅采用包含有非线性关系的指数函数使得分类损失的计算结果存在波动较大、难以有效的收敛的问题。
可选地,执行步骤S122以计算所述第二相似参数的具体方式也不受限制,可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,基于所述第二指数函数中指数的值与对象向量和其它标签向量之间的向量夹角是否具有线性关系,计算所述第二相似参数的具体方式可以有不同的选择。
也就是说,在一种具体的应用示例中,在所述第二指数函数中,指数的值与对象向量和标签向量之间的向量夹角可以具有线性关系。在另一种具体的应用示例中,考虑到对象向量与不同的其它标签向量之间的向量夹角不具有规律性,在所述第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角可以不具有线性关系,即具有非线性关系。
又例如,在一种可以替代的示例中,基于是否考虑分类的类间聚合度、类数量和准确度,计算所述第二相似参数的具体方式也可以有不同的选择。
例如,在一种具体的应用示例中,若不需要考虑分类的类间聚合度、类数量和准确度,可以在所述第二指数函数中,不设置任何的惩罚因子。
又例如,在另一种具体的应用示例中,考虑到在较多的应用领域中,如基于图像识别领域中的人脸识别,一般都会涉及到较多的分类(如前所述的上千万的人脸识别分类),使得对分类的类数量具有一定的需求。
基于此,在所述第二指数函数中,可以包括第二乘性惩罚因子,如前所述,该第二乘性惩罚因子与分类的类数量之间具有正相关关系,即在对分类的类数量具有较大的需求时,可以设置一个较大的第二乘性惩罚因子。
因此,为了使得第二指数函数满足上述的需求,结合图6,所述对象分类模型训练方法还可以包括步骤S160和步骤S170,具体内容如下所述。
步骤S160,获得响应用户第二参数配置操作生成的第二参数配置指令。
在本实施例中,在进行神经网络模型的训练之前,所述电子设备10还可以先获得预先生成的第二参数配置指令。其中,该第二参数配置指令,可以是(电子设备10,或其它设备)响应用户的第二参数配置操作生成。换言之,用户可以通过第二参数配置操作生成第二参数配置指令,诸如,用户可以通过指定端口(诸如电子设备10呈现的指定界面的参数配置输入框中)输入所需配置的指数函数的函数表达式以及参数值,此时生成了携带有指数函数的函数表达式以及参数值的第二参数配置指令。
步骤S170,基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数。
在本实施例中,在基于步骤S160获得所述第二参数配置指令之后,所述电子设备10还可以基于该第二参数配置指令对预设的指数函数进行配置处理,以得到第二指数函数。
其中,在需要所述第二指数函数中指数的值与对象向量和其它标签向量之间的向量夹角具有线性关系时,可以生成第一种类型的第二参数配置指令,以配置具有线性关系的第二指数函数。在需要所述第二指数函数中指数的值与对象向量和其它标签向量之间的向量夹角非具有线性关系时,可以生成第二种类型的第二参数配置指令,以配置具有非线性关系的第二指数函数。在实际应用中可以根据需求而灵活设置,诸如可以由用户在执行第二参数配置操作时根据需求而直接设置指数的值与对象向量和其它标签向量之间的向量夹角是否具有线性关系。
并且,上述的非线性关系的具体内容也不受限制,也可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,上述的非线性关系,可以是一种反三角函数关系,如基于反余弦关系的非线性关系。
又例如,在另一种可以替代的示例中,上述的非线性关系,也可以是一种三角函数关系,如基于余弦关系的非线性关系。
基于此,在具有余弦的非线性关系和具有乘性惩罚的需求的基础上,所述第二指数函数可以包括:
可以理解的是,在上述的示例中,“线性关系”可以是指,指数的值与向量夹角之间的变化趋势固定,即形成的函数关系中,斜率为固定值。
可选地,执行步骤S123以计算所述相似概率参数的具体方式也不受限制,可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,针对每一个对象向量,可以先计算该对象向量对应的一个第一相似参数与对应的全部第二相似参数的和值,然后,再计算该第一相似参数与该和值的商值(即 前者除后者),如此,可以得到该对象向量的相似概率参数。
又例如,在另一种可以替代的示例中,针对每一个对象向量,可以先计算该对象向量对应的全部第二相似参数的加权和值(即可以预设配置权重系数),再计算该加权和值与该对象向量对应的一个第一相似参数的和值,然后,再计算该第一相似参数与该和值的商值,如此,也可以得到该对象对象的相似概率参数。
第三方面,对于步骤S130需要说明的是,对所述神经网络模型进行训练的具体方式也不受限制,可以根据实际应用需求进行选择。
例如,在一种可以替代的示例中,可以直接基于计算得到的分类损失,按照反向传播算法(Backpropagation algorithm,BP算法,是一种监督学习算法)对所述神经网络模型进行训练,即该神经网络模型包括用于将所述样本对象转换为对应的对象向量的特征提取层和图像分类层等。
又例如,在另一种可以替代的示例中,在所述分类损失的基础上,还可以结合其它类型的损失,先计算得到总损失。然后,在基于该总损失,按照反向传播算法对所述神经网络模型进行训练。
结合图7,本申请实施例还提供一种可应用于上述电子设备10的对象分类方法。其中,所述对象分类方法有关的流程所定义的方法步骤,可以由所述电子设备10实现。下面将对图7所示的具体流程,进行详细阐述。
步骤S210,将获得的目标对象输入至预设的对象分类模型。
在本实施例中,所述电子设备10在获得所述目标对象之后,可以先将该目标对象输入至预设的对象分类模型中。
其中,所述目标对象可以为目标图像。所述对象分类模型可以是,基于前述的对象分类模型训练方法对初始的神经网络模型进行训练得到。
步骤S220,通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型。
在本实施例中,在基于步骤S210将所述目标对象输入至所述对象分类模型之后,所述电子设备10可以通过该对象分类模型对该目标对象进行类型识别处理,从而得到该目标对象的对象类型。
其中,在所述目标对象为目标图像时,所述对象分类模型可以是一种图像识别模型,用于对该目标图像进行识别,如进行人脸特征识别,以确定该目标图像中的人脸是否属于某一个人。
由于上述对象分类模型是基于前述对象分类模型训练方法训练得到的,因此识别分类性能也较为稳定,具有较高的分类准确度。
结合图8,本申请实施例还提供一种对象分类模型训练装置100,可应配置成上述的电子设备10。其中,所述对象分类模型训练装置100可以包括向量获得模块110、参数计算模块120和模型训练模块130。
所述向量获得模块110,可以配置成获得每一个样本对象对应的对象向量、每一个样本标签对 应的标签向量,其中,该样本对象为多个,且与多个样本标签具有一一对应关系。在本实施例中,所述向量获得模块110可配置成执行图2所示的步骤S110,关于所述向量获得模块110的相关内容可以参照前文对步骤S110的描述。
所述参数计算模块120,可以配置成基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在该分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系。在本实施例中,所述参数计算模块120可配置成执行图2所示的步骤S120,关于所述参数计算模块120的相关内容可以参照前文对步骤S120的描述。
所述模型训练模块130,可以配置成基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,所述样本对象为样本图像,所述对象分类模型配置成对目标图像的类型进行分类确定。在本实施例中,所述模型训练模块130可配置成执行图2所示的步骤S130,关于所述模型训练模块130的相关内容可以参照前文对步骤S130的描述。
由于大多相关的模型训练技术所采用的分类算法中基本采用非线性关系的函数,诸如,采用的指数函数的指数的值与对象向量和标签向量之间的向量夹角具有余弦非线性关系,因而该指数的值具有较大的波动,使得分类损失的计算结果存在波动较大、难以有效的收敛。相比之下,基于本公开实施例提供的上述对象分类模型训练装置,由于分类算法中包括具有线性关系的函数,使得基于该分类算法得到的相似概率参数用于计算分类损失时,可以保证计算得到的损失可以平稳的进行收敛,从而使得基于该分类损失训练得到的对象分类模型的识别分类性能也较为稳定,保证训练得到的对象分类模型都具有较高的分类准确度,进而改善相关技术中训练得到的对象分类模型容易出现分类准确度不高的问题。特别是在应用于人脸识别分类时,由于人脸图像的类型较多(如100万个人,就有10万个类型),使得本公开实施例提供的上述模型训练方法对于这种多分类的领域具有较好的应用效果,实用价值较高。
可选地,所述分类算法包括指数函数,所述参数计算模块进一步配置成:
针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数,其中,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系,且在该第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系;
针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数,其中,该其它标签向量为全部标签向量中所述目标标签向量以外的标签向量;
针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。
可选地,所述第一指数函数中包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子中的一种或多种;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度相关,所述第二乘性惩罚因子与分类的类数量相关,所述加性惩罚因子与分类的准确度相关。
可选地,所述装置还包括因子赋值模块,配置成:
获得响应用户的第一参数配置操作生成的第一参数配置指令;
基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理;
其中,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
可选地,所述第一指数函数包括:
其中,χ为所述第一相似参数,a为所述第一乘性惩罚因子,s为所述第二乘性惩罚因子,b为所述加性惩罚因子,θ
yt为所述对象向量和所述目标标签向量之间的向量夹角。
可选地,所述装置还包括第二指数函数生成模块,配置成:
获得响应用户的第二参数配置操作生成的第二参数配置指令;
基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数,其中,在该第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有非线性关系。
可选地,在所述第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有余弦的非线性关系,所述第二指数函数包括:
可选地,所述分类算法包括对数函数,在所述对数函数中,真数的值与对象向量和标签向量之间的向量夹角具有线性关系。
结合图9,本申请实施例还提供一种对象分类装置200,可应配置成上述的电子设备10。其中,所述对象分类装置200可以包括对象输入模块210和对象分类模块220。
所述对象输入模块210,可以配置成将获得的目标对象输入至预设的对象分类模型,其中,该对象分类模型可以基于上述的对象分类模型训练装置进行训练得到。在本实施例中,所述对象输入模块210可配置成执行图7所示的步骤S210,关于所述对象输入模块210的相关内容可以参照前文对步骤S210的描述。
所述对象分类模块220,可以配置成通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型,其中,该目标对象为目标图像。在本实施例中,所述对象分类模块220可配置成执行图7所示的步骤S220,关于所述对象分类模块220的相关内容可以参照前文对步骤S220的描述。
由于上述对象分类装置中所采用的对象分类模型是基于前述对象分类模型训练装置训练得到的,因此识别分类性能也较为稳定,具有较高的分类准确度。
在本申请实施例中,对应于上述的对象分类模型训练方法,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,该计算机程序运行时执行上述对象分类模型训练方法的各个步骤。
其中,前述计算机程序运行时执行的各步骤,在此不再一一赘述,可参考前文对所述对象分类模型训练方法的解释说明。
并且,在本申请实施例中,对应于上述的对象分类方法,也提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序,该计算机程序运行时执行上述对象分类方法的各个步骤。
其中,前述计算机程序运行时执行的各步骤,在此不再一一赘述,可参考前文对所述对象分类方法的解释说明。
综上所述,本申请提供的模型训练、对象分类方法和装置、电子设备及存储介质,在计算分类损失时,通过采用包括具有线性关系的函数的分类算法,使得计算得到的分类损失可以比较平稳的进行收敛。如此,由于分类损失可以平稳的进行收敛,使得基于该分类损失训练得到的对象分类模型的识别分类性能也较为稳定,保证训练得到的对象分类模型都具有较高的分类准确度,从而避免采用现有的模型训练技术使得分类损失的计算结果存在波动较大、难以有效的收敛的问题,进而改善相关技术中训练得到的对象分类模型容易出现分类准确度不高的问题,特别是在应用于人脸识别分类时,由于人脸图像的类型较多(如100万个人,就有10万个类型),使得对于这种多分类的领域具有较好的应用效果,实用价值较高。
在本申请实施例所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置和方法实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可 以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
另外,在本申请各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,电子设备,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。
本申请提出的技术方案中,在计算分类损失时,通过采用包括具有线性关系的函数的分类算法,使得计算得到的分类损失可以比较平稳的进行收敛。如此,由于分类损失可以平稳的进行收敛,使得基于该分类损失训练得到的对象分类模型的识别分类性能也较为稳定,保证训练得到的对象分类模型都具有较高的分类准确度,从而避免采用相关的模型训练技术使得分类损失的计算结果存在波动较大、难以有效的收敛的问题,进而改善相关技术中训练得到的对象分类模型容易出现分类准确度不高的问题,具有较高的实用价值。
Claims (19)
- 一种对象分类模型训练方法,其特征在于,包括:获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量,其中,该样本对象为多个,且与多个样本标签具有一一对应关系;基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在该分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系;基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,所述样本对象为样本图像,所述对象分类模型用于对目标图像的类型进行分类确定。
- 根据权利要求1所述的对象分类模型训练方法,其特征在于,所述分类算法包括指数函数,所述基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数的步骤,包括:针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数,其中,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系,且在该第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系;针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数,其中,该其它标签向量为全部标签向量中所述目标标签向量以外的标签向量;针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。
- 根据权利要求1或2所述的对象分类模型训练方法,其特征在于,所述第一指数函数中包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子中的一种或多种;其中,所述第一乘性惩罚因子的数值与分类的类间聚合度相关,所述第二乘性惩罚因子与分类的类数量相关,所述加性惩罚因子与分类的准确度相关。
- 根据权利要求3所述的对象分类模型训练方法,其特征在于,所述方法还包括:获得响应用户的第一参数配置操作生成的第一参数配置指令;基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理;其中,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
- 根据权利要求2-5任意一项所述的对象分类模型训练方法,其特征在于,该方法还包括:获得响应用户的第二参数配置操作生成的第二参数配置指令;基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数,其中,在该第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有非线性关系。
- 根据权利要求1所述的对象分类模型训练方法,其特征在于,所述分类算法包括对数函数,在所述对数函数中,真数的值与对象向量和标签向量之间的向量夹角具有线性关系。
- 一种对象分类方法,其特征在于,包括:将获得的目标对象输入至预设的对象分类模型,其中,该对象分类模型基于权利要求1-8任意一项所述的对象分类模型训练方法进行训练得到;通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型,其中,该目标对象为目标图像。
- 一种对象分类模型训练装置,其特征在于,包括:向量获得模块,配置成获得每一个样本对象对应的对象向量、每一个样本标签对应的标签向量,其中,该样本对象为多个,且与多个样本标签具有一一对应关系;参数计算模块,配置成基于预设的分类算法计算每一个对象向量与每一个标签向量之间的相似概率参数,其中,在该分类算法包括的至少部分函数中,函数的值与对象向量和标签向量之间的向量夹角具有线性关系;模型训练模块,配置成基于所述相似概率参数计算得到分类损失,并基于该分类损失对预设的神经网络模型进行训练,得到对象分类模型,其中,所述样本对象为样本图像,所述对象分类模型配置成对目标图像的类型进行分类确定。
- 根据权利要求10所述的对象分类模型训练装置,其特征在于,所述分类算法包括指数函数,所述参数计算模块进一步配置成:针对每一个对象向量,基于第一指数函数计算该对象向量与目标标签向量之间的第一相似参数,其中,该目标标签向量对应的样本标签与该对象向量对应的样本对象之间具有对应关系,且在该第一指数函数中,指数的值与对象向量和目标标签向量之间的向量夹角具有线性关系;针对每一个对象向量,基于第二指数函数计算该对象向量与每一个其它标签向量之间的第二相似参数,其中,该其它标签向量为全部标签向量中所述目标标签向量以外的标签向量;针对每一个对象向量,基于归一化函数对该对象向量的第一相似参数和第二相似参数进行处理,得到相似概率参数。
- 根据权利要求10或11所述的对象分类模型训练装置,其特征在于,所述第一指数函数中包括第一乘性惩罚因子、第二乘性惩罚因子和加性惩罚因子中的一种或多种;其中,所述第一乘性惩罚因子的数值与分类的类间聚合度相关,所述第二乘性惩罚因子与分类的类数量相关,所述加性惩罚因子与分类的准确度相关。
- 根据权利要求12所述的对象分类模型训练装置,其特征在于,所述装置还包括因子赋值模块,配置成:获得响应用户的第一参数配置操作生成的第一参数配置指令;基于所述第一参数配置指令对所述第一乘性惩罚因子、所述第二乘性惩罚因子和所述加性惩罚因子,分别进行赋值处理;其中,所述第一乘性惩罚因子的数值与分类的类间聚合度之间具有正相关关系,所述第二乘性惩罚因子与分类的类数量之间具有正相关关系,所述加性惩罚因子与分类的准确度之间具有正相关关系。
- 根据权利要求11-14任意一项所述的对象分类模型训练装置,其特征在于,所述装置还包括第二指数函数生成模块,配置成:获得响应用户的第二参数配置操作生成的第二参数配置指令;基于所述第二参数配置指令对指数函数进行配置处理,得到第二指数函数,其中,在该第二指数函数中,指数的值与对象向量和其它标签向量之间的向量夹角具有非线性关系。
- 一种对象分类装置,其特征在于,包括:对象输入模块,配置成将获得的目标对象输入至预设的对象分类模型,其中,该对象分类模型基于权利要求10至16任一项所述的对象分类模型训练装置进行训练得到;对象分类模块,配置成通过所述对象分类模型对所述目标对象进行类型识别处理,得到该目标对象的对象类型,其中,该目标对象为目标图像。
- 一种电子设备,其特征在于,包括:存储器,配置成存储计算机程序;与所述存储器连接的处理器,配置成执行该存储器存储的计算机程序,以实现权利要求1-8任意一项所述的对象分类模型训练方法,或实现权利要求9所述的对象分类方法。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被执行时,实现权利要求1-8任意一项所述的对象分类模型训练方法,或实现权利要求9所述的对象分类方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010500000.3A CN111652315B (zh) | 2020-06-04 | 2020-06-04 | 模型训练、对象分类方法和装置、电子设备及存储介质 |
CN202010500000.3 | 2020-06-04 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021244521A1 true WO2021244521A1 (zh) | 2021-12-09 |
Family
ID=72347287
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/097643 WO2021244521A1 (zh) | 2020-06-04 | 2021-06-01 | 模型训练、对象分类方法和装置、电子设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111652315B (zh) |
WO (1) | WO2021244521A1 (zh) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115134294A (zh) * | 2022-06-30 | 2022-09-30 | 中国电信股份有限公司 | 备用路由确定方法、装置及计算机可读存储介质 |
CN115130539A (zh) * | 2022-04-21 | 2022-09-30 | 腾讯科技(深圳)有限公司 | 分类模型训练、数据分类方法、装置和计算机设备 |
CN115934809A (zh) * | 2023-03-08 | 2023-04-07 | 北京嘀嘀无限科技发展有限公司 | 一种数据处理方法、装置和电子设备 |
CN117076956A (zh) * | 2023-10-16 | 2023-11-17 | 西安石油大学 | 缝洞油藏物理模型相似准数优化方法及装置 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111652315B (zh) * | 2020-06-04 | 2023-06-02 | 广州虎牙科技有限公司 | 模型训练、对象分类方法和装置、电子设备及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160086057A1 (en) * | 2014-09-22 | 2016-03-24 | Kabushiki Kaisha Toshiba | Feature point detection device, feature point detection method, and computer program product |
US20160232456A1 (en) * | 2015-02-06 | 2016-08-11 | Box, Inc. | Method and system for implementing machine learning analysis of documents |
CN108229298A (zh) * | 2017-09-30 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络的训练和人脸识别方法及装置、设备、存储介质 |
CN110009052A (zh) * | 2019-04-11 | 2019-07-12 | 腾讯科技(深圳)有限公司 | 一种图像识别的方法、图像识别模型训练的方法及装置 |
CN110164452A (zh) * | 2018-10-10 | 2019-08-23 | 腾讯科技(深圳)有限公司 | 一种声纹识别的方法、模型训练的方法以及服务器 |
CN111652315A (zh) * | 2020-06-04 | 2020-09-11 | 广州虎牙科技有限公司 | 模型训练、对象分类方法和装置、电子设备及存储介质 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109840530A (zh) * | 2017-11-24 | 2019-06-04 | 华为技术有限公司 | 训练多标签分类模型的方法和装置 |
CN110472665A (zh) * | 2019-07-17 | 2019-11-19 | 新华三大数据技术有限公司 | 模型训练方法、文本分类方法及相关装置 |
CN110728188B (zh) * | 2019-09-11 | 2022-12-02 | 北京迈格威科技有限公司 | 图像处理方法、装置、系统和存储介质 |
CN111078885B (zh) * | 2019-12-18 | 2023-04-07 | 腾讯科技(深圳)有限公司 | 一种标签分类的方法、相关装置、设备以及存储介质 |
CN111178458B (zh) * | 2020-04-10 | 2020-08-14 | 支付宝(杭州)信息技术有限公司 | 分类模型的训练、对象分类方法及装置 |
-
2020
- 2020-06-04 CN CN202010500000.3A patent/CN111652315B/zh active Active
-
2021
- 2021-06-01 WO PCT/CN2021/097643 patent/WO2021244521A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160086057A1 (en) * | 2014-09-22 | 2016-03-24 | Kabushiki Kaisha Toshiba | Feature point detection device, feature point detection method, and computer program product |
US20160232456A1 (en) * | 2015-02-06 | 2016-08-11 | Box, Inc. | Method and system for implementing machine learning analysis of documents |
CN108229298A (zh) * | 2017-09-30 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络的训练和人脸识别方法及装置、设备、存储介质 |
CN110164452A (zh) * | 2018-10-10 | 2019-08-23 | 腾讯科技(深圳)有限公司 | 一种声纹识别的方法、模型训练的方法以及服务器 |
CN110009052A (zh) * | 2019-04-11 | 2019-07-12 | 腾讯科技(深圳)有限公司 | 一种图像识别的方法、图像识别模型训练的方法及装置 |
CN111652315A (zh) * | 2020-06-04 | 2020-09-11 | 广州虎牙科技有限公司 | 模型训练、对象分类方法和装置、电子设备及存储介质 |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115130539A (zh) * | 2022-04-21 | 2022-09-30 | 腾讯科技(深圳)有限公司 | 分类模型训练、数据分类方法、装置和计算机设备 |
CN115134294A (zh) * | 2022-06-30 | 2022-09-30 | 中国电信股份有限公司 | 备用路由确定方法、装置及计算机可读存储介质 |
CN115134294B (zh) * | 2022-06-30 | 2023-08-22 | 中国电信股份有限公司 | 备用路由确定方法、装置及计算机可读存储介质 |
CN115934809A (zh) * | 2023-03-08 | 2023-04-07 | 北京嘀嘀无限科技发展有限公司 | 一种数据处理方法、装置和电子设备 |
CN117076956A (zh) * | 2023-10-16 | 2023-11-17 | 西安石油大学 | 缝洞油藏物理模型相似准数优化方法及装置 |
CN117076956B (zh) * | 2023-10-16 | 2024-01-26 | 西安石油大学 | 缝洞油藏物理模型相似准数优化方法及装置 |
Also Published As
Publication number | Publication date |
---|---|
CN111652315A (zh) | 2020-09-11 |
CN111652315B (zh) | 2023-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021244521A1 (zh) | 模型训练、对象分类方法和装置、电子设备及存储介质 | |
CN112732911B (zh) | 基于语义识别的话术推荐方法、装置、设备及存储介质 | |
US20240045974A1 (en) | Testing adversarial robustness of systems with limited access | |
Hernández-Orallo | ROC curves for regression | |
Maurer et al. | Fusing multimodal biometrics with quality estimates via a Bayesian belief network | |
US20170150235A1 (en) | Jointly Modeling Embedding and Translation to Bridge Video and Language | |
US10685008B1 (en) | Feature embeddings with relative locality for fast profiling of users on streaming data | |
WO2020082734A1 (zh) | 文本情感识别方法、装置、电子设备及计算机非易失性可读存储介质 | |
WO2022142032A1 (zh) | 手写签名校验方法、装置、计算机设备及存储介质 | |
WO2020220758A1 (zh) | 一种异常交易节点的检测方法及装置 | |
WO2021244425A1 (zh) | 模型训练、图像识别方法和装置、电子设备及存储介质 | |
WO2023000794A1 (zh) | 保护数据隐私的业务预测模型训练的方法及装置 | |
US20230021338A1 (en) | Conditionally independent data generation for training machine learning systems | |
US11042880B1 (en) | Authenticating users in the presence of small transaction volumes | |
Seal et al. | Performance and convergence analysis of modified c-means using jeffreys-divergence for clustering | |
US10346722B2 (en) | Signal classification using sparse representation | |
Liao et al. | Logsig-RNN: A novel network for robust and efficient skeleton-based action recognition | |
CN112668482A (zh) | 人脸识别训练方法、装置、计算机设备及存储介质 | |
US9928408B2 (en) | Signal processing | |
US11816127B2 (en) | Quality assessment of extracted features from high-dimensional machine learning datasets | |
US20220253426A1 (en) | Explaining outliers in time series and evaluating anomaly detection methods | |
Liu et al. | A weight-incorporated similarity-based clustering ensemble method | |
CN117876709A (zh) | 图像识别方法、装置、电子设备及可读存储介质 | |
CN113256422B (zh) | 分仓账户识别方法、装置、计算机设备和存储介质 | |
Hsia et al. | Fast search real‐time face recognition based on DCT coefficients distribution |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21817884 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21817884 Country of ref document: EP Kind code of ref document: A1 |