A method, apparatus, device, and storage medium for predicting the position of an object.

By quantizing and optimizing the initial neural network model, the target neural network model is obtained, which solves the problem of high cost of deep learning models in target object location detection and achieves a reduction in model size and an increase in speed.

CN114494682BActive Publication Date: 2025-10-31GUANGZHOU XIAOPENG CONNECTIVITY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210093673.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-26
Publication Date
2025-10-31
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

Existing deep learning models are costly in target object location detection, mainly due to their large model size and high computational requirements, which in turn lead to high hardware requirements.

Method used

By acquiring an initial neural network model, quantization is performed to obtain quantized model parameters, and iterative optimization is carried out under noise threshold control until the target neural network model is reached for target object position detection.

Benefits of technology

While ensuring hardware computing power, the model size was reduced, the model calculation speed was improved, and the cost of object position detection was reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494682B_ABST
    Figure CN114494682B_ABST
Patent Text Reader

Abstract

This application relates to an object position prediction method, apparatus, device, and storage medium. The method includes: processing initial neural network model parameters to obtain quantized model parameters; predicting the position of an object in a sample image based on the initial neural network model to obtain a first result and predicting the position of an object in the sample image based on the model corresponding to the quantized model parameters to obtain a second result, thereby obtaining introduced noise; when the introduced noise is greater than a preset noise threshold, returning to the step of quantizing the initial model parameters to obtain quantized model parameters, until the obtained introduced noise is less than or equal to the preset noise threshold, thereby obtaining a target neural network model; and detecting the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected. Using the above method of this application reduces the size of the model for predicting object position and saves the cost of object position prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning, and more specifically, to a method, apparatus, device, and storage medium for predicting the position of an object. Background Technology

[0002] With significant breakthroughs in deep learning technology research, the support of massive amounts of big data, and the decrease in computing costs, deep learning methods have been widely used in object detection tasks. However, the neural network models used to detect object positions are typically large in scale, placing high demands on the memory space of the devices deploying them. Furthermore, the speed at which the neural network model calculates object positions is also related to the computing power of the device. Therefore, the high cost of using deep learning models for object position detection remains a significant challenge in this field. Summary of the Invention

[0003] This application provides an object position prediction method, apparatus, device, and storage medium to improve the above-mentioned problems.

[0004] In a first aspect, embodiments of this application provide an object position prediction method, the method comprising: acquiring an initial neural network model, the initial neural network model having initial model parameters of a first precision, the initial neural network model being trained based on multiple sample images with sample labels, the sample labels being used to identify the position of an object in the sample images; quantizing the initial model parameters to obtain quantized model parameters; acquiring introduced noise based on a first result obtained by the initial neural network model predicting the position of an object in the sample images and a second result obtained by the model corresponding to the quantized model parameters predicting the position of an object in the sample images; when the introduced noise is greater than a preset noise threshold, returning to the step of quantizing the initial model parameters to obtain quantized model parameters, until the acquired introduced noise is not greater than the preset noise threshold, thereby acquiring a target neural network model; and detecting the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected.

[0005] Secondly, embodiments of this application provide an object position prediction device, the device comprising: an initial model acquisition unit, a quantization parameter acquisition unit, an introduced noise acquisition unit, a target model acquisition unit, and a position prediction unit. The initial model acquisition unit is used to acquire an initial neural network model, the initial neural network model having initial model parameters of a first precision, the initial neural network model being trained based on multiple sample images with sample labels, the sample labels being used to identify the position of objects in the sample images; the quantization parameter acquisition unit is used to quantize the initial model parameters to obtain quantized model parameters; the introduced noise acquisition unit is used to acquire introduced noise based on the detection results obtained by the initial neural network model predicting the position of objects in the sample images and the detection results obtained by the model corresponding to the quantized model parameters predicting the position of objects in the sample images; the target model acquisition unit is used to return to the step of quantizing the initial model parameters to obtain quantized model parameters when the introduced noise is greater than a preset noise threshold, until the acquired introduced noise is less than or equal to the preset noise threshold, thereby obtaining a target neural network model; the position prediction unit is used to detect the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected.

[0006] Thirdly, embodiments of this application provide an electronic device, the electronic device comprising: one or more processors and a memory, the memory storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect above.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon. The program is executed by a processor using the method described in the first aspect.

[0008] The technical solution provided in this application involves obtaining an initial neural network model, which has initial model parameters of a first precision. This initial neural network model is trained on multiple sample images with sample labels, which are used to identify the positions of objects in the sample images. The initial model parameters are quantized to obtain quantized model parameters. Noise is introduced based on a first result obtained from the initial neural network model's prediction of the object's position in the sample image and a second result obtained from the model corresponding to the quantized model parameters' prediction of the object's position in the sample image. When the introduced noise exceeds a preset noise threshold, the process returns to quantizing the initial model parameters to obtain quantized model parameters, until the introduced noise is no greater than the preset noise threshold, thus obtaining a target neural network model. The target neural network model is then used to detect the image to be detected, obtaining the position of the target object in the image. Therefore, by using the above method of this application, the parameters of the initial neural network model are quantized according to a trainable threshold, reducing the size of the initial neural network model. The quantized model parameters are then used to infer the position of the target object, improving the model inference speed while considering the hardware computing power of the deployed model and reducing the cost of predicting object positions using a neural network model. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This illustration shows an application scenario of an object position prediction method provided in an embodiment of this application;

[0011] Figure 2 A flowchart illustrating an object position prediction method according to an embodiment of this application is shown.

[0012] Figure 3 This paper shows a structural block diagram of an object position prediction device according to an embodiment of the present application;

[0013] Figure 4 This illustration shows a structural block diagram of an electronic device according to an embodiment of this application;

[0014] Figure 5 A structural block diagram of a computer-readable storage medium provided in one embodiment of this application is shown. Detailed Implementation

[0015] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0016] With the rapid development of science and technology, artificial intelligence (AI) technology is receiving increasing attention. In particular, machine learning technology within AI is widely used. It is commonly used to train machine learning models for locating and recognizing target objects.

