METHOD FOR MACHINE LEARNING DEPLOYMENT

A method for machine learning deployment that comprises steps of: determining a machine learning algorithm based on a training dataset; using the machine learning algorithm to build a machine learning model based on the training dataset; creating an executable file corresponding to the machine learning model, the executable file containing programming information for a programmable circuit; and loading the executable file into the programmable circuit so as to program the programmable circuit to allow the programmable circuit to use the machine learning model to process data.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority of Taiwanese Invention Patent Application No. 108130654, filed on Aug. 27, 2019.

FIELD

The disclosure relates to a method for machine learning deployment, and more particularly to a method for machine learning deployment that can automatically determine a machine learning algorithm.

BACKGROUND

As machine learning technology is progressively deployed in multiple fields such as the medical field, the economic field, the industrial field, and so on, a number of software companies have developed artificial intelligence (AI) platforms for the purpose of facilitating interested enterprises to build machine learning applications according to their own demands. Some hardware companies have also developed AI accelerator chips and/or embedded AI-facilitating devices, in order to increase performance of the machine learning applications built by these enterprises.

SUMMARY

An object of the disclosure is to provide a method for machine learning deployment that improves performance of machine learning applications and enhances user convenience.

According to one aspect of the disclosure, the method includes steps of: by a processing device, determining a machine learning algorithm based on a training dataset; and by the processing device, using the machine learning algorithm to build a machine learning model based on the training dataset.

According to one aspect of the disclosure, the method further includes steps of: by the processing device, creating an executable file corresponding to the machine learning model, the executable file containing programming information for a programmable circuit; by the processing device, loading the executable file into the programmable circuit so as to program the programmable circuit to allow the programmable circuit to use the machine learning model to process data; and by a processing unit electrically connected to the programmable circuit, transmitting to-be-analyzed data to the programmable circuit running the executable file, so that the programmable circuit uses the machine learning model to analyze the to-be-analyzed data to thereby obtain an inference result.

DETAILED DESCRIPTION

FIG. 1exemplarily illustrates a system1for providing machine learning service according to an embodiment of the disclosure. The system1includes a processing device11, a programmable circuit12, and a processing unit13electrically connected to the programmable circuit12. According to some embodiments, the processing device11may be, for example, a personal computer (PC), a server, a laptop computer or a tablet computer, but the disclosure is not limited thereto. According to some embodiments, the programmable circuit12may be, but not limited to, an integrated circuit, such as a field programmable gate array (FPGA) that can be quickly programmed and reconfigured. According to some embodiments, the processing unit13may include, but not limited to, a central processing unit (CPU), a single core processor, a multi-core processor, a dual-core mobile processor, a microprocessor, a microcontroller, a digital signal processor (DSP), a field-programmable gate array (FPGA), an application specific integrated circuit (ASIC), a radio-frequency integrated circuit (RFIC), etc. In some embodiments, the processing device11and the processing unit13are of a same device. For example, the processing unit13may be a processing unit (e.g., CPU) of the processing device11. In other embodiments, the processing unit13is external to the processing device11and is able to communicate with the processing device11via wired communication through a computer cable or via wireless communication using a wireless technology (e.g., Bluetooth®, Wi-Fi, etc.).

FIG. 2exemplarily illustrates a method for machine learning deployment according to an embodiment of the disclosure. The method can be implemented by the system.1shown inFIG. 1, and includes steps21-25that are described below with reference to the system1ofFIG. 1.

In step21, the processing device11determines, based on a training dataset, a machine learning algorithm applicable to the training dataset in order to build a corresponding machine learning model. According to some embodiments, the machine learning algorithm thus determined is selected from among a neural algorithm, a support vector machine (SVM) algorithm and a k-means algorithm. The training dataset contains plural pieces of training data each having an input feature. According to some embodiments, each piece of training data may optionally further have a label that indicates a desired output corresponding to the input feature thereof. The plural pieces of training data include plural pieces of establishment data and plural pieces of verification data; that is to say, a portion of the plural pieces of training data are establishment data and the rest are verification data.

Step21includes sub-steps211to220illustrated inFIG. 3. Referring toFIG. 3, in sub-step211, the processing device11determines whether the machine learning model to be built is a prediction model or a classification model based on the training dataset. When it is determined that the machine learning model to be built is a prediction model, the procedure goes to sub-step212; when it is determined that the machine learning model to be built is a classification model, the procedure goes to sub-step217. According to some embodiments, the determination as to whether the machine learning model to be built is a prediction model or a classification model is made based on whether the establishment data contained in the training dataset has labels and based on what type of labels the training dataset has. For example, in an embodiment, the processing device11determines that the machine learning model to be built is a prediction model when each piece of establishment data has a label which is a mathematical value, and determines that the machine learning model to be built is a classification model when each piece of establishment data has no label or has a label indicating a classification.

In sub-step212, the processing device11determines whether the input features in the training dataset are each in the form of text data. If so, the procedure goes to sub-step213; otherwise, the procedure goes to sub-step214.

In sub-step213, the processing device11selects the SVM algorithm to serve as the machine learning algorithm.

