Learning device, method and program
The learning device and method address the trade-off in inference accuracy and model size by iteratively adjusting learning conditions, enabling efficient generation of machine learning models with desired performance through compaction and relearning processes.
Patent Information
- Application Number
- JP2021133392
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-08-18
AI Technical Summary
Existing technologies struggle to achieve desired performance in terms of inference accuracy and model size due to the inherent trade-off, requiring specialized skills and complex adjustments, making it difficult to obtain optimal machine learning models.
A learning device and method that includes an acquisition, setting, learning, and relearning process to adjust learning conditions, allowing for the generation of machine learning models with desired performance by iteratively refining model size and accuracy through compaction and relearning processes.
Facilitates the easy attainment of desired performance by automatically determining the need for relearning, ensuring a balance between model size and inference accuracy, thereby optimizing machine learning model efficiency.
Smart Images

Figure 0007551577000002 
Figure 0007551577000005 
Figure 0007551577000001
Abstract
Description
[Technical field]
[0001] FIELD An embodiment of the present invention relates to a learning device, a learning method, and a learning program. [Background technology]
[0002] The technology described in Patent Document 1 makes it easy to check the trade-off between inference accuracy and model size by displaying a graph of the inference accuracy and model size of a neural network trained under multiple learning conditions. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2019-164839 A Summary of the Invention [Problem to be solved by the invention]
[0004] However, in the technology disclosed in Patent Document 1, due to a trade-off between inference accuracy and model size, there are cases where the desired performance (such as inference accuracy A or higher and model size B or lower) is not met. In such cases, highly specialized skills and experience are required to further adjust the learning conditions and execute re-learning, and the confirmation and operation work required is cumbersome.
[0005] The problem to be solved by the present invention is to provide a learning device, method, and program that can easily obtain desired performance for a machine learning model. [Means for solving the problem]
[0006] A learning device according to an embodiment includes an acquisition unit, a setting unit, a learning unit, and a re-learning unit. The acquisition unit acquires a first learning condition and a first machine learning model trained according to the first learning condition. The setting unit sets a second learning condition that is different from the first learning condition and is for reducing a model size of the first machine learning model. The learning unit trains a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model in accordance with the second learning condition. The re-learning unit trains a third machine learning model based on the second machine learning model in accordance with a third learning condition that is not the same as the second learning condition and corresponds to the first learning condition. [Brief description of the drawings]
[0007] [Figure 1] FIG. 1 is a diagram showing an example of the configuration of a learning device according to an embodiment of the present invention; [Diagram 2] FIG. 13 is a diagram showing a flow of an example of a learning process performed by the learning device according to the present embodiment; [Diagram 3] A diagram showing a schematic configuration example of a first machine learning model. [Figure 4] Schematic of the second machine learning model before and after compaction. [Diagram 5] FIG. 3 is a diagram showing an example of a display screen of the learning result when it is determined in step S4 of FIG. 2 that re-learning is unnecessary; [Figure 6] FIG. 3 is a diagram showing an example of a display screen of the learning result when it is determined in step S4 of FIG. 2 that re-learning is necessary; [Figure 7] An example of a screen displaying the structure of a machine learning model DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0008] Hereinafter, a learning device, a learning method, and a learning program according to the present embodiment will be described with reference to the drawings.
[0009] Fig. 1 is a diagram showing an example of the configuration of a learning device 100 according to this embodiment. As shown in Fig. 1, the learning device 100 is a computer having a processing circuit 1, a storage device 2, an input device 3, a communication device 4, and a display device 5. Data communication between the processing circuit 1, the storage device 2, the input device 3, the communication device 4, and the display device 5 is performed via a bus.
[0010] The processing circuit 1 includes a processor such as a CPU (Central Processing Unit) and a memory such as a RAM (Random Access Memory). The processing circuit 1 includes an acquisition unit 11, a setting unit 12, a learning unit 13, a determination unit 14, a re-learning unit 15, and a display control unit 16. The processing circuit 1 executes a learning program of a machine learning model to realize the functions of each of the above-mentioned units 11 to 16. The learning program is stored in a non-transitory computer-readable recording medium such as a storage device 2. The learning program may be implemented as a single program that describes all the functions of each of the above-mentioned units 11 to 16, or may be implemented as a plurality of modules divided into several functional units. In addition, each of the above-mentioned units 11 to 16 may be implemented by an integrated circuit such as an Application Specific Integrated Circuit (ASIC). In this case, the units may be implemented in a single integrated circuit, or may be implemented individually in a plurality of integrated circuits.
[0011] The acquisition unit 11 acquires various data. For example, the acquisition unit 11 acquires a first learning condition and a first machine learning model. The first learning condition is a learning condition related to the first machine learning model, and is a learning condition that emphasizes the accuracy of inference. The first machine learning model is a machine learning model trained according to the first learning condition. A neural network is used as the machine learning model. In addition, the acquisition unit 11 acquires training data and a first inference accuracy. The training data is training data used for training the first machine learning model. The first inference accuracy is a value that indicates the accuracy of inference of the first machine learning model.
[0012] The setting unit 12 sets a second learning condition, which is a learning condition different from the first learning condition and is for reducing (compacting) the model size of the first machine learning model. The setting unit 12 may set the second learning condition based on the first learning condition, or may set the second learning condition independently of the first learning condition.
[0013] The learning unit 13 learns a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model in accordance with the second learning condition. The learning unit 13 also calculates a second inference accuracy that represents the accuracy of inference regarding the second machine learning model.
[0014] The judgment unit 14 judges whether or not it is necessary to train a third machine learning model based on a comparison between a first inference accuracy representing the accuracy of inference regarding the first machine learning model and a second inference accuracy representing the accuracy of inference regarding the second machine learning model.
[0015] The re-learning unit 15 learns a third machine learning model based on the second machine learning model according to a third learning condition that is not the same as the second learning condition and corresponds to the first learning condition. The re-learning unit 15 also calculates a third inference accuracy that represents the accuracy of inference regarding the trained third machine learning model. The third learning condition is a learning condition that places more importance on the accuracy of inference than the second learning condition. The third machine learning model has a model structure that is the same as the second machine learning model or a model structure that is a modified version of the second machine learning model. As an example, the third machine learning model is trained according to the third learning condition that is the same as the first learning condition, and has a higher inference accuracy than the second machine learning model.
[0016] The display control unit 16 displays various information such as the learning result on the display device 5. As one example, the display control unit 16 displays the structures of the first machine learning model, the second machine learning model, and / or the third machine learning model. As another example, the display control unit 16 displays the model sizes of the first machine learning model, the second machine learning model, and / or the third machine learning model. As another example, the display control unit 16 displays the performance of the first machine learning model, the second machine learning model, and / or the third machine learning model.
[0017] The storage device 2 is configured by a ROM (Read Only Memory), an HDD (Hard Disk Drive), an SSD (Solid State Drive), an integrated circuit storage device, etc. The storage device 2 stores learning programs, various data, etc.
[0018] The input device 3 inputs various commands from an operator. As the input device 3, a keyboard, a mouse, various switches, a touch pad, a touch panel display, etc. can be used. An output signal from the input device 3 is supplied to the processing circuit 1. Note that the input device 3 may be an input device of a computer connected to the processing circuit 1 via a wire or wirelessly.
[0019] Communications device 4 is an interface for performing data communication between learning device 100 and an external device connected to learning device 100 via a network.
[0020] The display device 5 displays various information under the control of the display control unit 16. As the display device 5, a CRT (Cathode-Ray Tube) display, a liquid crystal display, an organic EL (Electro Luminescence) display, an LED (Light-Emitting Diode) display, a plasma display, or any other display known in the art can be appropriately used. The display device 5 may also be a projector.
[0021] An example of the operation of the learning device 100 will now be described in detail.
[0022] In the following examples, the training data is an image, and the machine learning model is a neural network that executes an image classification task of classifying images according to objects depicted in the images. As an example, the image classification task according to the following examples is a two-class image classification task to classify images into either "dog" or "cat."
[0023] Fig. 2 is a diagram showing a flow of an example of a learning process by the learning device 100 according to this embodiment. The processing circuit 1 reads a learning program from the storage device 2 and operates according to the learning program to execute the learning process illustrated in Fig. 2. The learning process is a learning process of a machine learning model that can easily obtain a desired performance.
[0024] In this embodiment, the machine learning model includes a model structure and learning parameters. The model structure is a factor determined by hyperparameters such as the type of neural network, the number of layers, the number of nodes, and the number of channels. The nodes are considered when the neural network is a multilayer perceptron (MLP), and the channels are considered when the neural network is a convolutional neural network (CNN). The neural network according to this embodiment can be applied to either structure, but hereinafter, it is assumed to be a multilayer perceptron. The learning parameters are parameters set in the machine learning model, and in particular, are parameters that are the subject of learning. Specifically, the learning parameters are parameters such as weight parameters and biases.
[0025] The performance of the machine learning model according to this embodiment is defined by a combination of inference accuracy and model size. As described above, the inference accuracy is the inference accuracy of the machine learning model, and when the task of the machine learning model is image classification, for example, the recognition rate is used. The model size is an index related to the size and calculation load of the machine learning model. Factors of the model size include the number of learning parameters, the number of hidden layers, the number of nodes or channels in the hidden layer, the number of inference multiplications, power consumption, etc.
[0026] 2, first, the acquiring unit 11 acquires the learning data, the first machine learning model, the first learning condition, and the first inference accuracy (step S1). The acquiring unit 11 may acquire these data from another computer via the communication device 4, or may acquire them from the storage device 2.
[0027] The training data is data used to train a machine learning model and includes multiple training samples. Each training sample is an input image x i and the input image x i The corresponding teaching label t i "i" takes the values 1, 2, . . . , N, and represents the serial number of the training sample. "N" represents the number of training samples. i is the width H , vertical width V is a set of pixels in H × V It is possible to express the teaching label t as a dimensional vector. i is a vector whose number of dimensions corresponds to the number of classes. i is a two-dimensional vector with elements corresponding to the class "dog" and elements corresponding to the class "cat". Each element is a vector of the input image x i If the object corresponding to the element is drawn in the input image x, the value is set to "1", and if any other object is drawn, the value is set to "0". For example, i If "dog" is drawn on , the teaching label t i is (1,0) T It is expressed as:
[0028] The machine learning model according to the present embodiment is defined by a model structure and learning parameters. The model structure is a factor determined by hyperparameters such as the type of neural network, the type of layers, the connection between layers, the number of layers, the number of nodes, etc. The learning parameters are the object of learning, and are parameters such as weight parameters and biases.
[0029] The first machine learning model is a machine learning model before compaction. The first machine learning model is a machine learning model that has already been trained by the learning device 100 or another computer.
[0030] 3 is a diagram illustrating a schematic configuration example of a first machine learning model 30. As illustrated in FIG. 3, the first machine learning model 30 is composed of a first model structure 31 and first learning parameters 32. The first model structure 31 has an input layer 33, a hidden layer 34, and an output layer 35. The input layer 33 includes: H =2, V An input image of a four-dimensional vector with n=2 is input. The hidden layer 34 is assumed to be fully connected with the number of nodes=8 and the number of layers=3. The output layer 35 outputs the estimated probability values of dogs and cats. The first learning parameters 32 have weight parameters and biases related to the conversion between layers. For simplification, notation related to biases is omitted in FIG. 3. The weight parameters are expressed by the matrix W={W (l)}(l=1,2,3,4=L). In this embodiment, each matrix W (l) The sizes (number of weight parameters) of are 32, 64, 64, and 16, and the total number of weight parameters is 176. In Figure 3, each weight parameter is represented by a white square.
[0031] The first learning condition is a learning condition for a machine learning model before compaction, and is a learning condition that emphasizes inference accuracy. As the learning condition, for example, the type of activation function, the type of optimizer (optimization method), the L2 regularization strength, the number of epochs, and the mini-batch size are set. As an example, the first learning condition is set to the type of activation function "Leaky ReLU", the type of optimizer "Momentum SGD (learning rate α=0.1)", the L2 regularization strength "λ=0", the number of epochs "100", and the mini-batch size "128". Note that the types of learning conditions are not limited to the above types.
[0032] The first inference accuracy means the inference accuracy of the trained first machine learning model obtained by training the first machine learning model according to the first learning condition. In this embodiment, it is the recognition rate when inference is made by the trained first machine learning model using evaluation data different from the training data. As an example, the first inference accuracy is 95%.
[0033] When step S1 is performed, the setting unit 12 sets a second learning condition (step S2). The second learning condition is different from the first learning condition and is a learning condition for compaction learning. The setting unit 12 changes at least one of the type of optimizer, the type of regularization, and the strength of regularization from the first learning condition as the second learning condition. In this embodiment, the technology described in U.S. Patent Application Publication No. US2020 / 0012945 is used as the compaction learning method. In this technology, the optimizer is Adam, the activation function is a saturation nonlinear function such as ReLU, and learning with weight decay is performed so that the weight parameters connected to some nodes are automatically learned to be zero, and as a result, the model size of the neural network can be reduced.
[0034] The setting unit 12 according to this embodiment changes the items necessary for applying the compaction method from the first learning condition to set the second learning condition. The specific setting contents of the second learning condition are as follows. The activation function type is "ReLU", the optimizer type is "Adam (learning rate α=0.01)", the L2 regularization strength is "λ (weight decay)=1e-6, 1e-5, 1e-4, 1e-3, 1e-2", the number of epochs is "100", and the mini-batch size is "128". The strength of weight decay is a hyperparameter that adjusts the trade-off between inference accuracy (recognition rate) and model size, and in this embodiment, the above-mentioned five variations are set as the second learning condition. When computer resources are abundant, the learning sample in the mini-batch may be selected based on multiple random number seeds.
[0035] After step S2 is performed, the learning unit 13 learns the second machine learning model (step S3). In step S3, the learning unit 13 trains (iteratively learns) the learning parameters assigned to the model structure of the first machine learning model acquired in step S1 based on the learning data acquired in step S1 in accordance with the second learning conditions set in step S2. The trained learning parameters are called second learning parameters. The machine learning model to which the second learning parameters are assigned is called the second machine learning model. More specifically, the model structure of the second machine learning model (second model structure) is a model structure obtained by optimizing (compacting) the first model structure according to the value of the second learning parameter. Furthermore, the learning unit 13 applies the evaluation data to the second machine learning model to calculate a second inference accuracy.
[0036] In step S3, one or more second machine learning models are trained according to one or more second learning conditions. In this embodiment, a plurality of second machine learning models are trained according to a plurality of second learning conditions.
[0037] The learning of the machine learning model is expressed by the following equations (1) and (2).
[0038] yi = f(W, xi) (1) Li=-ti T ln(yi) (2)
[0039] Equation (1) represents the output yi of the machine learning model when the learning sample xi is input. Here, f is a function of the machine learning model that holds the parameter set W, and repeats the operation of the fully connected layer and the activation function to output a two-dimensional vector. In this embodiment, the function f is the output after softmax processing, and the output vector is all non-negative elements, and the sum of the elements is normalized to 1. Equation (2) represents a calculation formula for the learning error Li of the learning sample xi. The learning error Li in this embodiment is defined by the cross entropy between the teaching label ti and the output yi of the machine learning model.
[0040] The learning unit 13 according to this embodiment repeats the backpropagation method and the stochastic gradient descent method to train the values of the parameter set W of the machine learning model so as to minimize the learning error calculated as the average of the learning errors of a partial learning sample set. In step S3, the learning unit 13 repeats the backpropagation method and the stochastic gradient descent method to train the second learning parameters so as to minimize the learning error. The learning unit 13 compacts the first model structure (the second model structure before compaction) according to the trained second learning parameters to calculate the second model structure (the second model structure after compaction).
[0041] FIG. 4 is a diagram showing second machine learning models 411, 421 before and after compaction. The left diagram in FIG. 4 shows the second machine learning model 411 before compaction, and the right diagram in FIG. 4 shows the second machine learning model 421 after compaction. The second machine learning model 411 before compaction has a second model structure 412 and learning parameters 413 before compaction. The second model structure 412 is assumed to be equal to the model structure (first model structure) of the first machine learning model. In FIG. 4, the second learning parameters 413 are a parameter set W={W (l)} (l=1,2,3,4=L) is shown. When learning is performed under the second learning conditions, as shown in the left diagram of FIG. 4, the weight parameters connected to some nodes will converge to a small threshold or less. This small threshold is set to, for example, 1e-6. In FIG. 4, white squares among the squares representing the second weight parameters represent weight parameters having values equal to or greater than the threshold, and gray squares represent weight parameters having values equal to or less than the threshold.
[0042] The learning unit 13 compacts the second model structure 412 according to the learned weight parameter values. The compaction is performed by the technique described in U.S. Patent Application Publication No. US2020 / 0012945. For example, the learning unit 13 deletes the node 45 connected to a weight parameter equal to or less than a threshold from among the nodes included in the second model structure 412 before compaction, and leaves the node 46 connected to a weight parameter equal to or more than the threshold. This generates the second model structure 422 after compaction. All weight parameters of the second learning parameters 423 after compaction have values equal to or greater than the threshold. The second model structure 422 to which the second learning parameters 423 after compaction are assigned constitutes the second machine learning model 421 after compaction.
[0043] The second machine learning model 421 is a compacted machine learning model that performs calculations equivalent to those of the first machine learning model. As the strength of weight decay in the second learning condition increases, the second model structure 422 tends to have a smaller model size and lower inference accuracy (lower recognition rate) compared to the first model structure.
[0044] When step S3 is performed, the determination unit 14 determines whether or not to perform re-learning (step S4). In step S4, the determination unit 14 determines whether or not to perform re-learning based on a comparison between the first inference accuracy and the second inference accuracy. As an example, when a plurality of second machine learning models are learned in step S3, the determination unit 14 determines whether or not to perform re-learning based on a comparison between the best value among the plurality of second inference accuracies that are equal to or smaller than a predetermined model size (hereinafter, size reference value) and a reference value based on the first inference accuracy (hereinafter, accuracy reference value). In other words, the determination unit 14 determines whether or not re-learning is required according to a determination criterion based on the size reference value and the accuracy reference value. The size reference value and the accuracy reference value are determined based on the specifications of the computer equipped with the machine learning model and the required performance specifications. In more detail, the size reference value is set based on the model size of the first machine learning model, and is typically set to a value lower than the model size of the first machine learning model and the maximum value that the consumer is willing to compromise on. Alternatively, the size standard value may be set to a predetermined ratio to the model size of the first machine learning model or a value obtained by subtracting a predetermined value from the model size. Similarly, the accuracy standard value may be set based on the first inference accuracy, and may typically be set to a minimum value that is lower than the first inference accuracy and satisfies the consumer. Alternatively, the accuracy standard value may be set to a predetermined ratio to the first inference accuracy or a value obtained by subtracting a predetermined value from the first inference accuracy.
[0045] Specifically, the number of parameters of the second model structure after compactification corresponding to the L2 regularization strength λ (weight decay) = {1e-6, 1e-5, 1e-4, 1e-3, 1e-2} is {122, 110, 100, 82, 58}, the second inference accuracy is {90%, 88%, 87%, 80%, 60%}, the size standard value is 100, and the accuracy standard value is 85%.
[0046] In this case, the inference accuracy of the second machine learning model in which the number of parameters of the second model structure is 100 or less is {87%, 80%, 60%}. Among them, the best value is 87%, which is the highest numerical value. Since the best value = 87% is greater (superior) than the accuracy reference value = 85%, the judgment criterion is satisfied. Therefore, it is determined that re-learning is not to be performed (step S4: NO).
[0047] As another example, the size reference value is 80, and the accuracy reference value is 85%. In this case, it is determined that re-learning is to be performed based on the above-mentioned judgment criteria (step S4: YES). In the above example, it is determined whether or not to perform re-learning based on a comparison between the best value among a plurality of second inference accuracies that are equal to or less than the size reference value and the accuracy reference value. However, this embodiment is not limited to this. For example, it may be determined whether or not to perform re-learning based simply on the magnitude relationship between the difference value between the first inference accuracy and the best value and a threshold value.
[0048] If it is determined that re-learning is to be performed (step S4: YES), the re-learning unit 15 learns a third machine learning model (step S5). In step S5, the re-learning unit 15 learns the third machine learning model based on the third learning condition, the third model structure, and the third learning condition.
[0049] In step S5, the re-learning unit 15 sets the model structure of the third machine learning model (third model structure) based on the model structure of the second machine learning model (second model structure). More specifically, the re-learning unit 15 sets the third model structure according to linear transformation of the number of nodes, number of channels, number of layers, kernel size and / or input resolution of the second model structure, or rounding of a predetermined natural number multiple or multiplier of the number of nodes, number of channels, number of layers, kernel size and / or input resolution of the second model structure. For example, according to Reference Technology 1 (Ariel Gordon et al., "MorphNet: Fast & Simple Resource-Constrained Structure Learning of Deep Networks", in CVPR2018), a model structure obtained by transforming the second model structure within a range equal to or less than a size reference value is used as the third model structure. Here, "transformation" refers to increasing or decreasing the number of nodes, number of channels, etc. of the second model structure equal to or less than a size reference value by a small amount. Also, a model structure that is equal to or modified from the second model structure having a model size that is slightly larger than the size reference value may be used as the third model structure, which may be identical to the second model structure after compaction.
[0050] In step S5, the re-learning unit 15 calculates a third learning condition based on the first learning condition. The first learning condition is a valid learning condition considered before compaction, and is likely to be superior in terms of performance to the second learning condition changed for compaction. Therefore, the third learning condition should be set to be different from the second learning condition and the same as the first learning condition. As a more advanced setting, for example, a learning condition in which the learning rate or the number of epochs of the first learning condition is reduced may be set as the third learning condition using a table or a formula according to the reduction amount (reduction rate) of the model size.
[0051] In step S5, the re-learning unit 15 trains (iteratively learns) the third learning parameters assigned to the model structure of the third machine learning model based on the learning data acquired in step S1 according to the third learning conditions set as described above, and generates a trained third machine learning model. The learning of the third machine learning model may be performed by fine learning or scratch learning. Fine learning is a method of re-training all learning parameters using some or all of the learning parameters of the trained second machine learning model as initial values. Scratch learning is a method of re-training all learning parameters using learning parameters initialized with a predetermined random number as initial values. The initial values of the learning parameters may be set by a method that combines fine learning and scratch learning. Depending on the method of setting these initial values, the learning rate, in particular, of the third learning conditions may be changed. After re-learning, the re-learning unit 15 applies the evaluation data to the trained third machine learning model to calculate the third inference accuracy.
[0052] If it is determined in step S4 that re-learning is not necessary (step S4: NO) or if step S5 is performed, the display control unit 16 displays the learning results (step S6). The learning results include the model structure, model size, and inference accuracy of each machine learning model. The learning results are displayed on the display device 5 in a predetermined layout.
[0053] FIG. 5 is a diagram showing an example of a display screen I1 of the learning result when it is determined in step S4 that re-learning is unnecessary. As shown in FIG. 5, the display screen I1 displays a graph I11, in which the vertical axis represents the recognition rate [%] and the horizontal axis represents the number of parameters, as the learning result. The recognition rate is an example of the inference accuracy, and the number of parameters is an example of the model size. The graph I11 plots a plurality of points corresponding to the plurality of second machine learning models learned in step S3. In addition, the graph I11 may also plot points corresponding to the first machine learning model. Each point represents the inference accuracy and the model size of each machine learning model. The points corresponding to the second machine learning model and the points corresponding to the first machine learning model may be displayed in different shapes, sizes, and / or colors. For example, in FIG. 5, five points corresponding to the second machine learning model are drawn with black circles, and points corresponding to the first machine learning model are drawn with cross marks. In addition, a thick line indicating the inference accuracy of the first machine learning model and a thick line indicating the model size are superimposed on the graph I11 so as to intersect with the points. By displaying the inference accuracy and model size of the first machine learning model and the second machine learning model in a graph in this manner, the relationship between them can be clearly visually understood, and ultimately, a machine learning model having a desired inference accuracy and model size can be easily identified.
[0054] The graph I11 displays a point corresponding to the criterion R0 for re-learning in step S4. The point is displayed as a triangle in FIG. 5. In FIG. 5, the criterion R0 is the size reference value=100 and the recognition rate=85%, as in the above example. In addition, the graph I11 may display an area I12 that satisfies the criterion R0 in a visually emphasized manner, for example, in red. Among the points corresponding to the second machine learning model, points included in the area I12, i.e., points that satisfy the criterion for re-learning, may be displayed in a different shape, size, and / or color from points that do not satisfy the criterion. As an example, the points included in the area I12 may be displayed in red, and points not included in the area I12 may be displayed in black. By displaying the points corresponding to the criterion or the areas that satisfy the criterion on the graph I11 in this way, it becomes possible to visually and easily determine whether each machine learning model satisfies the criterion.
[0055] As shown in FIG. 5, for points corresponding to each machine learning model, numerical values describing the inference accuracy and model size of the machine learning model corresponding to the point may be displayed in visual association with the point. For points corresponding to the second machine learning model R2, numerical values of the inference accuracy and number of parameters may be displayed only for points that satisfy the judgment criterion R0. For example, as shown in FIG. 5, "R2: 87%, 100" may be displayed in association with points of the second machine learning model R2 included in the region I12. params Of course, numerical values may be displayed for all points corresponding to the second machine learning model R2, or numerical values may be displayed only for points specified via the input device 3 or the like. In addition, "R0: 85%, 100" may be displayed in association with the point corresponding to the judgment criterion R0. params " is displayed, and "R1: 95%, 176" is associated with the point corresponding to the first machine learning model R1. params " may be displayed.
[0056] FIG. 6 is a diagram showing an example of a display screen I2 of the learning result when it is determined in step S4 that re-learning is necessary. As shown in FIG. 6, the display screen I2 displays a graph I21, in which the vertical axis represents the recognition rate [%] and the horizontal axis represents the number of parameters, as in FIG. 5, as the learning result. The graph I21 plots a plurality of points corresponding to the plurality of second machine learning models R2 learned in step S3, a point corresponding to the first machine learning model R1, and a point corresponding to the third machine learning model R3. Each point represents the inference accuracy and model size of each machine learning model. In addition, the graph I21 displays a point corresponding to the judgment criterion R0 and an area I22 that satisfies the judgment criterion, as in the graph I11. The points corresponding to the second machine learning model R2, the points corresponding to the first machine learning model R1, and the points corresponding to the third machine learning model R3 may be displayed in different shapes, sizes, and / or colors. By displaying the inference accuracy and model size of the first machine learning model, the second machine learning model R2, and the third machine learning model R3 in a graph in this way, the relationship between them can be visually clearly understood, and it becomes possible to easily specify a machine learning model having a desired inference accuracy and model size. For example, according to Figure 6, it is possible to easily understand that the inference accuracy (recognition rate) of the third machine learning model R3 has been improved by re-learning compared to the best value of the second machine learning model R2, and further, the degree of improvement.
[0057] As shown in FIG. 6, among the multiple points corresponding to the second machine learning model R2, the points that satisfy the model size criteria and have the best inference accuracy may be visually emphasized in blue or the like. As in FIG. 5, for each point corresponding to each machine learning model, a numerical value describing the inference accuracy and model size of the machine learning model corresponding to the point may be displayed in visual association with the point. In this case, the numerical values describing the inference accuracy and model size may be displayed visually distinct between those that satisfy the judgment criterion R0 and those that do not. For example, the numerical values representing the inference accuracy and model size that satisfy the judgment criterion R0 may be displayed in red, and those that do not may be displayed in blue.
[0058] The display control unit 16 may display the structures of the first machine learning model, the second machine learning model, and / or the third machine learning model on the display device 5. As an example, when a point corresponding to the first machine learning model, the second machine learning model, and / or the third machine learning model displayed in the graphs I11 and I21 in Fig. 5 and Fig. 6 is specified via the input device 3, the display control unit 16 displays the structure of the machine learning model corresponding to the specified point.
[0059] FIG. 7 is a diagram showing an example of a display screen I3 of the structure of a machine learning model. As shown in FIG. 7, when a point corresponding to the second machine learning model R2 is specified via the input device 3, the display control unit 16 displays the structure of the second machine learning model R2. Specifically, when a point corresponding to the second machine learning model is specified via the input device 3, the display control unit 16 displays a display window I31. The display window I31 displays a schematic diagram I32 of the model structure of the specified second machine learning model R2 and a schematic diagram I33 of weight parameters. In the schematic diagram I32, each layer and the nodes included in the layer are drawn so that the number of layers and the number of nodes of the second machine learning model R2 can be visually recognized. In the schematic diagram I33, a parameter set W' between layers is displayed. (l) In order to visually confirm the number of weight parameters, squares are drawn to represent the weight parameters. A dotted line or the like may be drawn to represent the number of elements of the weight parameters before compaction.
[0060] The operator checks the learning results exemplified in Figs. 5 to 7 and selects the second or third machine learning model having the desired performance. For example, if it is determined that re-learning is unnecessary, the second machine learning model that satisfies the judgment criteria is selected, and if re-learning is performed, the third machine learning model is selected. The selected second or third machine learning model may be stored in the storage device 2 or a portable recording medium, or transferred to the consumer's computer via the communication device 4.
[0061] When step S6 is performed, the learning process illustrated in FIG. 2 ends.
[0062] According to the above-mentioned learning process, the performance before and after compaction is compared, and the necessity of re-learning is automatically determined. If the performance does not decrease after compaction and satisfies the judgment criterion, the second machine learning model generated by compaction is adopted, and if the performance does not reach the judgment criterion, re-learning is performed and the third machine learning model generated by re-learning is adopted. According to such a learning process, it is possible to efficiently search for a machine learning model having good performance with a good balance between model size and inference accuracy.
[0063] It should be noted that the present embodiment is not limited to the above-described embodiment, and can be modified without departing from the spirit and scope of the invention.
[0064] (Variation 1) In the above embodiment, the task of the machine learning model is image classification. However, this embodiment is not limited to this. As an example, the task according to this embodiment can also be applied to semantic segmentation, object detection, generative models, etc. In addition, the input to the machine learning model is not limited to image data. For example, when the input is text data, the task may be machine translation. As another example, when the input of the machine learning model is voice data, the task may be voice recognition.
[0065] (Variation 2) In the above embodiment, the model structure of the machine learning model is a multi-layer perceptron (MLP). However, this embodiment is not limited to this. The model structure according to this embodiment can be applied to any model structure such as CNN, RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), etc.
[0066] (Variation 3) In the above embodiment, the acquisition unit 11 acquires the already calculated first machine learning model and the first inference accuracy from another computer or the like. However, this embodiment is not limited to this. As an example, the processing circuit 1 may learn the first machine learning model based on the learning data, the model structure of the first machine learning model, and the first learning condition. In this case, the processing circuit 1 may apply the evaluation data to the learned first machine learning model to calculate the first inference accuracy.
[0067] (Variation 4) The setting unit 12 according to the fourth modification example sets the optimization method to Adam, introduces L2 regularization, and sets the activation function to a saturated nonlinear function as the second learning condition, which is different from the first learning condition. For example, when compaction is performed using the technology described in the above-mentioned US Patent Application Publication No. US2020 / 0012945, the activation function may be set to a saturated nonlinear function other than ReLU. The setting unit 12 may select, as the activation function for the second learning condition, a saturated nonlinear function whose behavior is closest to the activation function determined by the first learning condition from a table (LUT: Look Up Table). As an example, when the activation function for the first learning condition is sigmoid, a hard sigmoid may be selected as the activation function for the second learning condition.
[0068] When compaction is performed using a technique other than the technique described in the above-mentioned US Patent Application Publication No. US2020 / 0012945, the setting unit 12 may set the second learning condition according to the characteristics of the compaction technique. As an example, in Reference Technique 2 (Jianhui Yu et al., “Slimmable Neural Networks”, ICLR2019) as a compaction technique, it is possible to prune unnecessary hidden layer channels after learning by introducing L1 regularization into a batch normalization (BN) layer. In this case, the setting unit 12 adds a BN layer and introduces L1 regularization into the BN layer with respect to the second learning condition. It is preferable to set a plurality of L1 regularization strengths.
[0069] (Variation 5) In the above embodiment, the re-learning unit 15 performs re-learning only on one second machine learning model selected based on the size reference value and the accuracy reference value from the viewpoint of efficient learning of the machine learning model. However, when abundant computer resources can be utilized, the re-learning unit 15 may perform re-learning on all second machine learning models. In this case, it is preferable that a final third machine learning model is selected from among a plurality of third machine learning models based on the size reference value and the accuracy reference value. In the fifth modification, since re-learning is performed on all second machine learning models, the determination unit 14 is not necessary.
[0070] (Variation 6) In the embodiment of FIG. 2, when it is determined in step S4 that re-learning is not to be performed (step S4: NO) or when step S5 is performed, the display control unit 16 displays the learning result in step S6. However, this embodiment is not limited to this. As an example, when step S4 is performed, the display control unit 16 may display the first inference accuracy, the second inference accuracy, the size reference value, and the accuracy reference value. Thereafter, the re-learning unit 15 may correct the judgment criteria defined by the size reference value and the accuracy reference value, and thereafter perform learning of the third machine learning model and calculation of the third inference accuracy (step S5), and the display control unit 16 may display the learning result (step S6).
[0071] (Additional remarks) According to some of the above embodiments, the learning device 100 includes an acquisition unit 11, a setting unit 12, a learning unit 13, and a re-learning unit 15. The acquisition unit 11 acquires a first learning condition and a first machine learning model trained according to the first learning condition. The setting unit 12 sets a second learning condition different from the first learning condition for reducing the model size of the first machine learning model. The learning unit 13 trains a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model according to the second learning condition. The re-learning unit 15 trains a third machine learning model based on the second machine learning model according to a third learning condition that is not the same as the second learning condition and corresponds to the first learning condition.
[0072] Thus, according to this embodiment, it is possible to easily obtain the desired performance of the machine learning model.
[0073] Although some embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their modifications are included in the scope and spirit of the invention, and are included in the scope of the invention and its equivalents described in the claims. [Explanation of symbols]
[0074] 1...processing circuit, 2...memory device, 3...input device, 4...communication device, 5...display device, 11...acquisition unit, 12...setting unit, 13...learning unit, 14...judgment unit, 15...relearning unit, 16...display control unit, 100...learning device.
Claims
1. an acquisition unit that acquires a first learning condition and a first machine learning model trained in accordance with the first learning condition; A setting unit that sets a second learning condition that is different from the first learning condition and is for reducing a model size of the first machine learning model; a learning unit that learns a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model in accordance with the second learning condition; a re-learning unit that learns a third machine learning model based on the trained second machine learning model in accordance with a third learning condition that is not the same as the second learning condition and corresponds to the first learning condition; A learning device comprising:
2. a determination unit that determines whether or not training of the third machine learning model is necessary based on a comparison between a first inference accuracy that represents an inference accuracy regarding the first machine learning model and a second inference accuracy that represents an inference accuracy regarding the trained second machine learning model, The re-learning unit, when it is determined that learning of the third machine learning model is necessary, learns the third machine learning model. The learning device according to claim 1.
3. The setting unit sets a plurality of second learning conditions that are different from one another, the learning unit learns the second machine learning models in accordance with the second learning conditions to generate a plurality of trained second machine learning models; the determination unit determines whether or not training of the third machine learning model is necessary based on a comparison between a best value of the second inference accuracy corresponding to a trained second machine learning model having a model size equal to or smaller than a reference value among the plurality of trained second machine learning models and a reference value based on the first inference accuracy; The learning device according to claim 2.
4. The learning device of claim 1 , wherein the re-learning unit sets the third machine learning model according to a linear transformation of the number of nodes, number of channels, number of layers, kernel size and / or input resolution of the trained second machine learning model, or a rounding of a predetermined natural number multiple or multiplier of the number of nodes, number of channels, number of layers, kernel size and / or input resolution of the trained second machine learning model.
5. The learning device according to claim 1 , wherein the re-learning unit initializes the learning parameters of the third machine learning model according to a predetermined random number, or initializes the learning parameters by copying a portion of the learned weighting coefficients of the learned second machine learning model.
6. 2. The learning device according to claim 1, wherein the setting unit sets, as the second learning condition, an optimization method to Adam, introduces L2 regularization, and sets an activation function to a saturated nonlinear function, which are different from the first learning condition.
7. The learning device according to claim 1 , wherein the setting unit sets, as the second learning condition, a BN layer and introduces L1 regularization to the BN layer, which is different from the first learning condition.
8. The learning device according to claim 1 , further comprising a display unit that displays a structure of the first machine learning model, the trained second machine learning model, and / or the trained third machine learning model.
9. The learning device according to claim 1 , further comprising a display unit that displays model sizes of the first machine learning model, the trained second machine learning model, and / or the trained third machine learning model.
10. The learning device according to claim 1 , further comprising a display unit that displays performance of the first machine learning model, the trained second machine learning model, and / or the trained third machine learning model.
11. The learning device according to claim 3 , further comprising a display unit that displays a graph plotting a plurality of points representing the inference accuracy and model size of the plurality of trained second machine learning models.
12. The learning device according to claim 11 , wherein the display unit displays, on the graph, points corresponding to the reference value and the best value and / or an area where the reference value and the best value are satisfied.
13. The learning device according to claim 12 , wherein the display unit displays, of the plurality of points, points that are included in the region and points that are not included in the region in different colors.
14. The learning device according to claim 11 , wherein the display unit plots points on the graph representing the inference accuracy and model size of the trained third machine learning model.
15. The learning device according to claim 14 , wherein the display unit displays a plurality of points corresponding to the plurality of trained second machine learning models and a point corresponding to the trained third machine learning model in different shapes, sizes and / or colors.
16. A processor comprising: By reading out the program stored in the storage device from the storage device and executing it, Obtaining a first learning condition and a first machine learning model trained according to the first learning condition; setting a second learning condition different from the first learning condition for reducing a model size of the first machine learning model; learning a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model in accordance with the second learning condition; training a third machine learning model based on the trained second machine learning model in accordance with a third learning condition that is not identical to the second learning condition and corresponds to the first learning condition; A learning method comprising the steps of:
17. On the computer, A function of acquiring a first learning condition and a first machine learning model trained in accordance with the first learning condition; A function of setting a second learning condition that is different from the first learning condition and is for reducing a model size of the first machine learning model; a function of training a second machine learning model having a smaller model size than the first machine learning model based on the first machine learning model in accordance with the second training condition; A function of training a third machine learning model based on the trained second machine learning model in accordance with a third learning condition that is not the same as the second learning condition and corresponds to the first learning condition; A learning program that achieves this.
Citation Information
Patent Citations
Information processing method and information processing device
JP2019164839A
Learning model generation device, learning model generation method, and program
JP2020107042A
Learning device, learning system, and learning method
JP2021039640A
Regularization of machine learning models
US20170161640A1
Homomorphic data analysis
US20180359078A1