[0017] Object detection is a crucial task in the perception modules of autonomous vehicles. With the development of deep learning in recent years, deep learning methods have also been applied to object detection in these modules. However, deep learning models for predicting the location of objects are typically large, placing significant demands on the memory space of the devices deploying them. Furthermore, the speed at which a deep learning model predicts the location of an object is directly related to the hardware computing power of the device. To obtain an accurate location, the device deploying the deep learning model needs sufficient storage resources and high-level hardware computing power. Therefore, the related technologies suffer from the problem of high cost in accurately predicting the location of objects using deep learning models.

[0018] To alleviate the aforementioned problems, the inventors of this application propose an object position prediction method, apparatus, device, and storage medium according to embodiments of this application. The method involves: acquiring an initial neural network model, wherein the initial neural network model has initial model parameters of a first precision, and the initial neural network model is trained based on multiple sample images with sample labels, the sample labels being used to identify the positions of objects in the sample images; quantizing the initial model parameters to obtain quantized model parameters; obtaining introduced noise based on a first result obtained by the initial neural network model predicting the positions of objects in the sample images and a second result obtained by the model corresponding to the quantized model parameters predicting the positions of objects in the sample images; when the introduced noise is greater than a preset noise threshold, returning to the step of quantizing the initial model parameters to obtain quantized model parameters, until the obtained introduced noise is not greater than the preset noise threshold, thus obtaining a target neural network model; and detecting the target object in the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected. Therefore, by adopting the above-described method of this application, a trainable quantization threshold algorithm is used to quantize the parameters of the initial neural network model to obtain a smaller target neural network model for detecting the position of the target object. The position of the target object is then inferred using the quantized model parameters in the target neural network model. This improves the inference speed of the model while taking into account the hardware computing power, thus shortening the delay in predicting the position of the target object and reducing the cost of predicting the position of the target object.

[0019] Figure 1 This is an application scenario diagram of an object position prediction method provided in this application, as shown in one embodiment. (Refer to...) Figure 1 This application scenario includes a network-connected server 10 and a terminal 20. The terminal 20 can be at least one of a mobile phone, tablet computer, smart wearable device, vehicle, camera, or other terminal device capable of capturing images. The server 10 can be implemented using a standalone server or a server cluster consisting of multiple physical servers. It is understood that in other embodiments, the server 10 can also be replaced by a terminal capable of executing the object position prediction methods in the embodiments of this application. Figure 1 Only a schematic diagram of terminal 20 as a vehicle is shown.

[0020] Terminal 20 can acquire images, process the acquired images to obtain sample images with sample labels that identify the locations of objects in the sample images, and send the sample images to server 10 to provide server 10 with sample images for model training to obtain an initial neural network model. Simultaneously, terminal 20 can also acquire images to be detected and send the images to be detected to server 10 so that the target neural network model deployed on server 10 can detect the images to be detected and obtain the locations of target objects in the images. It is understood that server 10 can also directly obtain images already stored by terminal 20.

[0021] It is understood that the initial neural network model in server 10 obtains the target neural network model through multiple rounds of iterative training with quantization thresholds. Therefore, in each iteration of quantization threshold training, server 10 quantizes the initial model parameters to obtain quantized model parameters; based on the first result obtained by the initial neural network model predicting the position of an object in the sample image and the second result obtained by the model corresponding to the quantized model parameters predicting the position of an object in the sample image, noise is introduced; when the introduced noise is greater than a preset noise threshold, the step of quantizing the initial model parameters to obtain quantized model parameters is returned until the introduced noise is not greater than the preset noise threshold, at which point the target neural network model is obtained; based on the target neural network model, the image to be detected is detected to obtain the position of the target object in the image to be detected.

[0022] In some implementations, server 10 can also feed back the position of the target object in the predicted image to terminal 20.

[0023] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0024] Please see Figure 2 This document illustrates a flowchart of an object position prediction method according to an embodiment of this application. The object position prediction method in this embodiment can be applied to computer devices, and is primarily used in the context of computer devices. Figure 1 The method is described in detail in the case of server 10, and includes steps S110 to S150.

[0025] Step S110: Obtain an initial neural network model, wherein the initial neural network model has initial model parameters of first precision.

[0026] In this embodiment, the initial neural network model can be obtained by a computer device from an associated cloud or electronic device via wireless communication technology (such as WiFi, Bluetooth, or ZigbEE), or from an associated electronic device via a serial communication interface (such as an SPI interface), or it can be an initial neural network model pre-stored in the storage unit of the computer device. The initial neural network model can be various types of neural network models, such as DBN (Deep Belief Network), SAE (Stacked Autoencoder), CNN (Convolutional Neural Network), and RNN (Recurrent Neural Network).

[0027] Specifically, the initial neural network model is trained based on multiple sample images with sample labels; where the sample labels are used to identify the location of objects in the sample images.

[0028] In some implementations, the location of objects in a sample image can be identified using sample labels by employing annotation methods such as bounding box annotation, speech segmentation, polygon annotation, keypoint annotation, point cloud annotation, and 3D cube annotation. For example, bounding box annotation can be used to define the location of objects in the sample image.

[0029] The initial neural network model trained on multiple labeled sample images has initial model parameters with a first precision. This first precision refers to the initial distribution of the initial model parameters within the initial neural network model, with each parameter having a first mean and a first standard deviation corresponding to the first precision. The initial neural network model may include a location detection network, an image labeling network, and a target object recognition network. The target object recognition network identifies target objects in the image; the image labeling network labels the image input to the initial neural network model, such as marking or defining objects in the image; and the location detection network calculates the position coordinates of the labeled or defined markers in the image.

[0030] Step S120: Quantize the initial model parameters to obtain quantized model parameters.

[0031] Optionally, quantizing the initial model parameters to obtain quantized model parameters can be achieved by preprocessing the initial model parameters to obtain first initial parameters; calculating an initial threshold for the initial neural network model based on the number of initial model parameters in the initial neural network model; performing precision reduction processing on the first initial parameters using a first scaling parameter and a second scaling parameter to obtain target model parameters; and processing the target model parameters based on the initial threshold to obtain quantized model parameters.

