WO2023040626A1 - 神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品 - Google Patents

神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品 Download PDF

Info

Publication number
WO2023040626A1
WO2023040626A1 PCT/CN2022/114914 CN2022114914W WO2023040626A1 WO 2023040626 A1 WO2023040626 A1 WO 2023040626A1 CN 2022114914 W CN2022114914 W CN 2022114914W WO 2023040626 A1 WO2023040626 A1 WO 2023040626A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
loss function
function value
training
sub
Prior art date
Application number
PCT/CN2022/114914
Other languages
English (en)
French (fr)
Inventor
张正夫
梁鼎
吴一超
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2023040626A1 publication Critical patent/WO2023040626A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to a neural network training and character recognition method, device, equipment, storage medium and computer program product.
  • neural networks are widely used in the field of computer vision, such as text recognition, semantic segmentation, object detection and other fields.
  • these neural networks with excellent performance often have tens of millions of parameters. The huge amount of parameters will bring about an increase in accuracy, but at the same time it will cause a decrease in inference speed.
  • a network training method is provided in the related art.
  • the above method can design a neural network according to the desired inference speed, and directly use the text recognition training data and labels to train the network.
  • the precision of the network is low, and the application requirements of high precision and high efficiency cannot be considered.
  • Embodiments of the present disclosure at least provide a method, device, device, storage medium, and computer program product for neural network training and character recognition.
  • an embodiment of the present disclosure provides a method for training a neural network, the method comprising: acquiring training data; extracting the training data based on the first feature extraction layer of the first neural network to obtain the first feature Figure, extracting the training data based on the second feature extraction layer of the second neural network to obtain a second feature map; wherein, the network accuracy of the first neural network is higher than the network accuracy of the second neural network; Based on the first feature map and the second feature map, determine a loss function value of the second neural network; train the second neural network based on the determined loss function value to obtain a trained Second neural network.
  • an embodiment of the present disclosure also provides a method for character recognition, the method including: acquiring an image to be recognized;
  • the second neural network is configured to recognize the image to be recognized to obtain a character recognition result output by the second neural network.
  • an embodiment of the present disclosure also provides a neural network training device, the device comprising: an acquisition module configured to acquire training data; an extraction module configured to extract a pair of features based on the first neural network's first feature extraction layer The training data is extracted to obtain a first feature map, and the training data is extracted based on the second feature extraction layer of the second neural network to obtain a second feature map, wherein the network accuracy of the first neural network is high Based on the network accuracy of the second neural network; the determination module is configured to determine the loss function value of the second neural network based on the first feature map and the second feature map; the training module is configured to be based on The determined loss function value is adjusted to the second neural network to obtain a trained second neural network.
  • an embodiment of the present disclosure further provides a device for character recognition, the device comprising: an acquisition module configured to acquire an image to be recognized; a recognition module configured to The trained second neural network obtained by the method recognizes the image to be recognized, and obtains a text recognition result output by the second neural network.
  • an embodiment of the present disclosure further provides an electronic device, including: a processor, a memory, and a bus, the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the The processor communicates with the memory through a bus, and when the machine-readable instructions are executed by the processor, the steps of the neural network training method as described in the first aspect and any of its various implementations are executed or as described in The steps of the character recognition method described in the second aspect.
  • the embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor as in the first aspect and its various implementation modes Any of the steps of the neural network training method or the steps of the character recognition method as described in the second aspect.
  • the embodiments of the present disclosure also provide a computer program product, including a computer-readable storage medium storing program codes, and when instructions included in the program codes are run by a processor of a computer device, the implementation of claims 1 to The step of the method for neural network training described in any one of 12 or the step of the method for character recognition as claimed in claim 13.
  • the above method by obtaining two neural networks with different network precisions (i.e. the first neural network and the second neural network), can guide the second neural network with low network precision based on the first neural network with high network precision. train.
  • the loss function value of the second neural network can be determined based on the feature maps output by the two neural networks, and then the network parameters can be adjusted based on the loss function value. It can be seen that the closer the feature maps output by the two neural networks are, to a certain extent, the more sufficient the features learned by the second neural network from the first neural network are, so that the training efficiency can be improved while ensuring the training efficiency. training accuracy.
  • FIG. 1 shows a flowchart of a method for neural network training provided by an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of a neural network training device provided by an embodiment of the present disclosure
  • FIG. 3 shows a schematic diagram of a character recognition device provided by an embodiment of the present disclosure
  • Fig. 4 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
  • a network training scheme is provided in the related art.
  • the above scheme can design a neural network according to the desired inference speed, and directly use the text recognition training data and labels to train the network.
  • the precision of the network is low, and the application requirements of high precision and high efficiency cannot be considered.
  • the present disclosure provides a method, device, device, storage medium and computer program product for neural network training and character recognition, so as to improve training accuracy while ensuring training efficiency.
  • the execution subject of the neural network training method provided in the embodiments of the present disclosure is generally a computer with certain computing power equipment, the computer equipment includes, for example: terminal equipment or server or other processing equipment, the terminal equipment can be user equipment (User Equipment, UE), mobile equipment, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant) Assistant, PDA), handheld devices, computing devices, vehicle-mounted devices, wearable devices, etc.
  • the neural network training method may be implemented by a processor invoking computer-readable instructions stored in a memory.
  • FIG. 1 it is a flow chart of a neural network training method provided by an embodiment of the present disclosure.
  • the method is executed by an electronic device, and the method includes steps S101 to S104, wherein:
  • S102 Extract the training data based on the first feature extraction layer of the first neural network to obtain a first feature map, and extract the training data based on the second feature extraction layer of the second neural network to obtain a second feature Figure; wherein, the network precision of the first neural network is higher than the network precision of the second neural network;
  • S104 Adjust the second neural network based on the determined loss function value to obtain a trained second neural network.
  • the neural network training method in the embodiments of the present disclosure can be applied to the technical field of network compression, and such network compression arises with the training requirement for high inference speed.
  • the network training scheme provided by related technologies can design a small neural network based on the expected inference speed. However, the training accuracy is not enough because the designed network does not set the accuracy.
  • the embodiments of the present disclosure provide a training scheme that uses a high-precision large network (ie, the first neural network) to guide a small network (ie, the second neural network), taking into account both inference speed and accuracy dual needs.
  • a high-precision large network ie, the first neural network
  • a small network ie, the second neural network
  • the functions of the neural network here are also different.
  • the neural network here may be a character recognition network; for another example, for an object detection scenario, the neural network here may be an object detection network.
  • the text recognition network is used as an example to illustrate the neural network.
  • the training data here may be image data containing text
  • the first neural network and the second neural network may be networks for determining text information from such image data.
  • the network structure complexity of the first neural network is much higher than the network structure complexity of the second neural network, based on such a complexity setting, it can be ensured that the first network accuracy of the first neural network is higher than that of the second neural network Second network accuracy. This is because a network with a more complex network structure can often mine deeper features, thereby improving the high precision of training.
  • the precision of the network can be improved as much as possible by rationally designing the structure of the network and increasing the parameters of the network.
  • the inference speed of the network does not need to be considered here.
  • EfficientNet which has higher precision in the image classification network, and at the same time enlarge the network depth (corresponding to the number of network layers), network width (corresponding to the number of channels), and the resolution of training data to improve network accuracy.
  • the inference speed of the network needs to be high enough, and at the same time, it also needs to have a certain precision, because the network with poor precision has no practical value, here the first
  • the second neural network can be a neural network with less precision and higher inference speed.
  • the second neural network here may be obtained by tailoring based on the first neural network, or may be obtained by tailoring based on other original networks.
  • the first neural network and the second neural network can be used to extract the corresponding first feature map and second feature map respectively, and then based on the first feature map and the second feature map
  • the loss function value determined by the similarity between the two feature maps adjusts the second neural network.
  • the first neural network is used as a guide network, and the network parameters are kept unchanged during the training process for the second neural network.
  • the backbone network (corresponding feature extraction function) of the first neural network generally contains more semantic information
  • the feature of the second neural network can be synchronously Extract and use feature similarity to achieve the above-mentioned guiding purpose.
  • the first neural network may be composed of multiple first feature extraction layers
  • the second neural network may be composed of multiple second feature extraction layers.
  • the features in the extracted semantic information are also richer, usually the feature map output by the last feature extraction layer can be selected to achieve feature comparison.
  • the embodiments of the present disclosure take into account the actual business scenario requirements.
  • some feature extraction layers before this also bring certain guiding significance to the network.
  • the last N feature extraction layers can be selected to output
  • the feature map of is used as the feature map output by the neural network.
  • N represents a preset number, which can be selected according to different business requirements or actual network complexity. For example, for a more complex network, a larger number of feature extraction layers can be selected.
  • the loss function value of the second neural network may be determined based on the acquired N first feature maps and N second feature maps. That is, it is possible to determine the feature similarity between the first feature map and the second feature map of the corresponding layer, and then determine the first sub-loss function value of the second neural network based on the feature similarity of each layer.
  • the process of determining the feature similarity of the corresponding two feature maps in the process of determining the feature similarity of the corresponding two feature maps (ie, the first feature map and the second feature map), it can be calculated layer by layer, for example, first calculate the distance between the two feature maps of the last layer Feature similarity, and then calculate the feature similarity between the two feature maps of the penultimate layer, the penultimate layer, and the third layer. It can also be calculated in multiple layers at the same time, that is, the two features corresponding to each layer are calculated at the same time
  • the feature similarity between graphs is not limited here.
  • weights can be set for different layers, so as to provide a more practical reference for the first sub-loss function value.
  • the first round of training can be performed on the second neural network, that is, the output feature map of the last layer or several layers of the small network is constrained to make it more It is close to the output feature map of the last layer or several layers of the large network, so that the small network can learn the excellent characteristics of the large network in the feature extraction process, so as to have better feature extraction capabilities.
  • the embodiment of the present disclosure can only use the first sub-loss function value, because the gap between the small network and the large network is reflected in the feature extraction ability of the backbone network, in other words, it is reflected in the network The difference between the output feature maps of the last layer or several layers.
  • the backbone network of the small network has obtained the feature extraction ability of the backbone network close to the large network.
  • the loss function value may be compared with the first preset threshold.
  • an adjustment of the second neural network may be performed.
  • the value of the first sub-loss function is also updated, and then compared again, and the loop is executed until the first round of network convergence is reached.
  • the second neural network here also includes a classification layer. After the first round of adjustment is completed, the network parameters of the classification layer can be optimized. Similarly, you can first determine the loss function value of the relevant classification layer according to the following steps, and then realize the second round of adjustment.
  • Step 1 classify the second feature map of the last layer of the second neural network based on the classification layer included in the second neural network, and obtain the classification result output by the classification layer;
  • Step 2 Determine the second sub-loss function value of the second neural network based on the classification result output by the classification layer and the classification label carried in the training data;
  • Step 3 Perform a second round of training on the second neural network based on the determined first sub-loss function value and the second sub-loss function value to obtain the second neural network after the second round of training.
  • the second sub-loss function value may be determined based on a comparison result between the classification result output by the classification layer and the classification label. The closer the comparison result is, the smaller the corresponding loss function value is, and vice versa.
  • the second round of adjustment here can be joint training of the network using the first sub-loss function and the second sub-loss function until the network reaches the second round of convergence.
  • different weights can be set for the first sub-loss function value and the second sub-loss function value to achieve the technical purpose of optimizing the classification layer without destroying the parameters of the backbone network.
  • it can be achieved through the following steps:
  • Step 1 During the second round of adjustment for the second neural network, determine the first weight corresponding to the first sub-loss function value, and the second weight corresponding to the second sub-loss function value; wherein, the first The weight is negatively correlated with the number of training in the second round of training, and the second weight is positively correlated with the number of training in the second round of training;
  • Step 2 performing weighted summation of the first sub-loss function value and the corresponding first weight, and the second sub-loss function value and the corresponding second weight, to determine the weighted loss function value of the second neural network;
  • Step 3 Perform a second round of training on the second neural network based on the weighted loss function value to obtain the second neural network after the second round of training.
  • the reason why the second sub-loss function is not used for training is that the parameters of the classification layer are still in a random initial state at the beginning of the introduction of the second sub-loss function, and only the second sub-loss function is used.
  • the method of joint training is adopted here, and the first sub-loss function can be continued to optimize the classification layer network while maintaining the parameter status of the backbone network.
  • the role of the first sub-loss function becomes less and less important. Therefore, the first weight of the first sub-loss function is continuously reduced until it is 0, and the second weight of the second sub-loss function is continuously reduced. increase until the second round of convergence is reached.
  • the setting of the first weight and the second weight can be done dynamically, that is, as the number of training times increases in the second round of training, the weight adjustment can be performed every number of times.
  • the first weight may also be adjusted in combination with a corresponding decreasing function, and a corresponding increasing function may be used to adjust the second weight.
  • the training of the classification layer of the neural network can also directly adopt the joint training method to simultaneously train the backbone network and the classification layer. In some embodiments, it can be achieved through the following steps:
  • Step 1 classify the second feature map extracted by the second feature extraction layer based on the classification layer included in the second neural network, and obtain the classification result output by the classification layer;
  • Step 2 Determine the first sub-loss function value of the second neural network based on the second feature map and the first feature map, and determine the value of the second neural network based on the classification result output by the classification layer and the classification label carried in the training data.
  • the second sub-loss function value
  • Step 3 Determine the loss function value of the second neural network based on the first sub-loss function value and the second sub-loss function value.
  • the first sub-loss function value and the second sub-loss function value may be respectively determined to determine the loss function value of the second neural network.
  • the first preset threshold, the second preset threshold and the third preset threshold can be set according to different application requirements, which is not limited here.
  • the first neural network and the second neural network in the embodiment of the present disclosure are used as the basic network for realizing network compression, which will be described separately next.
  • the embodiment of the present disclosure may determine the first neural network according to the following steps:
  • Step 1 obtaining the first neural network of each candidate
  • Step 2 Determine the network accuracy of each candidate first neural network based on the preset first network parameters;
  • the preset first network parameters include one or more of network depth, network width or resolution of training data;
  • Step 3 Selecting the candidate first neural network corresponding to the maximum network accuracy in the network accuracy as the first neural network.
  • a higher-precision first neural network may be selected based on first network parameters of different reference dimensions. This is because relevant network parameters such as network depth, network width, or training data resolution directly affect the complexity of the network structure. The deeper the network depth, the wider the network width, and the higher the resolution of the training data, it also explains to a certain extent The higher the complexity of the network structure, the richer the corresponding semantic information mined, which in turn improves the accuracy of the network.
  • the embodiment of the present disclosure may determine the second neural network according to the following steps:
  • Step 1 using preset clipping parameters to clip the first neural network to obtain the clipped first neural network
  • Step 2 determining whether the network reasoning speed of the first neural network after pruning is higher than the preset speed
  • Step 3 if yes, determine the pruned first neural network as the second neural network.
  • the second neural network can be determined based on the pruning operation of the first neural network, so that the network inference speed of the determined second neural network is not only faster, but also can maintain structural consistency with the first neural network to a certain extent , which is convenient for subsequent network training.
  • the clipping operation may be determined based on preset clipping parameters, for example, how many channels are clipped, or how many network layers are clipped.
  • the network inference speed of the first pruned neural network can be tested by sending the training data to this network.
  • By combining the output speed with the preset By comparing the speeds, it can be determined whether the pruned first neural network meets the speed requirement of the second neural network.
  • the embodiment of the present disclosure also provides a method for text recognition, the method is executed by an electronic device, and the method includes the following steps:
  • Step 1 obtaining the image to be recognized
  • Step 2 Recognize the image to be recognized based on the trained second neural network obtained by the neural network training method, and obtain a text recognition result output by the second neural network.
  • the image to be recognized acquired here may be an image that needs to be recognized.
  • the second neural network can be used to obtain a character recognition result, where the character recognition result can be related to handwritten, printed and other text content.
  • the above-mentioned second neural network can also be a neural network with a target detection function, and then can realize the detection of related target objects, and can also be other neural networks.
  • the embodiment of the present disclosure also provides a device corresponding to the method. Since the problem-solving principle of the device in the embodiment of the present disclosure is similar to the above-mentioned method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method.
  • Fig. 2 is a schematic diagram of a neural network training device provided by an embodiment of the present disclosure. As shown in Fig. 2, the device includes: a first acquisition module 201, an extraction module 202, a determination module 203 and a training module 204; wherein,
  • the first acquiring module 201 is configured to acquire training data
  • the extraction module 202 is configured to extract the training data based on the first feature extraction layer of the first neural network to obtain a first feature map, and extract the training data based on the second feature extraction layer of the second neural network, A second feature map is obtained; wherein, the network accuracy of the first neural network is higher than the network accuracy of the second neural network;
  • the determining module 203 is configured to determine a loss function value of the second neural network based on the first feature map and the second feature map;
  • the training module 204 is configured to adjust the second neural network based on the determined loss function value to obtain the trained second neural network.
  • the low network precision can be guided based on the first neural network with high network precision.
  • the training of the second neural network During the training process, the loss function value of the second neural network can be determined based on the feature maps output by the two neural networks, and then the network parameters can be adjusted based on the loss function value. It can be seen that the closer the feature maps output by the two neural networks are, the more sufficient the features learned by the second neural network from the first neural network are to a certain extent, so that the training efficiency can be improved while ensuring the training efficiency. training accuracy.
  • the first neural network includes a plurality of first feature extraction layers
  • the second neural network includes a plurality of second feature extraction layers
  • the extraction module 202 extracts the training data based on the first feature extraction layer of the first neural network to obtain a first feature map, and extracts the training data based on the second feature extraction layer of the second neural network, In the case of obtaining the second feature map, the configuration is:
  • N is a preset number
  • the loss function value of the second neural network includes the first sub-loss function value
  • the determining module 203 determines the second neural network based on the first feature map and the second feature map according to the following steps: In the case of the value of the loss function, the configuration is:
  • the value of the first sub-loss function of the second neural network is determined.
  • the training module 204 is configured to adjust the second neural network based on the determined loss function value to obtain the trained second neural network according to the following steps:
  • a first round of training is performed on the second neural network based on the determined first sub-loss function value to obtain a second neural network after the first round of training.
  • the training module 204 performs the first round of training on the second neural network based on the determined first sub-loss function value according to the following steps to obtain the situation of the second neural network after the first round of training
  • the configuration is:
  • the above steps are cyclically executed until the updated first sub-loss function value is not greater than the first preset threshold, and the second neural network after the first round of training is obtained.
  • the second neural network further includes a classification layer; the determination module 203 is further configured to: after obtaining the second neural network after the first round of training, based on the classification layer included in the second neural network The second feature map of the last layer of the second neural network is classified to obtain the classification result output by the classification layer; based on the classification result output by the classification layer and the classification label carried in the training data, determine the first neural network of the second neural network. Two sub-loss function values;
  • the training module 204 in the case of adjusting the second neural network based on the determined loss function value according to the following steps to obtain the trained second neural network, is configured as:
  • a second round of training is performed on the second neural network based on the determined first sub-loss function value and the second sub-loss function value to obtain the second neural network after the second round of training.
  • the training module 204 performs the second round of training on the second neural network based on the determined first sub-loss function value and the second sub-loss function value according to the following steps, and after the second round of training
  • the configuration is:
  • the first weight corresponding to the first sub-loss function value and the second weight corresponding to the second sub-loss function value are determined; wherein, the first weight and the second sub-loss function value correspond to each other;
  • the number of trainings in the second round of training is negatively correlated, and the second weight is positively correlated with the number of trainings in the second round of training;
  • a second round of training is performed on the second neural network based on the weighted loss function value to obtain the second neural network after the second round of training.
  • the training module 204 in the case of performing a second round of training on the second neural network based on the weighted loss function value to obtain the second neural network after the second round of training, is configured as :
  • weighted loss function value When the weighted loss function value is greater than the second preset threshold, adjust the second neural network, and determine the updated weighted loss function value;
  • the above steps are cyclically executed until the updated weighted loss function value is not greater than the second preset threshold, and the second neural network after the second round of training is obtained.
  • the second neural network includes a second feature extraction layer and a classification layer
  • the determination module 203 in the case of determining the loss function value of the second neural network based on the first feature map and the second feature map according to the following steps, is configured as:
  • a loss function value of the second neural network is determined.
  • the training module 204 is configured to adjust the second neural network based on the determined loss function value to obtain the trained second neural network according to the following steps:
  • the above steps are cyclically executed until the updated loss function value is not greater than the third preset threshold, and the trained second neural network is obtained.
  • the first obtaining module 201 is configured as follows in the case of obtaining the first neural network according to the following steps:
  • the preset first network parameters include one or more of network depth, network width or resolution of training data
  • the first acquisition module 201 is configured as follows in the case of acquiring the second neural network according to the following steps:
  • the device includes: a second acquisition module 301 and a recognition module 302; wherein,
  • the second acquiring module 301 is configured to acquire an image to be recognized
  • the recognition module 302 is configured to recognize the image to be recognized based on the trained second neural network obtained by the neural network training method, and obtain a character recognition result output by the second neural network.
  • the electronic device includes: a processor 401 , a memory 402 and a bus 403 .
  • the memory 402 stores machine-readable instructions executable by the processor 401 (for example, the execution instructions corresponding to the first acquisition module 201, the extraction module 202, the determination module 203, and the training module 204 in the device in FIG. 3 in the device in the second acquisition module 301, the execution instruction corresponding to the identification module 302, etc.), when the electronic device is running, the processor 401 communicates with the memory 402 through the bus 403, and the machine-readable instruction is executed by the processor 401 Execute the neural network training method or the character recognition method provided by the embodiments of the present disclosure.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the methods described in the foregoing method embodiments are executed.
  • the storage medium may be a volatile or non-volatile computer-readable storage medium.
  • Embodiments of the present disclosure also provide a computer program product, the computer program product carries a program code, and the instructions included in the program code can be used to execute the steps of the methods described in the above method embodiments, see the above method embodiments.
  • the above-mentioned computer program product may be realized by hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor.
  • the technical solution of the present disclosure is essentially or the part that contributes to the prior art 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, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
  • the method disclosed in the embodiment of the present disclosure can guide the neural network with low network precision based on the first neural network with high network precision by obtaining two neural networks with different network precisions (ie, the first neural network and the second neural network). Training of the second neural network.
  • the loss function value of the second neural network can be determined based on the feature maps output by the two neural networks, and then the network parameters can be adjusted based on the loss function value. It can be seen that the closer the feature maps output by the two neural networks are, to a certain extent, the more sufficient the features learned by the second neural network from the first neural network are, so that the training efficiency can be improved while ensuring the training efficiency. training accuracy.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Image Analysis (AREA)