In sub-step214, based on the plural pieces of establishment data in the training dataset, the processing device11uses the SVM algorithm and the neural algorithm to build a first inference model and a second inference model, respectively. According to some embodiments, software modules of the neural algorithm, the SVM algorithm and the k-means algorithm have been pre-installed in the processing device11, so that the processing device11may build machine learning models by using the software modules. Therefore, the first inference model is built by using the software module of the SVM algorithm, and the second inference model is built by using the software module of the SVM algorithm.

In sub-step215, the processing device11uses the plural pieces of verification data in the training dataset to test the first inference model and the second inference model to obtain a first inference accuracy and a second inference accuracy, respectively. According to some embodiments, the first inference accuracy is obtained by first, for each piece of verification data in the training dataset, obtaining a first inferred result corresponding to the piece of verification data by feeding the input feature of the piece of verification data into the first inference model, and determining whether the first inferred result thus obtained matches the label of the piece of verification data, and then determining the first inference accuracy based on a ratio of a number of those of the first inferred results that match the labels to a total number of the first inferred results corresponding respectively to the plural pieces of verification data. Similarly, the second inference accuracy is obtained by first, for each piece of verification data in the training dataset, obtaining a second inferred result corresponding to the piece of verification data by feeding the input feature of the piece of verification data into the second inference model, and determining whether the second inferred result thus obtained matches the label of the piece of verification data, and then determining the second inference accuracy based on a ratio of a number of those of the second inferred results that match the labels to a total number of the second inferred results corresponding respectively to the plural pieces of verification data.

In sub-step216, the processing device11determines the machine learning algorithm based on which one of the first inference accuracy and the second inference accuracy is greater. Specifically, the processing device11selects the SVM algorithm to serve as the machine learning algorithm when it is determined that the first inference accuracy is greater, and selects the neural algorithm to serve as the machine learning algorithm when it is determined that the second inference accuracy is greater.

On the other hand, when it is determined in sub-step211that the machine learning model to be built is a classification model, the procedure goes to sub-step217.

In sub-step217, the processing device11determines whether the plural pieces of training data each have a label. If so, the procedure goes to sub-step219; otherwise, the procedure goes to sub-step218.

In sub-step218, the processing device11selects the k-means algorithm to serve as the machine learning algorithm.

In sub-step219, the processing device11determines whether the input features of the plural pieces of training data in the training dataset are each in the form of image data. If so, the procedure goes to sub-step220; otherwise, the procedure goes to sub-steps214-216.

In sub-step220, the processing device11selects the neural algorithm to serve as the machine learning algorithm.

Referring back toFIG. 2, in step23, the processing device11uses the machine learning algorithm determined in step21to build a machine learning model based on the training dataset. According to some embodiments, the processing device11uses each piece of training data contained in the training dataset and the software module corresponding to the determined machine learning algorithm to build the machine learning model.

In step24, the processing device11creates an executable file corresponding to the machine learning model by using a software tool, and loads the executable file into the processing unit13and the programmable circuit12in order to program the programmable circuit12to allow the programmable circuit12to use the machine learning model to process data. According to some embodiments, the processing device11may create the executable file by executing a deep neural network development kit (DNNDK) to transform the machine learning model to an Executable and Linkable Format (ELF) file that includes a first instruction set to be executed on the processing unit13, a second instruction set to be executed on the programmable circuit12, and a set of register-transfer level (RTL) codes to be executed on the programmable circuit12. Moreover, when the machine learning algorithm determined in step21is the SVM algorithm or the k-means algorithm, the processing device11may further execute, in step24, Vivado® to transform the machine learning model to a bitstream file that is to be burned on the programmable circuit12to form an intellectual property (IP) core that can use the machine learning model (of the SVM algorithm or of the k-means algorithm) to process data. In these embodiments, if a bitstream file is generated in step24, the second instruction set and the set of RTL codes of the ELF file generated by the DNNDK are to be executed on the programmable circuit12that has been programmed with the bitstream file; otherwise, the second instruction set and the set of RTL codes of the ELF file generated by the DNNDK are to be executed on a deep learning processing unit (DPU), such as a Xilinx DPU, of the programmable circuit12that is an IP core that utilizes hardware resources, including the lookup table (LUT), the register, the block random access memory (BRAM) and the digital signal processor (DSP), in the FPGA to increase computing speed of neural network computation.

In step25, the processing unit13transmits to-be-analyzed data to the programmable circuit12running the executable file, in order for the programmable circuit12to use the machine learning model to analyze the to-be-analyzed data to obtain an inference result. According to some embodiments, when receiving an instruction to analyze data with the machine learning model built in step23, the processing unit13executes the first instruction set and sends the to-be-analyzed data to an IP core (which may be a DPU or an IP core formed with a bitstream file generated by Vivado®) of the programmable circuit12to request the IP core to analyze the to-be-analyzed data (i.e., make a reference with the to-be-analyzed data) with the machine learning model and to send the inference result back to the processing unit13.

It can be appreciated that the disclosed method for machine learning deployment which automatically determines a best machine learning algorithm that is not only a suitable algorithm to the training dataset but also an algorithm with higher inference accuracy is advantageous. Further, the disclosed method is beneficial in utilizing software tools and the programmable circuit12to allow users to easily create customized hardware with acceleration functionality for executing the established machine learning model.