[0032] Specifically, considering that the hyperparameters of each convolutional kernel in the initial neural network model vary greatly, it is difficult to set a universal threshold for each layer of the initial neural network model. Preprocessing the initial model parameters to obtain the first initial parameters can be done by performing normalization processing such as min-max standardization and zero-mean standardization on the initial model parameters to obtain the first initial parameters.

[0033] In one optional embodiment provided in this application, preprocessing the initial model parameters to obtain the first initial parameters can be achieved by performing Euclidean distance normalization on the initial model parameters in the initial neural network model. Specifically, this can be done by substituting the initial model parameters in the initial neural network model into the Euclidean distance normalization formula to perform Euclidean distance normalization on the initial model parameters, thereby obtaining the first initial parameters. The Euclidean distance normalization formula is as follows:

[0034]

[0035] w lk This represents the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. The first initial parameters are obtained after Euclidean distance normalization of the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0036] In this embodiment, calculating the initial threshold of the initial neural network model based on the number of initial model parameters in the initial neural network model can be achieved by substituting the number of initial model parameters into the threshold calculation formula. Specifically, the threshold calculation formula is:

[0037]

[0038] Δ l n represents the initial threshold. l This represents the number of initial model parameters in the l-th layer of the initial neural network model.

[0039] Furthermore, the threshold of the quantized initial neural network model is initialized based on the number of initial model parameters of each convolutional kernel of the initial neural network model, thereby obtaining the initial threshold of each layer of the quantized initial neural network model.

[0040] In this embodiment of the application, the step of using a first scaling parameter and a second scaling parameter to reduce the precision of the first initial parameter to obtain the target model parameter can be achieved by using the first scaling parameter to reduce the precision of the first initial parameter that is not less than 0, and using the second scaling parameter to reduce the precision of the first initial parameter that is less than 0, thereby obtaining the target model parameter.

[0041] In some implementations, the first scaling parameter and the second scaling parameter may be pre-stored in a computer device, or obtained from an associated cloud or electronic device via wireless communication technology, or obtained from an associated electronic device via a serial communication interface.

[0042] The target model parameters are obtained by scaling the initial model parameters. It should be understood that the error of the initial neural network model corresponding to the initial model parameters in predicting the position of the target object in the sample image is smaller than the error of the neural network model corresponding to the target model parameters in predicting the position of the target object in the sample image. That is, the accuracy of the target model parameters is smaller than the first accuracy.

[0043] Specifically, the precision of the target model parameters is less than the first precision, that is, the distribution of the target model parameters is different from the distribution of the initial model parameters, the mean of the target model parameters is different from the mean of the initial model parameters, and the standard deviation of the target model parameters is different from the standard deviation of the initial model parameters. In other words, the precision of the target model parameters is different from the first precision of the initial model parameters.

[0044] Optionally, the precision of the first initial parameters not less than 0 is reduced using a first scaling parameter, and the precision of the first initial parameters less than 0 is reduced using a second scaling parameter, to obtain the target model parameters. Alternatively, the first scaling parameter, the second scaling parameter, and the first initial parameters can be substituted into a first calculation formula to obtain the target model parameters. The first calculation formula is:

[0045]

[0046] This represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the first scaling parameter. This represents the second scaling parameter. The first initial parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model are: [Insert initial parameters here]. The target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model are: [Insert target model parameters here]. The first initial parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. After the first scaling parameter and the second scaling parameter The normalized parameter value obtained after scaling.

[0047] In this embodiment, considering that when the first initial parameter is subjected to precision reduction processing using the first scaling parameter and the second scaling parameter to obtain the target model parameter, there is a possibility that the first initial parameter may be infinitely amplified to obtain the target model parameter, in order to perform appropriate quantization processing on all target model parameters to obtain quantized model parameters, the step of processing the target model parameter based on the initial threshold to obtain the quantized model parameter can be as follows: when the absolute value of the target model parameter is not greater than the hyperparameter threshold, the quantized model parameter is obtained according to the preset derivative value and the target model parameter, so as to quantize the infinitely amplified target model parameter using the hyperparameter threshold, and finally obtain the quantized model parameter corresponding to each of the target model parameters.

[0048] For example, when the preset derivative value is 1, and when the absolute value of the target model parameter is not greater than the hyperparameter threshold, the quantized model parameters can be obtained by using a second calculation formula to calculate the preset derivative value, the hyperparameter threshold, and the target model parameter. The second calculation formula is:

[0049]

[0050] This represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. Indicates the hyperparameter threshold, n l The initial model parameter γ represents the number of initial model parameters in the l-th layer of the initial neural network model.

[0051] The hyperparameters can be pre-stored in the computer device, obtained from the associated cloud via wireless communication technology, or obtained from the associated electronic device via a serial communication interface. Specifically, the magnitude of the hyperparameters can be set by the user or obtained from third-party experimental data. Similarly, the preset derivative values ​​can be pre-stored in the computer device, obtained from the associated cloud via wireless communication technology, or obtained from the associated electronic device via a serial communication interface. Specifically, the magnitude of the hyperparameters can be set by the user or obtained from third-party experimental data.

[0052] In some implementations, when the absolute value of the target model parameter is greater than the hyperparameter threshold, the target model parameter is processed based on the initial threshold to obtain the quantized model parameter. This can be done by adjusting the target model parameter to a first specified value as the quantized model parameter when the target model parameter is less than 0 and the absolute value of the target model parameter is greater than the hyperparameter threshold; adjusting the target model parameter to a second specified value as the quantized model parameter when the absolute value of the target model parameter is less than the hyperparameter threshold; and adjusting the target model parameter to a third specified value as the quantized model parameter when the target model parameter is greater than 0 and the absolute value of the target model parameter is greater than the hyperparameter threshold.

[0053] The first, second, and third specified values ​​can be pre-stored in a computer device, obtained from an associated cloud via wireless communication technology, or obtained from an associated electronic device via a serial communication interface. Specifically, the size of the hyperparameter can be [specific value] or obtained from third-party experimental data, where the first and third specified values ​​are opposites of each other.