Abstract

一种神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品,其中,所述神经网络训练方法包括:获取训练数据(S101);基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图;其中,第一神经网络的网络精度高于第二神经网络的网络精度(S102);基于第一特征图,以及第二特征图,确定第二神经网络的损失函数值(S103);基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络(S104)。该方法可以在确保训练效率的情况下,提升训练精度。

Description

神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品
相关申请的交叉引用
本公开基于申请号为202111098789.5、申请日为2021年9月18日、申请名称为“神经网络训练及文字识别的方法、装置、设备及存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。
技术领域
本公开涉及计算机技术领域,尤其涉及一种神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品。
背景技术
目前,神经网络被广泛应用在计算机视觉领域,例如,文字识别、语义分割、物体检测等领域。然而,这些性能卓越的神经网络往往拥有上千万的参数,庞大的参数量会带来精度上的提升,但同时会造成推理速度的下降。
为了提升神经网络的推理速度,相关技术中提供了一种网络训练方法。以文字识别应用为例,上述方法可以根据期望的推理速度设计神经网络,并直接使用文字识别训练数据和标签训练该网络。然而,由于上述方法缺乏相应的精度提升机制导致网络的精度较低,无法兼顾高精度和高效率的应用需求。
发明内容
本公开实施例至少提供一种神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品。
第一方面,本公开实施例提供了一种神经网络训练的方法,所述方法包括:获取训练数据;基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图;其中,所述第一神经网络的网络精度高于所述第二神经网络的网络精度;基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值;基于确定的所述损失函数值对所述第二神经网络进行训练,得到训练后的第二神经网络。
第二方面,本公开实施例还提供了一种文字识别的方法,所述方法包括:获取待识别图像;基于第一方面及其各种实施方式任一所述的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到所述第二神经网络输出的文字识别结果。
第三方面,本公开实施例还提供了一种神经网络训练的装置,所述装置包括:获取模块,配置为获取训练数据;提取模块,配置为基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图,其中,所述第一神经网络的网络精度高于所述第二神经网络的网络精度;确定模块,配置为基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值;训练模块,配置为基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络。
第四方面,本公开实施例还提供了一种文字识别的装置,所述装置包括:获取模块,配置为获取待识别图像;识别模块,配置为基于第一方面及其各种实施方式任一所述的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到所述第二神经网络输出的文字识别结果。
第五方面,本公开实施例还提供了一种电子设备,包括:处理器、存储器和总线,所述存储器存储有所述处理器可执行的机器可读指令,当电子设备运行时,所述处理器与所述存储器之间通过总线通信,所述机器可读指令被所述处理器执行时执行如第一方面及其各种实施方式任一所述的神经网络训练的方法的步骤或者如第二方面所述的文字识别的方法的步骤。
第六方面,本公开实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如第一方面及其各种实施方式任一所述的神经网络训练的方法的步骤或者如第二方面所述的文字识别的方法的步骤。
第七方面,本公开实施例还提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现权利要求1至12中任一项所述的神经网络训练的方法的步骤或者如权利要求13所述的文字识别的方法的步骤。
上述方法,通过获取两个网络精度不同的神经网络(即第一神经网络和第二神经网络)的情况下,可以基于高网络精度的第一神经网络来指导低网络精度的第二神经网络的训练。在训练的过程中,可以基于两个神经网络所输出的特征图来确定第二神经网络的损失函数值,进而基于这一损失函数值进行网络参数的调整。由此可知,两个神经网络所输出的特征图越接近,一定程度上可以说明第二神经网络从第一神经网络所学习到的特征也越充分,从而可以在确保训练效率的情况下,提升训练精度。
关于上述装置、电子设备、及计算机可读存储介质的效果描述参见上述方法的说明。
为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使 用的附图作简单地介绍,此处的附图被并入说明书中并构成本说明书中的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。
图1示出了本公开实施例所提供的一种神经网络训练的方法的流程图;
图2示出了本公开实施例所提供的一种神经网络训练的装置的示意图;
图3示出了本公开实施例所提供的一种文字识别的装置的示意图;
图4示出了本公开实施例所提供的一种电子设备的示意图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本公开实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本公开的实施例的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。
本文中术语“和/或”,仅仅是描述一种关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。
经研究发现,为了提升神经网络的推理速度,相关技术中提供了一种网络训练方案。以文字识别应用为例,上述方案可以根据期望的推理速度设计神经网络,并直接使用文字识别训练数据和标签训练该网络。然而,由于上述方案缺乏相应的精度提升机制导致网络的精度较低,无法兼顾高精度和高效率的应用需求。
基于上述研究,本公开提供了一种神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品,以在确保训练效率的情况下,提升训练精度。
为便于对本实施例进行理解,首先对本公开实施例所公开的一种神经网络训练的方法进行详细介绍,本公开实施例所提供的神经网络训练的方法的执行主体一般为具有一定计算能力的计算机设备,该计算机设备例如包括:终端设备或服务器或其它处理设备,终端设备可以为用户设备(User Equipment,UE)、 移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等。在一些可能的实现方式中,该神经网络训练的方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。
参见图1所示,为本公开实施例提供的神经网络训练的方法的流程图,所述方法由电子设备执行,方法包括步骤S101~S104,其中:
S101:获取训练数据;
S102:基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图;其中,第一神经网络的网络精度高于第二神经网络的网络精度;
S103:基于第一特征图,以及第二特征图,确定第二神经网络的损失函数值;
S104:基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络。
为了便于理解本公开实施例提供的神经网络训练的方法,接下来首先可以对该方法的应用场景进行简单说明。本公开实施例中的神经网络训练的方法可以应用于网络压缩技术领域,这种网络压缩伴随着对于高推理速度的训练需求应运而生。相关技术提供的网络训练方案可以基于期望的推理速度设计小型的神经网络,然而,由于设计的网络并未对精度进行相关设置而导致训练精度不够。
正是为了解决上述问题,本公开实施例才提供了一种利用高精度的大网络(即第一神经网络)来指导小网络(即第二神经网络)的训练方案,兼顾了推理速度和精度的双重需求。
需要说明的是,针对不同的业务场景,这里的神经网络的功能也不相同。例如,对于文字识别场景而言,这里的神经网络可以是文字识别网络;再如,对于目标检测场景而言,这里的神经网络可以是目标检测网络。接下来多以文字识别网络作为神经网络进行示例说明。
本公开实施例提供的神经网络训练的方法中,结合不同的业务场景,所获取到的训练数据也不同。对于文字识别场景而言,这里的训练数据可以是包含有文字的图像数据,而第一神经网络和第二神经网络可以是从这样的图像数据中确定文字信息的网络。
其中,第一神经网络的网络结构复杂度远远高于第二神经网络的网络结构复杂度,基于这样的复杂度设置可以确保第一神经网络的第一网络精度要高于第二神经网络的第二网络精度。这是考虑到网络结构复杂度更高的网络往往可以挖掘到更为深层次的特征,进而提高训练的高精度。
在应用中,针对高精度的第一神经网络而言,通过合理设计网络的结构以及增加网络的参数,尽可能地提高网络的精度。这里不需要考虑网络的推理速度。比如,可以借鉴图像分类网络中精度较高的EfficientNet的思想,同时对网络深度(对应网络层数)、网络宽度(对应通道个数)、训练数据的分辨率等进 行放大,来提高网络精度。
针对第二神经网络而言,为了实现网络压缩的目的,该网络的推理速度需要足够高,与此同时,还需要有一定的精度,这是由于精度较差的网络没有实用价值,这里的第二神经网络可以是在有较小精度、较高推理速度的神经网络。
在应用中,通过合理设计网络的结构以及裁剪模型的参数,得到推理速度符合需求的小网络。比如,使用移动端场景下经常使用的MobileNetV2的块(Block)作为网络的基本单元,合理设计网络深度、网络宽度等参数,以得到速度很快同时精度也不低的网络。
需要说明的是,这里的第二神经网络可以是基于第一神经网络裁剪得到的,也可以是基于其它原始网络裁剪得到的。
为了确保第一神经网络对于第二神经网络的指导作用,这里可以先利用第一神经网络和第二神经网络分别提取对应的第一特征图和第二特征图,而后基于第一特征图和第二特征图之间的相似度所确定的损失函数值对第二神经网络进行调整。
本公开实施例中的第一神经网络作为指导网络,在针对第二神经网络进行训练的过程中保持网络参数不变。考虑到第一神经网络的主干网络(对应特征提取功能)一般包含较多的语义信息,为了借助这些语义信息中的特征来指导第二神经网络的训练,这里可以同步对第二神经网络进行特征提取,并利用特征相似度达到上述指导目的。
这里的第一神经网络可以是由多个第一特征提取层构成的,第二神经网络可以是由多个第二特征提取层构成的。考虑到随着网络层次的加深,所提取的语义信息中的特征也越丰富,通常情况下可以选取最后一个特征提取层输出的特征图来实现特征比对。
然而,本公开实施例考虑到实际的业务场景需求,除了最后一个特征提取层,在这之前的一些特征提取层也为网络带来一定的指导意义,这里可以选取最后N个特征提取层分别输出的特征图作为神经网络输出的特征图。
其中,N表示预设数量,可以结合不同的业务需求或者实际的网络复杂度来选取,例如,针对更为复杂的网络而言,可以选取更多数量的特征提取层。
本公开实施例中,可以基于获取的N个第一特征图和N个第二特征图确定第二神经网络的损失函数值。也即,可以确定第一特征图与对应层的第二特征图之间的特征相似度,而后基于各层的特征相似度,确定第二神经网络的第一子损失函数值。
其中,在确定对应的两个特征图(即第一特征图和第二特征图)的特征相似度的过程中,可以逐层计算,例如,先计算最后一层的两个特征图之间的特征相似度,然后再计算倒数第二层、倒数等三层等层数的两个特征图之间的特征相似度,也可以多层同时计算,也即,同时计算各层对应的两个特征图之间的特征相似度,这里不做限制。
在应用中,有关不同层可以设置不同的权重,进而为第一子损失函数值提供更切合实际应用需求的参考依据。例如,越是靠后的特征图可以对应设置更大的权重,以体现更深维度的语义信息的作用。
需要说明的是,在进行对应层的两个特征图的特征相似度的计算过程中,可以首先确定两个特征图的特征维度是否一致,如果一致可以直接进行计算,如若不一致,则可以增添中间网络层使得特征维度保持一致后再进行计算。
本公开实施例,在确定第一子损失函数值的情况下,可以对第二神经网络进行第一轮训练,也即,约束小网络的最后一层或几层的输出特征图,使其更接近大网络的最后一层或几层的输出特征图,从而让小网络可以学习到大网络在特征提取过程中的优良特性,以拥有更好的特征提取能力。
在第一轮训练的过程中,本公开实施例可以只使用第一子损失函数值,这是因为小网络和大网络的差距体现在主干网络的特征提取能力,换句话说,就是体现在网络的最后一层或几层的输出特征图的差别上。
随着第一轮训练的进行,第一子损失函数逐渐收敛,这时可以说明小网络的主干网络已经获得了接近大网络的主干网络的特征提取能力。
本公开实施例中,每确定一次第一子损失函数值,可以进行这一损失函数值与第一预设阈值的比较。在确定损失函数值较大的情况下,可以进行一次第二神经网络的调整。在网络调整之后,第一子损失函数值也随之发生更新,进而再次进行比较,循环执行,直到达到第一轮的网络收敛。
为了完成特定的业务功能,这里的第二神经网络还包括有分类层。在完成第一轮调整的情况下,可以对分类层的网络参数进行优化。同理,可以先按照如下步骤确定有关分类层的损失函数值,进而实现第二轮调整。
步骤一、基于第二神经网络包括的分类层对所述第二神经网络的最后一层所述第二特征图进行分类,得到分类层输出的分类结果;
步骤二、基于分类层输出的分类结果以及训练数据中携带的分类标签,确定第二神经网络的第二子损失函数值;
步骤三、基于确定的第一子损失函数值以及第二子损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
这里,可以基于分类层输出的分类结果与分类标签之间的比对结果来确定第二子损失函数值。比对结果越接近说明对应的损失函数值越小,反之亦然。
这里的第二轮调整,可以是使用第一子损失函数和第二子损失函数进行网络的联合训练,直到网络达到第二轮的收敛。
在调整的过程中,可以针对第一子损失函数值和第二子损失函数值设置不同的权重来实现既能够对分类层很好的进行优化,又不会破坏主干网络的参数的技术目的。在一些实施例中可以通过如下步骤来实现:
步骤一、在针对第二神经网络进行第二轮调整的过程中,确定与第一子损失函数值对应的第一权重,以及与第二子损失函数值对应的第二权重;其中,第一权重与第二轮训练过程中的训练次数呈负相关,第二权重与第二轮训练过程中的训练次数呈正相关;
步骤二、将第一子损失函数值及对应的第一权重、以及第二子损失函数值及对应的第二权重进行加权求和,确定第二神经网络的加权损失函数值;
步骤三、基于加权损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
本公开实施例中,之所以没有单独采用第二子损失函数进行训练,是因为刚开始引入第二子损失函数的阶段,分类层的参数还是随机的初始状态,只使用第二子损失函数,梯度经过没有充分优化的分类层,反向传播到已经优化到较好状态的主干网络时,可能会破坏主干网络。因而,这里所采用的是联合训练的方式,继续使用第一子损失函数,可以使分类层网络得到优化的同时,保持主干网络的参数状态。而随着分类层参数不断优化,第一子损失函数的作用越来越不重要,因此,第一子损失函数的第一权重不断减小直至为0,第二子损失函数的第二权重不断增大,直至达到第二轮收敛。
有关第一权重和第二权重的设置可以是动态完成的,也即,随着第二轮训练过程中训练次数的增加,可以按照每完成若干次数,即进行一次权重调整。在应用中,还可以是结合相应的递减函数来调整第一权重,以及相应的递增函数来调整第二权重。
这里,有关基于加权损失函数值对第二神经网络进行第二轮训练的过程,可以参照上述基于第一子损失函数值进行第一轮训练的过程,同样需要基于网络调整来更新损失函数值,直至达到网络收敛。
本公开实施例提供的神经网络训练的方法,除了可以采用上述先基于第一子损失函数进行第二神经网络的主干网络的训练,再联合第一子损失函数和第二子损失函数进行第二神经网络的分类层的训练,还可以直接采用联合训练的方式以同步训练主干网络和分类层。在一些实施例中可以通过如下步骤来实现:
步骤一、基于第二神经网络包括的分类层对第二特征提取层提取的第二特征图进行分类,得到分类层输出的分类结果;
步骤二、基于第二特征图以及第一特征图,确定第二神经网络的第一子损失函数值,以及基于分类层输出的分类结果以及训练数据中携带的分类标签,确定第二神经网络的第二子损失函数值;
步骤三、基于第一子损失函数值以及第二子损失函数值,确定第二神经网络的损失函数值。
这里,可以分别确定第一子损失函数值和第二子损失函数值以确定第二神经网络的损失函数值。
有关第一子损失函数值和第二子损失函数值的确定过程参见上述描述内容。
有关基于第二神经网络的损失函数值实现第二神经网络的训练过程,可以参见上述内容。
需要说明的是,在进行第二神经网络调整的过程中,所设置的第一预设阈值、第二预设阈值和第三预设阈值可以结合不同的应用需求来设置,这里不做限制。
本公开实施例中的第一神经网络和第二神经网络作为实现网络压缩的基础网络,接下来可以分别进行说明。
一方面,本公开实施例可以按照如下步骤确定第一神经网络:
步骤一、获取各个候选的第一神经网络;
步骤二、基于预设的第一网络参数确定各个候选的第一神经网络的网络精 度;预设的第一网络参数包括网络深度、网络宽度或训练数据的分辨率中的一种或多种;
步骤三、选取网络精度中最大网络精度对应的候选的第一神经网络,作为第一神经网络。
这里,可以基于不同参考维度的第一网络参数来选取较高精度的第一神经网络。这是考虑到网络深度、网络宽度或训练数据的分辨率等相关网络参数直接影响了网络结构复杂度,网络深度越深、网络宽度越宽、训练数据的分辨率越高,一定程度也说明了网络结构复杂度也越高,对应挖掘出的语义信息也越丰富,进而提升了网络精度。
另一方面,本公开实施例可以按照如下步骤确定第二神经网络:
步骤一、利用预设的裁剪参数对第一神经网络进行裁剪,得到裁剪后的第一神经网络;
步骤二、确定裁剪后的第一神经网络的网络推理速度是否高于预设速度;
步骤三、若是,则将裁剪后的第一神经网络确定为第二神经网络。
这里,可以基于第一神经网络的裁剪操作来确定第二神经网络,这样所确定的第二神经网络的网络推理速度不仅更快,而且可以一定程度上与第一神经网络保持结构上的一致性,进而便于后续的网络训练。
其中,有关裁剪操作可以是基于预设的裁剪参数所确定的,例如,可以是裁剪多少数量的通道,还可以是裁剪多少网络层等。
另外,裁剪后的第一神经网络的网络推理速度可以是在将训练数据发送到这一网络中测试得到的,网络推理速度越快,网络输出结果也越快,通过将输出的速度与预设速度相比较,可以确定裁剪后的第一神经网络是否满足第二神经网络的速度要求。
基于本公开实施例提供的神经网络训练的方法,本公开实施例还提供了一种文本识别的方法,所述方法由电子设备执行,所述方法包括如下步骤:
步骤一、获取待识别图像;
步骤二、基于神经网络训练的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到第二神经网络输出的文字识别结果。
这里所获取的待识别图像可以是需要进行识别的图像。在上述第二神经网络具有文字识别功能的情况下,可以利用第二神经网络得到文字识别结果,这里的文字识别结果可以是有关手写、打印等文字内容。
需要说明的是,上述第二神经网络还可以是具有目标检测功能的神经网络,继而可以实现有关目标对象的检测,此外还可以是其它神经网络。
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的执行顺序应当以其功能和可能的内在逻辑确定。
基于同一发明构思,本公开实施例中还提供了与方法对应的装置,由于本公开实施例中的装置解决问题的原理与本公开实施例上述方法相似,因此装置的实施可以参见方法的实施。
图2为本公开实施例提供的一种神经网络训练的装置的示意图,如图2所 示,所述装置包括:第一获取模块201、提取模块202、确定模块203和训练模块204;其中,
第一获取模块201,配置为获取训练数据;
提取模块202,配置为基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图;其中,第一神经网络的网络精度高于第二神经网络的网络精度;
确定模块203,配置为基于第一特征图,以及第二特征图,确定第二神经网络的损失函数值;
训练模块204,配置为基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络。
采用上述神经网络训练的装置,在获取到两个网络精度不同的神经网络(即第一神经网络和第二神经网络)的情况下,可以基于高网络精度的第一神经网络来指导低网络精度的第二神经网络的训练。在训练的过程中,可以基于两个神经网络所输出的特征图来确定第二神经网络的损失函数值,进而基于这一损失函数值进行网络参数的调整。可知的是,两个神经网络所输出的特征图越接近,一定程度上可以说明第二神经网络从第一神经网络所学习到的特征也越充分,从而可以在确保训练效率的情况下,提升训练精度。
在一种可能的实施方式中,第一神经网络包括多个第一特征提取层,第二神经网络包括多个第二特征提取层;
提取模块202,在基于第一神经网络的第一特征提取层得到对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图的情况下,配置为:
利用多个第一特征提取层对训练数据进行特征提取,得到第一神经网络的最后N个第一特征提取层分别输出的第一特征图;N为预设数量;以及,
利用多个第二特征提取层对训练数据进行特征提取,得到第二神经网络的最后N个第二特征提取层分别输出的第二特征图。
在一种可能的实施方式中,第二神经网络的损失函数值包括第一子损失函数值,确定模块203,按照以下步骤在基于第一特征图,以及第二特征图,确定第二神经网络的损失函数值的情况下,配置为:
确定第一特征图与对应层的第二特征图之间的特征相似度;
基于各层的特征相似度,确定第二神经网络的第一子损失函数值。
在一种可能的实施方式中,训练模块204,按照以下步骤在基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络的情况下,配置为:
基于确定的第一子损失函数值对第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络。
在一种可能的实施方式中,训练模块204,按照以下步骤在基于确定的第一子损失函数值对第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络的情况下,配置为:
在确定的第一子损失函数值大于第一预设阈值的情况下,对第二神经网络进行调整,并确定第二神经网络的更新后的第一子损失函数值;
循环执行以上步骤,直至更新后的第一子损失函数值不大于第一预设阈值的情况下,得到第一轮训练后的第二神经网络。
在一种可能的实施方式中,第二神经网络还包括分类层;确定模块203,还配置为:在得到第一轮训练后的第二神经网络之后,基于第二神经网络包括的分类层对所述第二神经网络的最后一层所述第二特征图进行分类,得到分类层输出的分类结果;基于分类层输出的分类结果以及训练数据中携带的分类标签,确定第二神经网络的第二子损失函数值;
训练模块204,按照以下步骤在基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络的情况下,配置为:
基于确定的第一子损失函数值以及第二子损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
在一种可能的实施方式中,训练模块204,按照以下步骤在基于确定的第一子损失函数值以及第二子损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络的情况下,配置为:
在针对第二神经网络进行第二轮调整的过程中,确定与第一子损失函数值对应的第一权重,以及与第二子损失函数值对应的第二权重;其中,第一权重与第二轮训练过程中的训练次数呈负相关,第二权重与第二轮训练过程中的训练次数呈正相关;
将第一子损失函数值及对应的第一权重、以及第二子损失函数值及对应的第二权重进行加权求和,确定第二神经网络的加权损失函数值;
基于加权损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
在一种可能的实施方式中,训练模块204,按照以下步骤在基于加权损失函数值对第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络的情况下,配置为:
在加权损失函数值大于第二预设阈值的情况下,对第二神经网络进行调整,并确定更新后的加权损失函数值;
循环执行以上步骤,直至更新后的加权损失函数值不大于所述第二预设阈值的情况下,得到第二轮训练后的第二神经网络。
在一种可能的实施方式中,第二神经网络包括第二特征提取层和分类层;
确定模块203,按照以下步骤在基于第一特征图,以及第二特征图,确定第二神经网络的损失函数值的情况下,配置为:
基于所述第二神经网络包括的分类层对第二特征提取层提取的第二特征图进行分类,得到分类层输出的分类结果;
基于第二特征图以及第一特征图,确定第二神经网络的第一子损失函数值,以及基于分类层输出的分类结果以及训练数据中携带的分类标签,确定第二神经网络的第二子损失函数值;
基于第一子损失函数值以及第二子损失函数值,确定第二神经网络的损失 函数值。
在一种可能的实施方式中,训练模块204,按照以下步骤在基于确定的损失函数值对第二神经网络进行调整,得到训练后的第二神经网络的情况下,配置为:
在确定的损失函数值大于第三预设阈值的情况下,对第二神经网络进行调整,并确定更新后的损失函数值;
循环执行上述步骤,直至更新后的损失函数值不大于第三预设阈值的情况下,得到训练后的第二神经网络。
在一种可能的实施方式中,第一获取模块201,按照如下步骤在获取第一神经网络的情况下,配置为:
获取各个候选的第一神经网络;
基于预设的第一网络参数确定各个候选的第一神经网络的网络精度;预设的第一网络参数包括网络深度、网络宽度或训练数据的分辨率中的一种或多种;
选取网络精度中最大网络精度对应的候选的第一神经网络,作为第一神经网络。
在一种可能的实施方式中,第一获取模块201,按照如下步骤在获取第二神经网络的情况下,配置为:
利用预设的裁剪参数对第一神经网络进行裁剪,得到裁剪后的第一神经网络;
确定裁剪后的第一神经网络的网络推理速度是否高于预设速度;
若是,则将裁剪后的第一神经网络确定为第二神经网络。
参见图3所示,为本公开实施例提供的一种文字识别的装置的示意图,所述装置包括:第二获取模块301和识别模块302;其中,
第二获取模块301,配置为获取待识别图像;
识别模块302,配置为基于神经网络训练的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到第二神经网络输出的文字识别结果。
关于装置中的各模块的处理流程、以及各模块之间的交互流程的描述可以参照上述方法实施例中的相关说明。
本公开实施例还提供了一种电子设备,参见图4,所述电子设备包括:处理器401、存储器402和总线403。存储器402存储有处理器401可执行的机器可读指令(比如,图2中的装置中第一获取模块201、提取模块202、确定模块203、训练模块204对应的执行指令等;再如,图3中的装置中第二获取模块301、识别模块302对应的执行指令等),当电子设备运行时,处理器401与存储器402之间通过总线403通信,机器可读指令被处理器401执行时执行本公开实施例提供的神经网络训练的方法或者文字识别的方法。
本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述方法实施例中所述的方法的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。
本公开实施例还提供一种计算机程序产品,该计算机程序产品承载有程序 代码,所述程序代码包括的指令可用于执行上述方法实施例中所述的方法的步骤,参见上述方法实施例。
其中,上述计算机程序产品可以通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品体现为计算机存储介质,在另一个可选实施例中,计算机程序产品体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统和装置的工作过程,可以参考前述方法实施例中的对应过程。在本公开所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。
工业实用性
本公开实施例公开的方法,通过获取两个网络精度不同的神经网络(即第一神经网络和第二神经网络)的情况下,可以基于高网络精度的第一神经网络来指导低网络精度的第二神经网络的训练。在训练的过程中,可以基于两个神经网络所输出的特征图来确定第二神经网络的损失函数值,进而基于这一损失函数值进行网络参数的调整。由此可知,两个神经网络所输出的特征图越接近,一定程度上可以说明第二神经网络从第一神经网络所学习到的特征也越充分,从而可以在确保训练效率的情况下,提升训练精度。

Claims (29)

  1. 一种神经网络训练的方法,所述方法包括:
    获取训练数据;
    基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图;其中,所述第一神经网络的网络精度高于所述第二神经网络的网络精度;
    基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值;
    基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络。
  2. 根据权利要求1所述的方法,其中,所述第一神经网络包括多个第一特征提取层,所述第二神经网络包括多个第二特征提取层;
    所述基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图,包括:
    利用所述多个第一特征提取层对所述训练数据进行特征提取,得到所述第一神经网络的最后N个第一特征提取层分别输出的第一特征图;N为预设数量;以及,
    利用所述多个第二特征提取层对所述训练数据进行特征提取,得到所述第二神经网络的最后N个第二特征提取层分别输出的第二特征图。
  3. 根据权利要求2所述的方法,其中,所述第二神经网络的损失函数值包括第一子损失函数值,所述基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值,包括:
    确定所述第一特征图与对应层的第二特征图之间的特征相似度;
    基于各层的所述特征相似度,确定所述第二神经网络的第一子损失函数值。
  4. 根据权利要求3所述的方法,其中,所述基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络,包括:
    基于确定的所述第一子损失函数值对所述第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络。
  5. 根据权利要求4所述的方法,其中,所述基于确定的所述第一子损失函数值对所述第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络,包括:
    在确定的所述第一子损失函数值大于第一预设阈值的情况下,对所述第二神经网络进行调整,并确定所述第二神经网络的更新后的第一子损失函数值;
    循环执行以上步骤,直至更新后的第一子损失函数值不大于所述第一预设阈值的情况下,得到第一轮训练后的第二神经网络。
  6. 根据权利要求4或5所述的方法,其中,所述第二神经网络还包括分类层;在得到第一轮训练后的第二神经网络之后,所述方法还包括:
    基于所述第二神经网络包括的分类层对所述第二神经网络的最后一层所述第二特征图进行分类,得到所述分类层输出的分类结果;
    基于所述分类层输出的分类结果以及所述训练数据中携带的分类标签,确定所述第二神经网络的第二子损失函数值;
    所述基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络,包括:
    基于确定的所述第一子损失函数值以及所述第二子损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
  7. 根据权利要求6所述的方法,其中,所述基于确定的所述第一子损失函数值以及所述第二子损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络,包括:
    在针对所述第二神经网络进行第二轮调整的过程中,确定与所述第一子损失函数值对应的第一权重,以及与所述第二子损失函数值对应的第二权重;其中,所述第一权重与所述第二轮训练过程中的训练次数呈负相关,所述第二权重与所述第二轮训练过程中的训练次数呈正相关;
    将所述第一子损失函数值及对应的第一权重、以及所述第二子损失函数值及对应的第二权重进行加权求和,确定所述第二神经网络的加权损失函数值;
    基于所述加权损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
  8. 根据权利要求7所述的方法,其中,所述基于所述加权损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络,包括:
    在所述加权损失函数值大于第二预设阈值的情况下,对所述第二神经网络进行调整,并确定更新后的所述加权损失函数值;
    循环执行以上步骤,直至更新后的加权损失函数值不大于所述第二预设阈值的情况下,得到第二轮训练后的第二神经网络。
  9. 根据权利要求1所述的方法,其中,所述第二神经网络包括第二特征提取层和分类层;
    所述基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值,包括:
    基于所述第二神经网络包括的分类层对所述第二特征提取层提取的第二特征图进行分类,得到所述分类层输出的分类结果;
    基于所述第二特征图以及所述第一特征图,确定所述第二神经网络的第一子损失函数值,以及基于所述分类层输出的分类结果以及所述训练数据中携带的分类标签,确定所述第二神经网络的第二子损失函数值;
    基于所述第一子损失函数值以及所述第二子损失函数值,确定所述第二神经网络的损失函数值。
  10. 根据权利要求9所述的方法,其中,所述基于确定的所述损失函数值 对所述第二神经网络进行调整,得到训练后的第二神经网络,包括:
    在确定的所述损失函数值大于第三预设阈值的情况下,对所述第二神经网络进行调整,并确定更新后的损失函数值;
    循环执行上述步骤,直至更新后的损失函数值不大于所述第三预设阈值的情况下,得到训练后的第二神经网络。
  11. 根据权利要求1至10任一所述的方法,其中,按照如下步骤获取所述第一神经网络:
    获取各个候选的第一神经网络;
    基于预设的第一网络参数确定所述各个候选的第一神经网络的网络精度;所述预设的第一网络参数包括网络深度、网络宽度或训练数据的分辨率中的一种或多种;
    选取所述网络精度中最大网络精度对应的候选的第一神经网络,作为所述第一神经网络。
  12. 根据权利要求1至11任一所述的方法,其中,按照如下步骤获取所述第二神经网络:
    利用预设的裁剪参数对所述第一神经网络进行裁剪,得到裁剪后的第一神经网络;
    确定所述裁剪后的第一神经网络的网络推理速度是否高于预设速度;
    若是,则将所述裁剪后的第一神经网络确定为所述第二神经网络。
  13. 一种文字识别的方法,所述方法包括:
    获取待识别图像;
    基于权利要求1至12任一所述的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到所述第二神经网络输出的文字识别结果。
  14. 一种神经网络训练的装置,所述装置包括:
    第一获取模块,配置为获取训练数据;
    提取模块,配置为基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图,其中,所述第一神经网络的网络精度高于所述第二神经网络的网络精度;
    确定模块,配置为基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值;
    训练模块,配置为基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络。
  15. 根据权利要求14所述的装置,其中,所述第一神经网络包括多个第一特征提取层,所述第二神经网络包括多个第二特征提取层;所述提取模块在基于第一神经网络的第一特征提取层对所述训练数据进行提取,得到第一特征图,基于第二神经网络的第二特征提取层对所述训练数据进行提取,得到第二特征图的情况下,配置为:
    利用所述多个第一特征提取层对所述训练数据进行特征提取,得到所述第 一神经网络的最后N个第一特征提取层分别输出的第一特征图;N为预设数量;以及,
    利用所述多个第二特征提取层对所述训练数据进行特征提取,得到所述第二神经网络的最后N个第二特征提取层分别输出的第二特征图。
  16. 根据权利要求15所述的装置,其中,所述第二神经网络的损失函数值包括第一子损失函数值,所述确定模块在基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值的情况下,配置为:
    确定所述第一特征图与对应层的第二特征图之间的特征相似度;
    基于各层的所述特征相似度,确定所述第二神经网络的第一子损失函数值。
  17. 根据权利要求16所述的装置,其中,所述训练模块在基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络的情况下,配置为:
    基于确定的所述第一子损失函数值对所述第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络。
  18. 根据权利要求17所述的装置,其中,所述训练模块在基于确定的所述第一子损失函数值对所述第二神经网络进行第一轮训练,得到第一轮训练后的第二神经网络的情况下,配置为:
    在确定的所述第一子损失函数值大于第一预设阈值的情况下,对所述第二神经网络进行调整,并确定所述第二神经网络的更新后的第一子损失函数值;
    循环执行以上步骤,直至更新后的第一子损失函数值不大于所述第一预设阈值的情况下,得到第一轮训练后的第二神经网络。
  19. 根据权利要求17或18所述的装置,其中,所述第二神经网络还包括分类层;所述确定模块还配置为:
    在得到第一轮训练后的第二神经网络之后,基于所述第二神经网络包括的分类层对所述第二神经网络的最后一层所述第二特征图进行分类,得到所述分类层输出的分类结果;
    基于所述分类层输出的分类结果以及所述训练数据中携带的分类标签,确定所述第二神经网络的第二子损失函数值;
    所述训练模块,配置为基于确定的所述第一子损失函数值以及所述第二子损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
  20. 根据权利要求19所述的装置,其中,所述训练模块在基于确定的所述第一子损失函数值以及所述第二子损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络的情况下,配置为:
    在针对所述第二神经网络进行第二轮调整的过程中,确定与所述第一子损失函数值对应的第一权重,以及与所述第二子损失函数值对应的第二权重;其中,所述第一权重与所述第二轮训练过程中的训练次数呈负相关,所述第二权重与所述第二轮训练过程中的训练次数呈正相关;
    将所述第一子损失函数值及对应的第一权重、以及所述第二子损失函数值 及对应的第二权重进行加权求和,确定所述第二神经网络的加权损失函数值;
    基于所述加权损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络。
  21. 根据权利要求20所述的装置,其中,所述训练模块在基于所述加权损失函数值对所述第二神经网络进行第二轮训练,得到第二轮训练后的第二神经网络的情况下,配置为:
    在所述加权损失函数值大于第二预设阈值的情况下,对所述第二神经网络进行调整,并确定更新后的所述加权损失函数值;
    循环执行以上步骤,直至更新后的加权损失函数值不大于所述第二预设阈值的情况下,得到第二轮训练后的第二神经网络。
  22. 根据权利要求14所述的装置,其中,所述第二神经网络包括第二特征提取层和分类层;所述确定模块在基于所述第一特征图,以及所述第二特征图,确定所述第二神经网络的损失函数值的情况下,配置为:基于所述第二神经网络包括的分类层对所述第二特征提取层提取的第二特征图进行分类,得到所述分类层输出的分类结果;
    基于所述第二特征图以及所述第一特征图,确定所述第二神经网络的第一子损失函数值,以及基于所述分类层输出的分类结果以及所述训练数据中携带的分类标签,确定所述第二神经网络的第二子损失函数值;
    基于所述第一子损失函数值以及所述第二子损失函数值,确定所述第二神经网络的损失函数值。
  23. 根据权利要求22所述的装置,其中,所述训练模块在基于确定的所述损失函数值对所述第二神经网络进行调整,得到训练后的第二神经网络的情况下,配置为:
    在确定的所述损失函数值大于第三预设阈值的情况下,对所述第二神经网络进行调整,并确定更新后的损失函数值;
    循环执行上述步骤,直至更新后的损失函数值不大于所述第三预设阈值的情况下,得到训练后的第二神经网络。
  24. 根据权利要求14至23任一所述的装置,其中,所述第一获取模块在获取所述第一神经网络的情况下,配置为:
    获取各个候选的第一神经网络;
    基于预设的第一网络参数确定所述各个候选的第一神经网络的网络精度;所述预设的第一网络参数包括网络深度、网络宽度或训练数据的分辨率中的一种或多种;
    选取所述网络精度中最大网络精度对应的候选的第一神经网络,作为所述第一神经网络。
  25. 根据权利要求14至24任一所述的装置,其中,所述第一获取模块在获取所述第二神经网络的情况下,配置为:
    利用预设的裁剪参数对所述第一神经网络进行裁剪,得到裁剪后的第一神经网络;
    确定所述裁剪后的第一神经网络的网络推理速度是否高于预设速度;
    若是,则将所述裁剪后的第一神经网络确定为所述第二神经网络。
  26. 一种文字识别的装置,所述装置包括:
    第二获取模块,配置为获取待识别图像;
    识别模块,配置为基于权利要求1至12任一所述的方法得到的训练后的第二神经网络,对所述待识别图像进行识别,得到所述第二神经网络输出的文字识别结果。
  27. 一种电子设备,包括:处理器、存储器和总线,所述存储器存储有所述处理器可执行的机器可读指令,当电子设备运行时,所述处理器与所述存储器之间通过总线通信,所述机器可读指令被所述处理器执行时执行如权利要求1至12任一所述的神经网络训练的方法的步骤或者如权利要求13所述的文字识别的方法的步骤。
  28. 一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如权利要求1至12任一所述的神经网络训练的方法的步骤或者如权利要求13所述的文字识别的方法的步骤。
  29. 一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令被计算机设备的处理器运行时,实现权利要求1至12中任一项所述的神经网络训练的方法的步骤或者如权利要求13所述的文字识别的方法的步骤。