[0054] For example, the first specified value of +1, the second specified value of 0, and the third specified value of -1 are pre-set by the user and stored in the computer device. When the absolute value of the target model parameter is greater than the hyperparameter threshold, the target model parameter is processed based on the initial threshold to obtain the quantized model parameter. This can be achieved by using a third calculation formula to calculate the initial threshold and the target model parameter to obtain the quantized model parameter. The third calculation formula is as follows:

[0055]

[0056] Δ represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. l This represents the initial threshold. This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0057] It is understandable that, through a fixed initial threshold Δ l The target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. By corresponding to the quantized model parameters of the kth convolutional kernel in the lth layer of the initial neural network model, a ternary operator model including a first specified value, a second specified value, and a third specified value is obtained, thereby reducing the size of the model for predicting the object position.

[0058] In some implementations, when performing forward inference on the model, the first calculation formula and the third calculation formula can be used sequentially to map the initial model parameters to the quantized model parameters (e.g., mapping the initial model parameters w of the k-th convolutional kernel in the l-th layer of the initial neural network model). lk Quantized model parameters mapped to the k-th convolutional kernel of the l-th layer of the initial neural network model superior).

[0059] Step S130: Based on the first result obtained by the initial neural network model predicting the position of the object in the sample image and the second result obtained by the model corresponding to the quantized model parameters predicting the position of the object in the sample image, noise is introduced.

[0060] In one implementation, an initial neural network model is used to predict the object position in a sample image, resulting in a first sample position detection result corresponding to the object in the sample image. This first sample position detection result includes a bounding box defining the object in the sample image and the coordinates of each vertex of the bounding box. The target object in the sample image is then identified using a target object recognition network within the initial neural network model, resulting in a first target recognition result corresponding to the target object in the sample image. The first sample position detection result and the first target recognition result are combined to obtain a first result. This first result includes a first bounding box defining the target object in the sample image and the first coordinates of the center position of that first bounding box.

[0061] It should be understood that the model corresponding to the quantized model parameters has the same function as the initial neural network model. The model corresponding to the quantized model parameters is used to predict the object position in the sample image, obtaining a second sample position detection result corresponding to the object in the sample image. The target object recognition network in the initial neural network model is used to identify the target object in the sample image, obtaining a second target recognition result corresponding to the target object in the sample image. The second sample position detection result and the second target recognition result are combined to obtain a second result. The second result includes a second bounding box defining the target object in the sample image, and a second coordinate of the center position of the second bounding box.

[0062] Specifically, based on the first result obtained by the initial neural network model predicting the position of an object in the sample image and the second result obtained by the model corresponding to the quantized model parameters predicting the position of an object in the sample image, introduced noise is obtained. This can be the error between the first and second coordinates. Introduced noise is then calculated using an introduced noise calculation formula on the first and second results to obtain the introduced noise. The introduced noise calculation formula is as follows:

[0063]

[0064] in, This represents the output data of the l-th layer of the neural network model corresponding to the quantized model parameters after detecting the target, i.e., the second result, I. l This represents the output data of the l-th layer of the initial neural network model after the initial neural network model detects the target object, which is the first result, and is also the input data of the (l+1)-th layer of the initial neural network model.

[0065] In this embodiment of the application, obtaining the introduced noise based on the quantization model parameters and the initial model parameters can be achieved by substituting the quantization model parameters and the initial model parameters into the introduced noise calculation formula to obtain the introduced noise. The introduced noise calculation formula is as follows:

[0066]

[0067] ε l This represents the loss value in the precision of the output data of the l-th layer of the initial neural network model due to the processing of the first and second scaling parameters on the first initial parameters. L represents the number of layers in the initial neural network model, and l represents the l-th layer of the initial neural network model. w represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. lk This represents the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the expected error between the output of the data processed by the neural network model corresponding to the quantized model parameters and the data processed by the initial neural network model.

[0068] Step S140: When the introduced noise is greater than the preset noise threshold, return to the step of quantizing the initial model parameters to obtain quantized model parameters, until the introduced noise is no greater than the preset noise threshold, and obtain the target neural network model.

[0069] The preset noise threshold can be pre-stored in a computer device, obtained from an associated cloud via wireless communication technology, or obtained from an associated electronic device via a serial communication interface. Specifically, the preset noise threshold can be set by the user or obtained from third-party experimental data. For example, a preset noise threshold of 0.5 obtained from third-party experimental data and pre-stored in a computer device.

[0070] It should be understood that in the embodiments of this application, quantized model parameters are obtained by quantizing the initial model parameters, and the target position in the sample image is predicted by the model corresponding to the quantized model parameters. Due to the quantization process, the result of the model corresponding to the quantized model parameters predicting the target position in the sample image introduces noise compared to the result of the initial neural network model predicting the target position in the sample image.

[0071] The usual way to obtain an accurate image detection model is to use the model to be trained to perform a sample image detection task, obtain the result of the model to be trained on the sample image detection, compare the result with the sample image, obtain the loss value of the result relative to the sample image, adjust the parameters of the detection model according to the loss value, and return to use the model to be trained to perform a sample image detection task until the loss value is no greater than the loss threshold, thus obtaining a final image detection model with high accuracy.

[0072] In this embodiment, the initial neural network model has been trained using multiple sample images with sample labels. The initial neural network model has initial model parameters with a first precision. Considering that the precision of the model corresponding to the quantized model parameters obtained after quantizing the initial model parameters is similar to that of the initial neural network model, when the introduced noise is greater than a preset noise threshold, the step of quantizing the initial model parameters to obtain the quantized model parameters can be returned until the introduced noise is not greater than the preset noise threshold, at which point the target neural network model is obtained.

[0073] It should be understood that, in the embodiments of this application, the loss value of the training model is approximately equal to the introduced noise, that is, the deviation between the detection result of the neural network model corresponding to the quantization model parameters corresponding to the first scaling parameter and the second scaling parameter in the position of the target object in the sample image and the detection result of the target object in the sample image according to the initial neural network model.

[0074] In some implementations, considering the potential error between model detection values ​​and true values, the target detection task provides a predicted location of the target (obstacle, pedestrian, vehicle, etc.) in a two-dimensional image in the form of a bounding box. The neural network model outputs a predicted coordinate of the target's center point. The object's true position is (x, y); C can be the coordinate prediction of the target's center point from the output of the neural network model. The loss obtained by comparing the object's true position (x, y), i.e. ~ indicates approximately equal to, and C represents the error between the model's detected value and the true value. In the embodiments of this application, C can represent the deviation between the detection result of the neural network model corresponding to the quantization model parameters corresponding to the first and second scaling parameters of the target object position in the sample image and the detection result of the target object position in the sample image according to the initial neural network model.

[0075] In some implementations, when the introduced noise is greater than a preset noise threshold, the first scaling parameter and the second scaling parameter are updated according to the introduced noise, and the step of using the first scaling parameter and the second scaling parameter to perform accuracy reduction processing on the first initial parameter is returned until the introduced noise is less than or equal to the preset noise threshold, and the target neural network model is obtained.

[0076] Specifically, when the introduced noise is greater than a preset noise threshold, updating the first scaling parameter and the second scaling parameter according to the introduced noise may involve obtaining, based on the introduced noise, the deviation between the first result of the model processing the sample image based on the quantized model parameters and the second result of the sample image processing based on the initial neural network model; obtaining the gradient of the first scaling parameter and the gradient of the second scaling parameter based on the deviation; and updating the first scaling parameter and the second scaling parameter based on the gradient of the first scaling parameter and the gradient of the second scaling parameter.

[0077] For example, when the introduced noise exceeds a preset noise threshold, the gradient of the first scaling parameter and the gradient of the second scaling parameter are calculated using the fourth calculation formula on the introduced noise, the first scaling parameter, the second scaling parameter, and the target model parameters. The fourth calculation formula is as follows:

[0078]

[0079]

[0080]

[0081] C represents the deviation between the detection result of the neural network model corresponding to the quantization model parameters corresponding to the first and second scaling parameters of the target object position in the sample image and the detection result of the target object position in the sample image according to the initial neural network model. The noise introduced is represented by L, the number of layers in the initial neural network model is represented by l, and ε represents the l-th layer of the initial neural network model. l This represents the loss value in the precision of the output data of the l-th layer of the initial neural network model due to the processing of the first and second scaling parameters on the first initial parameters. This represents the first scaling parameter. This represents the second scaling parameter. This represents the i-th number in the first initial parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the number of the target model parameter i for the k-th convolutional kernel in the l-th layer of the initial neural network model; the first scaling parameter and the second scaling parameter are updated based on the gradient of the first scaling parameter and the gradient of the second scaling parameter.

[0082] It should be understood that the parameters in the model can be a single number, an array, a matrix, etc.

[0083] In some implementations, updating the first and second scaling parameters based on the gradients of the first and second scaling parameters can be achieved by using a pass-through estimator to differentiate the first and third calculation formulas. Let C represent the deviation between the detection result of the neural network model corresponding to the quantization model parameters corresponding to the first and second scaling parameters and the detection result of the target object's position in the sample image based on the initial neural network model; that is, the network loss C, the derivative of the network loss with respect to the target model parameters, instead of the derivative of the network loss with respect to the quantization model parameters.

[0084] The first scaling parameter is obtained using the chain rule. gradient relative to network loss C and the second scaling parameter gradient relative to network loss C Based on the first scaling parameter gradient relative to network loss C and the second scaling parameter Update the first scaling parameter relative to the network loss C. and the second scaling parameter

[0085] In other implementations, when the target model parameters are not greater than the hyperparameter threshold, the first and second scaling parameters are updated based on the gradients of the first and second scaling parameters. This can be achieved by combining the second and fourth calculation formulas to obtain the gradients of the initial model parameters in the initial neural network model.

[0086]

[0087] That is, during each forward propagation of the model, the parameters in the model are normalized. Larger model parameters will become smaller after normalization, preventing a small number of model parameters from growing uncontrollably. At the same time, a hyperparameter threshold can be set as a cutoff term to constrain the upper limit of the model parameters, thereby preventing the first and second scaling parameters from being infinitely amplified.

[0088] In this embodiment, obtaining the target neural network model until the introduced noise is less than or equal to the preset noise threshold can be achieved as follows: when the introduced noise is not greater than the preset noise threshold, obtain the first scaling parameter and the second scaling parameter corresponding to the quantization model parameter corresponding to the introduced noise; scale the initial threshold according to the first scaling parameter and the second scaling parameter to obtain the first scaling threshold and the second scaling threshold; if the first initial parameter is less than the first scaling threshold, adjust the first initial parameter to a first specified value as the quantization model parameter; if the first initial parameter is not less than the first scaling threshold and not greater than the second scaling parameter, adjust the first initial parameter to a second specified value as the quantization model parameter; if the first initial parameter is greater than the second scaling threshold, adjust the first initial parameter to a third specified value as the quantization model parameter; and obtain the target neural network model corresponding to the quantization model parameter according to the quantization model parameter.

[0089] For example, the first specified value is -1, the second specified value is 0, and the third specified value is +1. When the introduced noise is less than or equal to a preset noise threshold, the target neural network model is obtained by calculating the first scaling parameter, the second scaling parameter, and the first initial parameter using the fifth calculation formula. The fifth calculation formula is as follows:

[0090]

[0091] This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the first scaling parameter. This represents the second scaling parameter, Δ. l This represents the initial threshold. This represents the first initial parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. By normalizing the parameters of the convolutional kernels, the parameter values ​​of different convolutional kernels in the same layer of the model are within the same range, thereby allowing the model to share the initial quantization threshold Δ. l . The first scaling threshold, This is the second scaling threshold.

[0092] Step S150: Detect the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected.

[0093] In this embodiment, the target neural network model is used to detect the position of a target object in an image to be detected. Specifically, after obtaining the target neural network model, it is deployed on a computer device to detect the position of the target object. The target neural network model can also be deployed on a device such as... Figure 1The image can also be deployed on vehicles 20, as well as on devices that can capture images, such as mobile phones, smart wearable devices, and tablets.

[0094] For example, when the target neural network model is deployed on such Figure 1 The process by which vehicle 20 detects the target object in the image to be detected based on the target neural network model is as follows: If a radar image or a two-dimensional image is acquired by the radar or vision sensor in vehicle 20, the target neural network model is used to identify the acquired image to obtain the position of the target object in the image. The target object can specifically be a pedestrian, vehicle, or obstacle, etc.

[0095] In this approach, after identifying the target object using the target neural network model, the target object in the image to be detected can be bounded by a rectangular frame. At the same time, the coordinates of the vertices of the rectangular frame that bound the target object in the image to be detected are obtained through the position detection network in the target neural network, and then the coordinates of the center of the rectangular frame are obtained. Finally, the predicted position of the target object in the image to be detected is output, wherein the predicted result includes the rectangular frame that bound the target object in the image and the coordinates of the center of the rectangular frame.

[0096] The technical solution of this application involves obtaining an initial neural network model with initial model parameters of a first precision. This initial neural network model is trained on multiple sample images with sample labels, which are used to identify the positions of objects in the sample images. The initial model parameters are quantized to obtain quantized model parameters. Based on the first result of the initial neural network model's prediction of the object's position in the sample image and the second result of the model corresponding to the quantized model parameters' prediction of the object's position in the sample image, noise is introduced. When the introduced noise exceeds a preset noise threshold, the process of quantizing the initial model parameters is repeated until the introduced noise is no greater than the preset noise threshold, at which point a target neural network model is obtained. The target neural network model is then used to detect the image to be detected, thus obtaining the position of the target object in the image. Therefore, by employing the above method of this application, using a trainable quantization threshold algorithm, the size of the initial neural network model is reduced, a target neural network model for detecting the position of the target object is obtained, and the position of the target object is inferred using the parameters in the target neural network model. This improves the model's inference speed while considering hardware computing power, shortening the delay in predicting the target object's position and reducing the cost of predicting the target object's position.

[0097] Please see Figure 3The present invention illustrates an object position prediction device provided in an embodiment of the present invention. The device 200 includes: an initial model acquisition unit 210, a quantization parameter acquisition unit 220, a noise acquisition unit 230, a target model acquisition unit 240, and a position prediction unit 250. Specifically, the initial model acquisition unit 210 is used to acquire an initial neural network model, which has initial model parameters of a first precision. The initial neural network model is trained based on multiple sample images with sample labels, which are used to identify the positions of objects in the sample images. The quantization parameter acquisition unit 220 is used to quantize the initial model parameters to obtain quantized model parameters. The noise acquisition unit 230 is used to acquire introduced noise based on the detection results obtained by the initial neural network model predicting the positions of objects in the sample images and the detection results obtained by the model corresponding to the quantized model parameters predicting the positions of objects in the sample images. The target model acquisition unit 240 is used to return to the step of quantizing the initial model parameters to obtain quantized model parameters when the introduced noise is greater than a preset noise threshold, until the acquired introduced noise is less than or equal to the preset noise threshold, and then acquire the target neural network model. The position prediction unit 250 is used to detect the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected.

[0098] In one implementation, in the method of ternary operator quantization model, the initial model acquisition unit 210 acquires an initial neural network model trained on multiple sample images with sample labels from an associated cloud via WiFi technology, wherein the sample labels are used to identify the position of objects in the sample images; the initial neural network model has initial model parameters with a first precision.

[0099] The quantization parameter acquisition unit 220 substitutes the initial model parameters from the initial neural network model into the Euclidean distance normalization formula to perform Euclidean distance normalization on the initial model parameters, thereby obtaining the first initial parameters. The Euclidean distance normalization formula is as follows:

[0100]

[0101] w lk This represents the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. The first initial parameters are obtained after Euclidean distance normalization of the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0102] The quantization parameter acquisition unit 220 substitutes the number of initial model parameters in the initial neural network model into the threshold calculation formula to obtain the initial threshold, wherein the threshold calculation formula is:

[0103]

[0104] Δ l n represents the initial threshold. l This represents the number of initial model parameters in the l-th layer of the initial neural network model.

[0105] The quantization parameter acquisition unit 220 inputs the first initial parameter and the first scaling parameter and the second scaling parameter pre-stored in the quantization parameter acquisition unit 220 into a first calculation formula to obtain the target model parameters. The first calculation formula is:

[0106]

[0107] This represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the first scaling parameter. This represents the second scaling parameter. This represents the first initial parameter of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0108] The quantization parameter acquisition unit 220, when the absolute value of the target model parameter is not greater than the hyperparameter threshold calculated based on the hyperparameters pre-stored in the quantization unit 220, substitutes the target model parameter into the second calculation formula to obtain the quantized model parameter. The second calculation formula is:

[0109]

[0110] This represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. Indicates the hyperparameter threshold, n l This represents the number of initial model parameters for the l-th layer of the initial neural network model.

[0111] When the target model parameters are less than the hyperparameter threshold, the initial threshold and the target model parameters are substituted into the third calculation formula to process the target model parameters and obtain the quantized model parameters. The third calculation formula is as follows:

[0112]

[0113] Δ represents the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. l This represents the initial threshold. This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0114] The noise acquisition unit 230 introduces the quantized model parameters and the initial model parameters into the noise acquisition formula to obtain the introduced noise. The noise acquisition formula is as follows:

[0115]

[0116] ε l This represents the loss value in the precision of the output data of the l-th layer of the initial neural network model due to the processing of the first and second scaling parameters on the first initial parameters. L represents the number of layers in the initial neural network model, and l represents the l-th layer of the initial neural network model. w represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. lk This represents the initial model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the expected error between the output of the data processed by the neural network model corresponding to the quantized model parameters and the data processed by the initial neural network model.

[0117] When the introduced noise exceeds a preset noise threshold stored in the target model acquisition unit 240, the target model acquisition unit 240 substitutes the first scaling parameter, the second scaling parameter, and the introduced noise into a fourth calculation formula to obtain the gradient of the first scaling parameter and the gradient of the second scaling parameter. The fourth calculation formula is as follows:

[0118]

[0119]

[0120]

[0121] C represents the deviation between the detection result of the neural network model corresponding to the quantization model parameters corresponding to the first and second scaling parameters and the data, i.e., the network loss. The noise is introduced, L represents the number of layers in the initial neural network model, and l represents the l-th layer of the initial neural network model. This represents the first scaling parameter. This represents the second scaling parameter. This represents the first initial parameter of the k-th convolutional kernel in the l-th layer of the initial neural network model. Let represent the target model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model, where i represents the i-th number in the parameters. That is, the gradients of the first scaling parameter and the second scaling parameter are obtained using the network loss according to the chain rule, and then the first and second scaling parameters are updated.

[0122] Meanwhile, the target model acquisition unit 240 utilizes a pass-through estimator and uses the network loss C relative to the target model parameters. The derivative of the network loss C is used to replace the derivative of the quantized model parameters, and the gradient of the third calculation formula during backpropagation is obtained. The initial threshold is updated by gradient descent, and the threshold of the quantized model parameters is adjusted during the training process, so that the model is more uniform in the various intervals of the threshold division.

[0123] After updating the first scaling parameter and the second scaling parameter, the target model acquisition unit 240 returns to perform precision reduction processing on the first initial parameter using the first scaling parameter and the second scaling parameter until the introduced noise is less than or equal to the preset noise threshold. Then, it acquires the first scaling parameter and the second scaling parameter corresponding to the quantized model parameter of the introduced noise. The first scaling parameter, the second scaling parameter, the initial threshold, and the first initial parameter are then substituted into the fifth calculation formula to obtain the target neural network model. The fifth calculation formula is:

[0124]

[0125] This represents the quantized model parameters of the k-th convolutional kernel in the l-th layer of the initial neural network model. This represents the first scaling parameter. This represents the second scaling parameter, Δ. l This represents the initial threshold. This represents the first initial parameter of the k-th convolutional kernel in the l-th layer of the initial neural network model.

[0126] The position prediction unit 250 is used to detect the image to be detected based on the target neural network model to obtain the position of the target object in the image to be detected.

[0127] After identifying the target object using the target neural network model, the target object in the image to be detected is bounded by a rectangular box. At the same time, the coordinates of the vertices of the rectangular box that bound the target object in the image to be detected are obtained through the position detection network in the target neural network, and then the coordinates of the center of the rectangular box are obtained. Finally, the predicted result of the position of the target object in the image to be detected is output, wherein the predicted result includes the rectangular box that bound the target object in the image and the coordinates of the center of the rectangular box.

[0128] The technical solution of this application utilizes a gradient descent method to update the threshold of the quantized model parameters. A variable and asymmetric threshold is used as the quantization parameter to quantize the initial model parameters of the initial neural network model to obtain the target neural network model. When the expected value of the estimation of the initial model parameters in the initial neural network model using the quantized parameters is within a preset noise threshold range, the quantized model parameters are more evenly distributed across the threshold intervals. This reduces the model's storage space while ensuring the accuracy of the model's target position prediction during the quantization process after precision reduction processing of the model parameters. It also improves the neural network model's target estimation speed, reduces the latency of deploying the neural network model, and lowers the cost of predicting object positions.

[0129] It should be understood that the object position prediction method provided in this application embodiment can be applied to the ternary operator quantization model, the quantization method of discretized variables (2-bit, 4-bit), and the model quantization compression of other deep learning tasks.

[0130] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For device embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to in the descriptions of the method embodiments. Any processing method described in the method embodiments can be implemented in the device embodiments through corresponding processing modules, and will not be elaborated upon further in the device embodiments.

[0131] Please see Figure 4 Based on the aforementioned object position prediction method, this application also provides another electronic device 300 capable of executing the aforementioned object position prediction method. The electronic device 300 includes one or more processors 310, a memory 320, and one or more application programs. The memory 320 stores programs capable of executing the content described in the aforementioned embodiments, and the processors 310 can execute the programs stored in the memory 320. The electronic device 300 can be a smart control panel, smartphone, smart robot, tablet computer, personal computer, vehicle, smart wearable device, etc.

[0132] The processor 310 may include one or more cores for data processing and message matrix units. The processor 310 connects to various parts of the electronic device via various interfaces and lines, and performs various functions and processes data of the electronic device 300 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 320, and by calling data stored in the memory 320. Optionally, the processor 310 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 310 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also be implemented separately as a communication chip, without being integrated into the processor.

[0133] The memory 320 may include random access memory (RAM) or read-only memory (ROM). The memory 320 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 320 may include a program storage area and a data storage area. The program storage area may store the code for the model training method or image recognition method described in the above method embodiments, and instructions for implementing at least one function (such as an initial threshold). The data storage area may also store target multi-task learning models created by the terminal during use.

[0134] As one implementation method, the electronic device 300 is a vehicle. In the deployment of autonomous driving in the vehicle, due to the limited computing power of the hardware platform, the object position prediction method provided in this application embodiment is used to effectively quantify the model for detecting the object position in the autonomous driving deployment. While keeping the performance of the model unchanged, the model size is reduced and the latency of the execution task is reduced, thus saving the cost of predicting the object position.

[0135] Please see Figure 5This diagram illustrates a structural block diagram of a computer-readable storage medium 400 according to an embodiment of this application. The computer-readable storage medium 400 stores program code 410, which can be called by a processor to execute the model training method described in the above method embodiments.

[0136] The computer-readable storage medium 400 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 400 has storage space for program code 410 that performs any of the method steps described above. This program code 410 can be read from or written to one or more computer program products. The program code 410 may, for example, be compressed in a suitable form.

[0137] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for predicting the position of an object, characterized in that, The method includes: An initial neural network model is obtained, wherein the initial neural network model has initial model parameters of first precision, and the initial neural network model is trained based on multiple sample images with sample labels, wherein the sample labels are used to identify the position of objects in the sample images; The initial model parameters are quantized to obtain quantized model parameters; Based on the first result obtained by the initial neural network model predicting the position of objects in the sample image and the second result obtained by the model corresponding to the quantized model parameters predicting the position of objects in the sample image, noise is introduced. When the introduced noise is greater than the preset noise threshold, return to the step of quantizing the initial model parameters to obtain quantized model parameters, until the introduced noise is no greater than the preset noise threshold, and obtain the target neural network model. Based on the target neural network model, the position of the target object in the image to be detected is obtained; The step of quantizing the initial model parameters to obtain quantized model parameters includes: The initial model parameters are preprocessed to obtain the first initial parameters; Calculate the initial threshold of the initial neural network model based on the number of initial model parameters in the initial neural network model; The first initial parameters are subjected to a precision reduction process using a first scaling parameter and a second scaling parameter to obtain target model parameters, wherein the precision of the target model parameters is lower than the first precision. Based on the initial threshold, the target model parameters are processed to obtain quantized model parameters.

2. The method according to claim 1, characterized in that, The preprocessing of the initial model parameters to obtain the first initial parameters includes: The initial model parameters in the initial neural network model are normalized using Euclidean distance to obtain the first initial parameters.

3. The method according to claim 1, characterized in that, The step of using a first scaling parameter and a second scaling parameter to perform precision reduction processing on the first initial parameters to obtain the target model parameters includes: The first initial parameters that are not less than 0 are subjected to precision reduction processing using the first scaling parameter, and the first initial parameters that are less than 0 are subjected to precision reduction processing using the second scaling parameter, to obtain the target model parameters.

4. The method according to claim 1, characterized in that, The process of processing the target model parameters based on the initial threshold to obtain quantized model parameters includes: When the absolute value of the target model parameter is not greater than the hyperparameter threshold, the quantized model parameter is obtained according to the preset derivative value and the target model parameter.

5. The method according to claim 4, characterized in that, When the absolute value of the target model parameter is greater than the hyperparameter threshold, the target model parameter is processed based on the initial threshold to obtain quantized model parameters, including: When the target model parameter is less than 0 and the absolute value of the target model parameter is greater than the hyperparameter threshold, the target model parameter is adjusted to a first specified value as the quantization model parameter; When the absolute value of the target model parameter is less than the hyperparameter threshold, the target model parameter is adjusted to a second specified value as the quantized model parameter; When the target model parameter is greater than 0 and the absolute value of the target model parameter is greater than the hyperparameter threshold, the target model parameter is adjusted to a third specified value as the quantization model parameter, wherein the first specified value and the third specified value are opposites of each other.

6. The method according to claim 5, characterized in that, When the introduced noise exceeds a preset noise threshold, the step of quantizing the initial model parameters to obtain quantized model parameters is returned until the introduced noise is less than or equal to the preset noise threshold, thus obtaining the target neural network model, including: When the introduced noise is greater than a preset noise threshold, the first scaling parameter and the second scaling parameter are updated according to the introduced noise, and the step of using the first scaling parameter and the second scaling parameter to perform accuracy reduction processing on the first initial parameter is returned until the introduced noise is less than or equal to the preset noise threshold, and the target neural network model is obtained.

7. The method according to claim 6, characterized in that, When the introduced noise exceeds a preset noise threshold, updating the first scaling parameter and the second scaling parameter based on the introduced noise includes: Based on the introduced noise, a first result is obtained from the model's prediction of the object's position in the sample image based on the quantized model parameters, and a second result is obtained from the prediction of the object's position in the sample image based on the initial neural network model; Based on the deviation, the gradient of the first scaling parameter and the gradient of the second scaling parameter are obtained; The first scaling parameter and the second scaling parameter are updated based on the gradient of the first scaling parameter and the gradient of the second scaling parameter.

8. The method according to claim 7, characterized in that, The process of obtaining the target neural network model until the introduced noise is no greater than the preset noise threshold includes: When the introduced noise is not greater than the preset noise threshold, the first scaling parameter and the second scaling parameter corresponding to the quantization model parameter corresponding to the introduced noise are obtained. The initial threshold is scaled according to the first scaling parameter and the second scaling parameter to obtain a first scaling threshold and a second scaling threshold. If the first initial parameter is less than the first scaling threshold, the first initial parameter is adjusted to the first specified value as the quantization model parameter; If the first initial parameter is not less than the first scaling threshold and not greater than the second scaling parameter, the first initial parameter is adjusted to the second specified value as the quantization model parameter. If the first initial parameter is greater than the second scaling threshold, the first initial parameter is adjusted to the third specified value as the quantization model parameter; The target neural network model corresponding to the quantization model parameters is obtained based on the quantization model parameters.

9. An object position prediction device, characterized in that, The device includes: An initial model acquisition unit is used to acquire an initial neural network model, wherein the initial neural network model has initial model parameters of a first precision, and the initial neural network model is trained based on multiple sample images with sample labels, wherein the sample labels are used to identify the position of objects in the sample images; The quantization parameter acquisition unit is used to quantize the initial model parameters to obtain quantized model parameters; A noise acquisition unit is used to acquire introduced noise based on the detection results obtained by the initial neural network model predicting the position of objects in the sample image and the detection results obtained by the model corresponding to the quantized model parameters predicting the position of objects in the sample image. The target model acquisition unit is used to return to the step of quantizing the initial model parameters to obtain quantized model parameters when the introduced noise is greater than a preset noise threshold, until the introduced noise is less than or equal to the preset noise threshold to obtain the target neural network model; The location prediction unit is used to detect the image to be detected based on the target neural network model and obtain the location of the target object in the image to be detected. The quantization parameter acquisition unit is specifically used to preprocess the initial model parameters to obtain first initial parameters; calculate the initial threshold of the initial neural network model based on the number of initial model parameters in the initial neural network model; perform precision reduction processing on the first initial parameters using a first scaling parameter and a second scaling parameter to obtain target model parameters, wherein the precision of the target model parameters is lower than the first precision; and process the target model parameters based on the initial threshold to obtain quantized model parameters.

10. An electronic device, characterized in that, include: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Model compression method and device

    CN112257858A