PCT/CN2022/114914 2021-09-18 2022-08-25 神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品 WO2023040626A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111098789.5 2021-09-18
CN202111098789.5A CN113780556A (zh) 2021-09-18 2021-09-18 神经网络训练及文字识别的方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023040626A1 true WO2023040626A1 (zh) 2023-03-23

Family

ID=78852463

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/114914 WO2023040626A1 (zh) 2021-09-18 2022-08-25 神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品

Country Status (2)

Country Link
CN (1) CN113780556A (zh)
WO (1) WO2023040626A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116384460B (zh) * 2023-03-29 2024-06-11 清华大学 鲁棒性光学神经网络训练方法、装置、电子设备及介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113780556A (zh) * 2021-09-18 2021-12-10 深圳市商汤科技有限公司 神经网络训练及文字识别的方法、装置、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180068218A1 (en) * 2016-09-07 2018-03-08 Samsung Electronics Co., Ltd. Neural network based recognition apparatus and method of training neural network
CN111325318A (zh) * 2019-02-01 2020-06-23 北京地平线机器人技术研发有限公司 神经网络的训练方法、神经网络的训练装置和电子设备
CN111414987A (zh) * 2019-01-08 2020-07-14 南京人工智能高等研究院有限公司 神经网络的训练方法、训练装置和电子设备
CN112288086A (zh) * 2020-10-30 2021-01-29 北京市商汤科技开发有限公司 一种神经网络的训练方法、装置以及计算机设备
CN113378866A (zh) * 2021-08-16 2021-09-10 深圳市爱深盈通信息技术有限公司 图像分类方法、系统、存储介质及电子设备
CN113780556A (zh) * 2021-09-18 2021-12-10 深圳市商汤科技有限公司 神经网络训练及文字识别的方法、装置、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180068218A1 (en) * 2016-09-07 2018-03-08 Samsung Electronics Co., Ltd. Neural network based recognition apparatus and method of training neural network
CN111414987A (zh) * 2019-01-08 2020-07-14 南京人工智能高等研究院有限公司 神经网络的训练方法、训练装置和电子设备
CN111325318A (zh) * 2019-02-01 2020-06-23 北京地平线机器人技术研发有限公司 神经网络的训练方法、神经网络的训练装置和电子设备
CN112288086A (zh) * 2020-10-30 2021-01-29 北京市商汤科技开发有限公司 一种神经网络的训练方法、装置以及计算机设备
CN113378866A (zh) * 2021-08-16 2021-09-10 深圳市爱深盈通信息技术有限公司 图像分类方法、系统、存储介质及电子设备
CN113780556A (zh) * 2021-09-18 2021-12-10 深圳市商汤科技有限公司 神经网络训练及文字识别的方法、装置、设备及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116384460B (zh) * 2023-03-29 2024-06-11 清华大学 鲁棒性光学神经网络训练方法、装置、电子设备及介质

Also Published As

Publication number Publication date
CN113780556A (zh) 2021-12-10

Similar Documents

Publication Publication Date Title
WO2021027533A1 (zh) 文本语义识别方法、装置、计算机设备和存储介质
US9807473B2 (en) Jointly modeling embedding and translation to bridge video and language
CN109635273B (zh) 文本关键词提取方法、装置、设备及存储介质
Rozsa et al. Facial attributes: Accuracy and adversarial robustness
CN110569500A (zh) 文本语义识别方法、装置、计算机设备和存储介质
CN111178458B (zh) 分类模型的训练、对象分类方法及装置
CN110163181B (zh) 手语识别方法及装置
US20210406589A1 (en) Task-based image masking
CN113204952A (zh) 一种基于聚类预分析的多意图与语义槽联合识别方法
CN111159358A (zh) 多意图识别训练和使用方法及装置
WO2023040626A1 (zh) 神经网络训练及文字识别的方法、装置、设备、存储介质及计算机程序产品
CN110532562B (zh) 神经网络训练方法、成语误用检测方法、装置和电子设备
CN113326940A (zh) 基于多重知识迁移的知识蒸馏方法、装置、设备及介质
CN112949818A (zh) 模型蒸馏方法、装置、设备以及存储介质
CN113642481A (zh) 识别方法、训练方法、装置、电子设备以及存储介质
CN114969195B (zh) 对话内容挖掘方法和对话内容评估模型的生成方法
CN116383382A (zh) 敏感信息的识别方法、装置、电子设备及存储介质
US20230153533A1 (en) Pre-training techniques for entity extraction in low resource domains
CN115222047A (zh) 一种模型训练方法、装置、设备及存储介质
CN110399615B (zh) 交易风险监控方法及装置
CN114549695A (zh) 图像生成方法、装置、电子设备及可读存储介质
CN114186039A (zh) 一种视觉问答方法、装置及电子设备
Zhou et al. Image Segmentation Algorithms Based on Convolutional Neural Networks
CN111178409A (zh) 基于大数据矩阵稳定性分析的图像匹配与识别系统
CN113610064B (zh) 笔迹识别方法和装置

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: 22869000

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE