TWI765266B - Training method, device for machine learning model and electronic device - Google Patents

Training method, device for machine learning model and electronic device Download PDF

Info

Publication number
TWI765266B
TWI765266B TW109116326A TW109116326A TWI765266B TW I765266 B TWI765266 B TW I765266B TW 109116326 A TW109116326 A TW 109116326A TW 109116326 A TW109116326 A TW 109116326A TW I765266 B TWI765266 B TW I765266B
Authority
TW
Taiwan
Prior art keywords
machine learning
learning model
training
sample data
model
Prior art date
Application number
TW109116326A
Other languages
Chinese (zh)
Other versions
TW202145084A (en
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 鴻海精密工業股份有限公司
Priority to TW109116326A priority Critical patent/TWI765266B/en
Publication of TW202145084A publication Critical patent/TW202145084A/en
Application granted granted Critical
Publication of TWI765266B publication Critical patent/TWI765266B/en

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Electrically Operated Instructional Devices (AREA)

Abstract

The present disclosure relates to a training method, a device for machine learning model, and an electronic device. The methods includes: receiving a problem type selected by user, determining a machine learning model corresponding to the problem type, receiving sample data entered by the user to train the machine learning model, analyzing training results of the machine learning model obtained after the machine learning model is trained, displaying the training results that meet a preset condition, and providing the machine learning model corresponding to the training results that meet the preset condition to the user. This present disclosure enables users to quickly determine a corresponding machine learning model based on the problem type, simplifies a process of selecting machine learning model for training, and improves the training efficiency of the machine learning model.

Description

機器學習模型訓練方法、裝置及電子設備 Machine learning model training method, device and electronic device

本發明涉及機器學習領域,具體涉及一種機器學習模型訓練方法、裝置及電子設備。 The invention relates to the field of machine learning, in particular to a machine learning model training method, device and electronic equipment.

目前,由於機器學習種類有多種,例如包括隨機森林、SVM、樸素貝葉斯、knn、gbdt、xgboost、LR等,本領域人員在使用機器學習模型對樣本資料進行訓練時難以選擇合適的機器學習模型而導致訓練結果較差,不符合要求,需要重新選擇模型進行訓練的問題。然而,重複訓練機器學習模型又花費太多時間和成本,嚴重影響機器學習模型的訓練工作進度。 At present, because there are many types of machine learning, such as random forest, SVM, naive Bayes, knn, gbdt, xgboost, LR, etc., it is difficult for those in the field to choose a suitable machine learning model when training sample data using a machine learning model. The training result is poor and does not meet the requirements, and the model needs to be re-selected for training. However, it takes too much time and cost to repeatedly train the machine learning model, which seriously affects the training progress of the machine learning model.

鑒於以上內容,有必要提出一種機器學習模型訓練方法、裝置及電子設備,以簡化選擇機器學習模型進行訓練的過程,提高機器學習模型的訓練效率。 In view of the above content, it is necessary to propose a machine learning model training method, device and electronic device to simplify the process of selecting a machine learning model for training and improve the training efficiency of the machine learning model.

本申請的第一方面提供一種機器學習模型訓練方法,所述方法包括:接收用戶選擇的待處理的問題類型;確定與所述問題類型相對應的機器學習模型;接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練; 分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示;及將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 A first aspect of the present application provides a method for training a machine learning model, the method includes: receiving a question type to be processed selected by a user; determining a machine learning model corresponding to the question type; receiving sample data pairs input by a user The determined machine learning model is trained; Analyzing the training results of the machine learning model obtained after the training is completed, displaying the training results that meet the preset conditions; and providing the machine learning model corresponding to the training results that meet the preset conditions to the user.

優選地,所述確定與問題類型相對應的機器學習模型包括:藉由所確定的問題類型查找類型與模型關係表確定出與所述問題類型對應的機器學習模型,其中所述類型與模型關係表定義了多個問題類型與多個機器學習模型的對應關係。 Preferably, the determining the machine learning model corresponding to the problem type includes: searching a type and model relationship table by using the determined problem type to determine the machine learning model corresponding to the problem type, wherein the type is related to the model The table defines the correspondence between multiple question types and multiple machine learning models.

優選地,所述樣本資料類別至少包括第一樣本類別及第二樣本類別,所述接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括:獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤;將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率;及若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 Preferably, the sample data categories include at least a first sample category and a second sample category, and the training of the determined machine learning model by receiving the sample data input by the user includes: obtaining sample data of positive samples and negative samples and label the sample data of the positive sample with the sample category, so that the sample data of the positive sample carries the sample category label; the sample data of the positive sample and the sample data of the negative sample are randomly divided into a first preset ratio The training set and the verification set of the second preset ratio, use the training set to train the machine learning model, and use the verification set to verify the accuracy of the trained machine learning model; and if the accuracy When the accuracy rate is greater than or equal to the preset accuracy rate, the training is ended; if the accuracy rate is less than the preset accuracy rate, the number of positive samples and the number of negative samples are increased to retrain the machine learning model until the accuracy rate is greater than or equal to Preset accuracy.

優選地,所述訓練結果為準確率、精確率或網路大小,與所述準確率對應的預設條件為所述準確率大於第一預設值,與所述精確率對應的預設條件為所述精確率大於第二預設值,與所述網路大小對應的預設條件為所述機器學習模型的網路層數小於第三預設值。 Preferably, the training result is an accuracy rate, a precision rate or a network size, the preset condition corresponding to the accuracy rate is that the accuracy rate is greater than a first preset value, and the preset condition corresponding to the accuracy rate For the accuracy rate to be greater than the second preset value, the preset condition corresponding to the network size is that the number of network layers of the machine learning model is smaller than the third preset value.

優選地,所述機器學習模型包括多個卷積層、多個最大池採樣層、全連接層,其中,所述多個卷積層和所述多個最大池採樣層交替連接組成,所述多個最大池採樣層用於對所述樣本資料進行特徵提取得到特徵向量,所述多個全連接層相互連接,所述多個最大池採樣層中的最後一個最大池採樣層與多 個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 Preferably, the machine learning model includes multiple convolutional layers, multiple max-pooling sampling layers, and fully-connected layers, wherein the multiple convolutional layers and the multiple max-pooling sampling layers are alternately connected, and the multiple max-pooling sampling layers are alternately connected. The max-pool sampling layer is used to perform feature extraction on the sample data to obtain feature vectors, the multiple fully-connected layers are connected to each other, and the last max-pool sampling layer in the multiple max-pool sampling layers is associated with the multiple max-pool sampling layers. The first fully-connected layer of the fully-connected layers is connected to input the feature vector obtained by feature extraction to the first fully-connected layer, and the last fully-connected layer in the multiple fully-connected layers is a classification The classifier is used for classifying the feature vector to obtain a detection result.

優選地,所述接收使用者輸入的樣本資料對確定出的所述機器學習模型進行訓練包括:使用樣本資料以及與樣本資料對應的類別標籤建立訓練集;藉由所述機器學習模型的卷積層將所述訓練集中的樣本資料進行卷積運算和抽樣運算;將所述機器學習模型的最後一個卷積層連接到一個或多個全連接層,其中全連接層被配置為將進行卷積和抽樣運算後提取到的樣本資料的特徵進行綜合並輸出訓練參數和特徵模型;判斷機器學習模型是否滿足收斂條件,其中,當特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤一致時確定機器學習模型滿足收斂條件,否則確定機器學習模型不滿足收斂條件;當特徵模型與預設的標準特徵模型相一致時則輸出特徵模型;及當特徵模型不滿足收斂條件時反向傳播調整所述機器學習模型的權矩陣。 Preferably, receiving the sample data input by the user to train the determined machine learning model includes: establishing a training set by using the sample data and the class labels corresponding to the sample data; using the convolution layer of the machine learning model Perform convolution and sampling operations on the sample data in the training set; connect the last convolutional layer of the machine learning model to one or more fully-connected layers, wherein the fully-connected layers are configured to perform convolution and sampling Synthesize the features of the sample data extracted after the operation and output the training parameters and feature models; determine whether the machine learning model satisfies the convergence conditions, wherein, when the feature model is consistent with the preset standard feature model or the category label of the sample data It is determined that the machine learning model satisfies the convergence condition, otherwise it is determined that the machine learning model does not meet the convergence condition; when the feature model is consistent with the preset standard feature model, the feature model is output; and when the feature model does not meet the convergence condition, the back-propagation adjustment The weight matrix of the machine learning model.

本申請的第二方面提供一種機器學習模型訓練裝置,所述裝置包括:問題類型接收模組,用於接收使用者選擇的待處理的問題類型;模型確定模組,用於確定與所述問題類型相對應的機器學習模型;訓練模組,用於接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練;顯示模組,用於分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示;及模型提供模組,用於將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 A second aspect of the present application provides an apparatus for training a machine learning model, the apparatus comprising: a question type receiving module for receiving a question type to be processed selected by a user; a model determining module for determining a problem related to the question The machine learning model corresponding to the type; the training module is used to receive the sample data input by the user to train the determined machine learning model; the display module is used to analyze the training of the machine learning model obtained after the training is completed As a result, the training results that meet the preset conditions are displayed; and the model providing module is used to provide the user with the machine learning model corresponding to the training results that meet the preset conditions.

優選地,所述樣本資料類別至少包括第一樣本類別及第二樣本類別,所述接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括: 獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤;將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率;及若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 Preferably, the sample data categories include at least a first sample category and a second sample category, and the training of the determined machine learning model by receiving the sample data input by the user includes: Obtain the sample data of the positive sample and the sample data of the negative sample, and label the sample data of the positive sample with the sample category, so that the sample data of the positive sample can carry the sample category label; The sample data is randomly divided into a training set of a first preset ratio and a verification set of a second preset ratio, the training set is used to train the machine learning model, and the verification set is used to verify the validity of the trained machine learning model. accuracy; and if the accuracy is greater than or equal to the preset accuracy, end the training; if the accuracy is less than the preset accuracy, increase the number of positive samples and the number of negative samples to retrain the machine learning Model until the accuracy rate is greater than or equal to the preset accuracy rate.

優選地,所述機器學習模型包括多個卷積層、多個最大池採樣層、全連接層,其中,所述多個卷積層和所述多個最大池採樣層交替連接組成,所述多個最大池採樣層用於對所述樣本資料進行特徵提取得到特徵向量,所述多個全連接層相互連接,所述多個最大池採樣層中的最後一個最大池採樣層與多個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 Preferably, the machine learning model includes multiple convolutional layers, multiple max-pooling sampling layers, and fully-connected layers, wherein the multiple convolutional layers and the multiple max-pooling sampling layers are alternately connected, and the multiple max-pooling sampling layers are alternately connected. The max-pool sampling layer is used to perform feature extraction on the sample data to obtain feature vectors, the multiple fully-connected layers are connected to each other, and the last max-pool sampling layer in the multiple max-pool sampling layers is connected to a plurality of the fully-connected layers. The first fully-connected layer of the connection layer is connected to input the feature vector obtained by feature extraction to the first fully-connected layer, and the last fully-connected layer in the multiple fully-connected layers is a classifier. The classifier is used to classify the feature vector to obtain the detection result.

本申請的協力廠商面提供一種電子設備,所述電子設備包括處理器及記憶體,所述處理器用於執行所述記憶體中存儲的電腦程式時實現所述機器學習模型訓練方法。 The third party aspect of the present application provides an electronic device, the electronic device includes a processor and a memory, and the processor is configured to implement the machine learning model training method when executing a computer program stored in the memory.

本案接收用戶選擇的待處理的問題類型,確定與問題類型相對應的機器學習模型,接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練,並將符合預設條件的訓練結果所對應的機器學習模型提供給使用者,從而使得使用者根據問題類型快速確定出對應的機器學習模型,簡化了選擇機器學習模型進行訓練的過程,並提高了機器學習模型的訓練效率。 In this case, the type of problem to be processed selected by the user is received, the machine learning model corresponding to the problem type is determined, the sample data input by the user is received to train the determined machine learning model, and the training results that meet the preset conditions are corresponding to the training results. The machine learning model is provided to the user, so that the user can quickly determine the corresponding machine learning model according to the type of problem, which simplifies the process of selecting a machine learning model for training and improves the training efficiency of the machine learning model.

50:問題類型選擇介面 50: Question type selection interface

51:第一類型選項 51: First Type Options

52:第二類型選項 52: Second type option

53:第三類型選項 53: Third type option

60:類型與模型關係表 60: Type and model relationship table

40:機器學習模型訓練裝置 40: Machine learning model training device

401:問題類型接收模組 401: Problem type receiving module

402:模型確定模組 402: Model determination module

403:訓練模組 403: Training Module

404:顯示模組 404: Display module

405:模型提供模組 405: Model provides mods

406:設置模組 406: set mod

6:電子設備 6: Electronic equipment

61:記憶體 61: Memory

62:處理器 62: Processor

63:電腦程式 63: Computer Programs

S11~S15:步驟 S11~S15: Steps

圖1為本發明一實施方式中機器學習模型訓練方法的流程圖。 FIG. 1 is a flowchart of a method for training a machine learning model in an embodiment of the present invention.

圖2為本發明一實施方式中問題類型選擇介面的示意圖。 FIG. 2 is a schematic diagram of a question type selection interface in an embodiment of the present invention.

圖3為本發明一實施方式中類型與模型關係表的示意圖。 FIG. 3 is a schematic diagram of a type-model relationship table in an embodiment of the present invention.

圖4為本發明一實施方式中機器學習模型訓練裝置的結構圖。 FIG. 4 is a structural diagram of an apparatus for training a machine learning model in an embodiment of the present invention.

圖5為本發明一實施方式中電子設備的示意圖。 FIG. 5 is a schematic diagram of an electronic device in an embodiment of the present invention.

為了能夠更清楚地理解本發明的上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明的是,在不衝突的情況下,本申請的實施例及實施例中的特徵可以相互組合。 In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments may be combined with each other in the case of no conflict.

在下面的描述中闡述了很多具體細節以便於充分理解本發明,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。 In the following description, many specific details are set forth in order to facilitate a full understanding of the present invention, and the described embodiments are only some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

除非另有定義,本文所使用的所有的技術和科學術語與屬於本發明的技術領域的技術人員通常理解的含義相同。本文中在本發明的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本發明。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.

優選地,本發明機器學習模型訓練方法應用在一個或者多個電子設備中。所述電子設備是一種能夠按照事先設定或存儲的指令,自動進行數值計算和/或資訊處理的設備,其硬體包括但不限於微處理器、專用積體電路(Application Specific Integrated Circuit,ASIC)、可程式設計閘陣列(Field-Programmable Gate Array,FPGA)、數文書處理器(Digital Signal Processor,DSP)、嵌入式設備等。 Preferably, the machine learning model training method of the present invention is applied in one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs) , Programmable Gate Array (Field-Programmable Gate Array, FPGA), Digital Signal Processor (Digital Signal Processor, DSP), embedded devices, etc.

所述電子設備可以是桌上型電腦、筆記型電腦、平板電腦及雲端伺服器等計算設備。所述設備可以與使用者藉由鍵盤、滑鼠、遙控器、觸控板或聲控設備等方式進行人機交互。 The electronic device may be a computing device such as a desktop computer, a notebook computer, a tablet computer, and a cloud server. The device can interact with the user by means of a keyboard, a mouse, a remote control, a touch pad or a voice control device.

實施例1 Example 1

圖1是本發明一實施方式中機器學習模型訓練方法的流程圖。根據不同的需求,所述流程圖中步驟的順序可以改變,某些步驟可以省略。 FIG. 1 is a flowchart of a method for training a machine learning model in an embodiment of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

參閱圖1所示,所述機器學習模型訓練方法具體包括以下步驟: Referring to Figure 1, the machine learning model training method specifically includes the following steps:

步驟S11,接收使用者選擇的待處理的問題類型。 Step S11, receiving the question type to be handled selected by the user.

本實施方式中,所述問題類型為藉由機器學習模型所能解決的問題所對應的類型。具體的,所述問題類型包括圖像中的物件分類、圖像的分割及圖像中的物件檢測。 In this embodiment, the problem type is the type corresponding to the problem that can be solved by the machine learning model. Specifically, the problem types include object classification in images, segmentation of images, and object detection in images.

本實施方式中,所述接收用戶選擇待處理的問題類型包括:藉由問題類型選擇介面50接收使用者選擇的待處理的問題類型。請參考圖2,所示為本發明一實施方式中問題類型選擇介面50的示意圖。所述問題類型選擇介面50包括第一類型選項51、第二類型選項52及第三類型選項53。其中,第一類型選項51用於供使用者選擇圖像中的物件分類,第二類型選項52用於供使用者選擇圖像的分割,第三類型選項53用於供使用者選擇圖像中的物件檢測。也即,當使用者選擇第一類型選項51時,所述問題類型選擇介面50接收使用者選擇的圖像中的物件分類作為問題類型;當使用者選擇第二類型選項52時,所述問題類型選擇介面50接收使用者選擇的圖像的分割作為問題類型;當使用者選擇第三類型選項53時,所述問題類型選擇介面50接收使用者選擇的圖像中的物件檢測作為問題類型。 In this embodiment, the receiving a user-selected question type to be handled includes: receiving a user-selected question type to be handled through the question type selection interface 50 . Please refer to FIG. 2 , which is a schematic diagram of a question type selection interface 50 in an embodiment of the present invention. The question type selection interface 50 includes a first type option 51 , a second type option 52 and a third type option 53 . Among them, the first type option 51 is used for the user to select the object classification in the image, the second type option 52 is used for the user to select the segmentation of the image, and the third type option 53 is used for the user to select the image in the image. object detection. That is, when the user selects the first type option 51, the question type selection interface 50 receives the object classification in the image selected by the user as the question type; when the user selects the second type option 52, the question type The type selection interface 50 receives the segmentation of the image selected by the user as the question type; when the user selects the third type option 53 , the question type selection interface 50 receives the object detection in the image selected by the user as the question type.

步驟S12,確定與所述問題類型相對應的機器學習模型。 Step S12, determining a machine learning model corresponding to the problem type.

本實施方式中,所述確定與問題類型相對應的機器學習模型包括:藉由所確定的問題類型查找類型與模型關係表60確定出與所述問題類型對應的機器學習模型,其中所述類型與模型關係表60定義了多個問題類型與多個機器學習模型的對應關係。請參考圖3,所示為本發明一實施方式中類型與模型關係表60的示意圖。所述類型與模型關係表60定義問題類型為圖像中的物件分類與機器學習模型為第一模型的對應關係,其中,第一模型可以為圖像的 物件分類模型;定義問題類型為圖像的分割與機器學習模型為第二模型的對應關係,其中,第二模型可以為圖像的分割模型;定義問題類型為圖像中的物件檢測與機器學習模型為第三模型的對應關係,其中,第三模型可以為圖像中的物件檢測模型。本實施方式中,所述第一模型、第二模型、第三模型為隨機森林、SVM、樸素貝葉斯、knn、gbdt、xgboost、LR中的至少一種模型。 In this embodiment, the determining the machine learning model corresponding to the problem type includes: searching the type-model relationship table 60 for the determined problem type to determine the machine learning model corresponding to the problem type, wherein the type The relationship with the model table 60 defines the corresponding relationship between a plurality of question types and a plurality of machine learning models. Please refer to FIG. 3 , which is a schematic diagram of a type-model relationship table 60 in an embodiment of the present invention. The type and model relationship table 60 defines the problem type as the correspondence between the object classification in the image and the machine learning model as the first model, wherein the first model can be the image Object classification model; define the problem type as the correspondence between image segmentation and machine learning model as the second model, where the second model can be an image segmentation model; define the problem type as object detection in images and machine learning The model is the corresponding relationship of the third model, wherein the third model may be an object detection model in the image. In this embodiment, the first model, the second model, and the third model are at least one model among random forest, SVM, Naive Bayes, knn, gbdt, xgboost, and LR.

在另一實施方式中,所述確定與問題類型相對應的機器學習模型包括:接收使用者輸入的機器學習模型,並將接收的機器學習模型確定為與所述問題類型相對應的機器學習模型。本實施方式中,將使用者輸入的機器學習模型確定為與所述問題類型相對應的機器學習模型可以使專業的研發人員可根據自己的計畫增加更多的機器學習模型進行樣本訓練。 In another embodiment, the determining the machine learning model corresponding to the question type includes: receiving a machine learning model input by a user, and determining the received machine learning model as the machine learning model corresponding to the question type . In this embodiment, the machine learning model input by the user is determined as the machine learning model corresponding to the problem type, so that professional R&D personnel can add more machine learning models for sample training according to their own plans.

步驟S13,接收使用者輸入的樣本資料對確定出的所述機器學習模型進行訓練。 Step S13, receiving the sample data input by the user to train the determined machine learning model.

本實施方式中,所述樣本資料類別至少包括第一樣本類別及第二樣本類別兩個不同的類別。所述接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括: In this embodiment, the sample data category includes at least two different categories: a first sample category and a second sample category. The training of the determined machine learning model by receiving the sample data input by the user includes:

1)獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤。 1) Obtain the sample data of the positive sample and the sample data of the negative sample, and label the sample data of the positive sample with the sample category, so that the sample data of the positive sample can carry the sample category label.

例如,分別選取500個第一樣本類別、第二樣本類別對應的樣本資料,並對每個樣本資料標注類別,可以以“1”作為第一樣本類別的樣本資料標籤,以“2”作為第二樣本類別的樣本資料標籤。 For example, to select 500 sample data corresponding to the first sample category and the second sample category, and label each sample data with a category, "1" can be used as the sample data label of the first sample category, and "2" can be used as the sample data label of the first sample category. As the sample data label of the second sample category.

2)將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率。 2) randomly dividing the sample data of the positive sample and the sample data of the negative sample into a training set of a first preset ratio and a verification set of a second preset ratio, and using the training set to train the machine learning model, And use the verification set to verify the accuracy of the trained machine learning model.

先將不同樣本類別的訓練集中的訓練樣本分發到不同的資料夾裡。例如,將第一樣本類別的訓練樣本分發到第一資料夾裡、將第二樣本類別的訓練樣本分發到第二資料夾裡。然後從不同的資料夾裡分別提取第一預設比例(例 如,70%)的訓練樣本作為總的訓練樣本進行機器學習模型的訓練,從不同的資料夾裡分別取剩餘第二預設比例(例如,30%)的訓練樣本作為總的測試樣本對訓練完成的所述機器學習模型進行準確性驗證。 First distribute the training samples in the training set of different sample categories to different folders. For example, the training samples of the first sample category are distributed to the first folder, and the training samples of the second sample category are distributed to the second folder. Then extract the first preset ratio from different folders (for example For example, 70%) of the training samples are used as the total training samples to train the machine learning model, and the remaining second preset proportion (for example, 30%) of the training samples are taken from different folders as the total test samples for training. The completed machine learning model is verified for accuracy.

3)若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 3) If the accuracy rate is greater than or equal to the preset accuracy rate, end the training; if the accuracy rate is less than the preset accuracy rate, increase the number of positive samples and the number of negative samples to retrain the machine learning model until The accuracy rate is greater than or equal to a preset accuracy rate.

本實施方式中,所述機器學習模型包括多個卷積層、最大池採樣層、全連接層。其中,卷積層和最大池採樣層交替連接組成,用於對所述樣本資料進行特徵提取得到特徵向量。所述多個全連接層相互連接。多個所述最大池採樣層中的最後一個最大池採樣層與多個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 In this embodiment, the machine learning model includes multiple convolutional layers, max-pooling sampling layers, and fully-connected layers. Among them, the convolution layer and the maximum pool sampling layer are alternately connected, and are used for feature extraction of the sample data to obtain feature vectors. The plurality of fully connected layers are connected to each other. The last max-pool sampling layer in the multiple max-pool sampling layers is connected to the first fully-connected layer of the multiple fully-connected layers, and is used for inputting the feature vector obtained through feature extraction to the first fully-connected layer , the last fully connected layer of the multiple fully connected layers is a classifier, and the classifier is used to classify the feature vector to obtain a detection result.

在一實施方式中,所述接收使用者輸入的樣本資料對確定出的所述機器學習模型進行訓練包括:使用樣本資料(如圖像資料),以及與樣本資料對應的類別標籤建立訓練集;藉由機器學習模型的卷積層將訓練集中的樣本資料進行卷積運算和抽樣運算;將最後一個卷積層連接到一個或多個全連接層,其中全連接層被配置為將進行卷積和抽樣運算後提取到的樣本資料的特徵進行綜合並輸出訓練參數和特徵模型,其中,所述特徵模型為樣本資料的一個抽象特徵表達;判斷機器學習模型是否滿足收斂條件,即判斷特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤是否一致,其中,當特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤一致時確定機器學習模型滿足收斂條件,否則確定機器學習模型不滿足收斂條件;當特徵模型與預設的標準特徵模型相一致時則輸出特徵模型;及當特徵模型不滿足收斂條件時反向傳播調整機器學習模型的權矩陣。 In one embodiment, receiving the sample data input by the user to train the determined machine learning model includes: establishing a training set using sample data (such as image data) and class labels corresponding to the sample data; Perform convolution and sampling operations on the sample data in the training set through the convolutional layer of the machine learning model; connect the last convolutional layer to one or more fully connected layers, where the fully connected layer is configured to perform convolution and sampling operations The features of the sample data extracted after the operation are synthesized and the training parameters and the feature model are output, wherein the feature model is an abstract feature expression of the sample data; judging whether the machine learning model satisfies the convergence condition, that is, judging whether the feature model is consistent with the preset Whether the standard feature model of the sample data or the class label of the sample data are consistent, wherein, when the feature model is consistent with the preset standard feature model or the class label of the sample data, it is determined that the machine learning model satisfies the convergence condition, otherwise it is determined that the machine learning model The convergence condition is not satisfied; when the characteristic model is consistent with the preset standard characteristic model, the characteristic model is output; and when the characteristic model does not satisfy the convergence condition, the weight matrix of the machine learning model is adjusted by backpropagation.

本實施方式中,在機器學習模型的訓練過程中,若輸出的特徵模型與標準特徵模型之間存在誤差,則藉由反向傳播將誤差資訊沿原來的路徑反傳,從而修正各層(例如,卷積層和抽樣層)的訓練參數,訓練參數例如可以包括加權值和偏置,然後利用修正後的卷積層和抽樣層重新對訓練資料進行卷積運算和抽樣運算,直到特徵模型滿足結束條件為止。本實施方式中,在進行卷積運算時,可以對樣本資料應用多個特徵映射圖,從而獲取樣本資料的不同特徵,其中,每個特徵映射圖提取出樣本資料的一種特徵。本實施方式中,在進行抽樣運算時可以採用平均值合併、最大值合併、以及隨機合併等方法對訓練集中的資料進行處理。 In this embodiment, in the training process of the machine learning model, if there is an error between the output feature model and the standard feature model, the error information is transmitted back along the original path by backpropagation, so as to correct each layer (for example, The training parameters of the convolution layer and the sampling layer), for example, the training parameters can include weighting values and biases, and then use the revised convolution layer and the sampling layer to perform convolution and sampling operations on the training data again until the feature model satisfies the end condition. . In this embodiment, when performing the convolution operation, multiple feature maps can be applied to the sample data to obtain different features of the sample data, wherein each feature map extracts one feature of the sample data. In this embodiment, methods such as mean value combination, maximum value combination, and random combination can be used to process the data in the training set when performing the sampling operation.

步驟S14,分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示。 Step S14, analyzing the training results of the machine learning model obtained after the training is completed, and displaying the training results that meet the preset conditions.

本實施方式中,所述訓練結果為準確率、精確率或網路大小。與準確率、精確率或網路大小對應的預設條件分別為:準確率大於第一預設值(例如90%),精確率大於第二預設值(例如85%),機器學習模型的網路層數小於第三預設值(如100)。本實施方式中,當訓練完成後得到的機器學習模型的準確率大於第一預設值時將所述機器學習模型的準確率進行顯示,或當訓練完成後得到的機器學習模型的精確率大於第二預設值時將所述機器學習模型的精確率進行顯示,或當訓練完成後得到的機器學習模型的網路層數小於第三預設值時將所述機器學習模型的網路層數進行顯示。 In this embodiment, the training result is an accuracy rate, a precision rate, or a network size. The preset conditions corresponding to the accuracy rate, precision rate or network size are: the accuracy rate is greater than the first preset value (eg 90%), the accuracy rate is greater than the second preset value (eg 85%), the machine learning model The number of network layers is less than the third preset value (eg 100). In this embodiment, when the accuracy of the machine learning model obtained after training is greater than the first preset value, the accuracy of the machine learning model is displayed, or when the accuracy of the machine learning model obtained after training is greater than When the second preset value is used, the accuracy rate of the machine learning model is displayed, or when the number of network layers of the machine learning model obtained after training is less than the third preset value, the network layer of the machine learning model is displayed. number is displayed.

本實施方式中,所述機器學習模型的準確率根據公式A=(TP+TN)/(TP+FP+FN+TN)計算得到,其中,A為準確率,TP為被機器學習模型預測為正的正樣本數,FP為被機器學習模型預測為正的負樣本數,FN為被機器學習模型預測為負的正樣本數,TN為被機器學習模型預測為負的負樣本數。本實施方式中,所述機器學習模型的精確率根據公式P=TP/(TP+FP)計算得到。 In this embodiment, the accuracy of the machine learning model is calculated according to the formula A=(TP+TN)/(TP+FP+FN+TN), where A is the accuracy, and TP is predicted by the machine learning model as The number of positive positive samples, FP is the number of negative samples predicted as positive by the machine learning model, FN is the number of positive samples predicted as negative by the machine learning model, and TN is the number of negative samples predicted as negative by the machine learning model. In this embodiment, the accuracy of the machine learning model is calculated according to the formula P=TP/(TP+FP).

步驟S15,將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 In step S15, the machine learning model corresponding to the training result that meets the preset condition is provided to the user.

本實施方式中,所述方法還包括:在所述機器學習模型的訓練結果不符合預設條件時接收用戶對所述機器學習模型的參數進行修改的操作,並根據修改後的參數重新訓練所述機器學習模型。在具體實施方式中,提供參數設置介面(圖中未示),並藉由所述參數設置介面接收使用者對所述機器學習模型的參數進行修改的操作,並根據修改後的參數重新訓練所述機器學習模型。 In this embodiment, the method further includes: when the training result of the machine learning model does not meet the preset conditions, receiving an operation of modifying the parameters of the machine learning model by the user, and retraining the machine learning model according to the modified parameters. described machine learning model. In a specific embodiment, a parameter setting interface (not shown in the figure) is provided, and the user's operation of modifying the parameters of the machine learning model is received through the parameter setting interface, and the modified parameters are retrained. described machine learning model.

本實施方式中,所述方法還包括:接收使用者對類型與模型關係表60中的問題類型與機器學習模型的對應關係的修改操作,並按照所述修改操作設定所述問題類型與機器學習模型的對應關係。 In this embodiment, the method further includes: receiving a user's modification operation on the correspondence between the question type and the machine learning model in the type-model relationship table 60, and setting the question type and the machine learning model according to the modification operation Correspondence to the model.

本實施方式中,接收使用者選擇的待處理的問題類型,確定與問題類型相對應的機器學習模型,接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練,並將符合預設條件的訓練結果所對應的機器學習模型提供給使用者,從而使得使用者根據問題類型快速確定出對應的機器學習模型,簡化了選擇機器學習模型進行訓練的過程,並提高了機器學習模型的訓練效率。 In this embodiment, the problem type to be processed selected by the user is received, the machine learning model corresponding to the problem type is determined, the sample data input by the user is received to train the determined machine learning model, and the determined machine learning model will meet the preset conditions. The machine learning model corresponding to the training result is provided to the user, so that the user can quickly determine the corresponding machine learning model according to the type of problem, which simplifies the process of selecting a machine learning model for training and improves the training efficiency of the machine learning model. .

實施例2 Example 2

圖4為本發明一實施方式中機器學習模型訓練裝置40的結構圖。 FIG. 4 is a structural diagram of a machine learning model training apparatus 40 in an embodiment of the present invention.

在一些實施例中,所述機器學習模型訓練裝置40運行於電子設備中。所述機器學習模型訓練裝置40可以包括多個由程式碼段所組成的功能模組。所述機器學習模型訓練裝置40中的各個程式段的程式碼可以存儲於記憶體中,並由至少一個處理器所執行,以執行機器學習模型訓練的功能。 In some embodiments, the machine learning model training apparatus 40 runs in an electronic device. The machine learning model training apparatus 40 may include a plurality of functional modules composed of program code segments. The code of each program segment in the machine learning model training device 40 can be stored in the memory and executed by at least one processor to perform the function of machine learning model training.

本實施例中,所述機器學習模型訓練裝置40根據其所執行的功能,可以被劃分為多個功能模組。參閱圖4所示,所述機器學習模型訓練裝置40可以包括問題類型接收模組401、模型確定模組402、訓練模組403、顯示模組404、模型提供模組405及設置模組406。本發明所稱的模組是指一種能夠被至少一個 處理器所執行並且能夠完成固定功能的一系列電腦程式段,其存儲在記憶體中。所述在一些實施例中,關於各模組的功能將在後續的實施例中詳述。 In this embodiment, the machine learning model training apparatus 40 can be divided into a plurality of functional modules according to the functions performed by the machine learning model training apparatus 40 . Referring to FIG. 4 , the machine learning model training apparatus 40 may include a question type receiving module 401 , a model determining module 402 , a training module 403 , a display module 404 , a model providing module 405 and a setting module 406 . The module referred to in the present invention refers to a module that can be used by at least one A series of computer program segments executed by a processor and capable of performing fixed functions, which are stored in memory. In some embodiments, the functions of each module will be described in detail in subsequent embodiments.

所述問題類型接收模組401接收使用者選擇的待處理的問題類型。 The question type receiving module 401 receives the question type to be processed selected by the user.

本實施方式中,所述問題類型為藉由機器學習模型所能解決的問題所對應的類型。具體的,所述問題類型包括圖像中的物件分類、圖像的分割及圖像中的物件檢測。 In this embodiment, the problem type is the type corresponding to the problem that can be solved by the machine learning model. Specifically, the problem types include object classification in images, segmentation of images, and object detection in images.

本實施方式中,所述問題類型接收模組401接收使用者選擇待處理的問題類型包括:藉由問題類型選擇介面50接收使用者選擇的待處理的問題類型。所述問題類型選擇介面50包括第一類型選項51、第二類型選項52及第三類型選項53。其中,第一類型選項51用於供使用者選擇圖像中的物件分類,第二類型選項52用於供使用者選擇圖像的分割,第三類型選項53用於供使用者選擇圖像中的物件檢測。也即,當使用者選擇第一類型選項51時,所述問題類型選擇介面50接收使用者選擇的圖像中的物件分類作為問題類型;當使用者選擇第二類型選項52時,所述問題類型選擇介面50接收使用者選擇的圖像的分割作為問題類型;當使用者選擇第三類型選項53時,所述問題類型選擇介面50接收使用者選擇的圖像中的物件檢測作為問題類型。 In this embodiment, the question type receiving module 401 receiving the question type selected by the user to be handled includes: receiving the question type to be handled selected by the user through the question type selection interface 50 . The question type selection interface 50 includes a first type option 51 , a second type option 52 and a third type option 53 . Among them, the first type option 51 is used for the user to select the object classification in the image, the second type option 52 is used for the user to select the segmentation of the image, and the third type option 53 is used for the user to select the image in the image. object detection. That is, when the user selects the first type option 51, the question type selection interface 50 receives the object classification in the image selected by the user as the question type; when the user selects the second type option 52, the question type The type selection interface 50 receives the segmentation of the image selected by the user as the question type; when the user selects the third type option 53 , the question type selection interface 50 receives the object detection in the image selected by the user as the question type.

所述模型確定模組402確定與所述問題類型相對應的機器學習模型。 The model determination module 402 determines a machine learning model corresponding to the problem type.

本實施方式中,所述模型確定模組402確定與問題類型相對應的機器學習模型包括:藉由所確定的問題類型查找類型與模型關係表60確定出與所述問題類型對應的機器學習模型,其中所述類型與模型關係表60定義了多個問題類型與多個機器學習模型的對應關係。所述類型與模型關係表60定義問題類型為圖像中的物件分類與機器學習模型為第一模型的對應關係,其中,第一模型可以為圖像的物件分類模型;定義問題類型為圖像的分割與機器學習模型為第二模型的對應關係,其中,第二模型可以為圖像的分割模型;定義問 題類型為圖像中的物件檢測與機器學習模型為第三模型的對應關係,其中,第三模型可以為圖像中的物件檢測模型。本實施方式中,所述第一模型、第二模型、第三模型為隨機森林、SVM、樸素貝葉斯、knn、gbdt、xgboost、LR中的至少一種模型。 In this embodiment, the model determining module 402 determines the machine learning model corresponding to the problem type includes: searching the type-model relationship table 60 by using the determined problem type to determine the machine learning model corresponding to the problem type , wherein the type-model relationship table 60 defines the corresponding relationship between multiple problem types and multiple machine learning models. The type and model relationship table 60 defines the problem type as the correspondence between the object classification in the image and the machine learning model as the first model, wherein the first model can be an image object classification model; define the problem type as an image The corresponding relationship between the segmentation and the machine learning model is the second model, wherein the second model can be the segmentation model of the image; define the question The question type is the correspondence between the object detection in the image and the machine learning model being the third model, where the third model may be the object detection model in the image. In this embodiment, the first model, the second model, and the third model are at least one model among random forest, SVM, Naive Bayes, knn, gbdt, xgboost, and LR.

在另一實施方式中,所述模型確定模組402確定與問題類型相對應的機器學習模型包括:接收使用者輸入的機器學習模型,並將接收的機器學習模型確定為與所述問題類型相對應的機器學習模型。本實施方式中,將使用者輸入的機器學習模型確定為與所述問題類型相對應的機器學習模型可以使專業的研發人員可根據自己的計畫增加更多的機器學習模型進行樣本訓練。 In another embodiment, the model determining module 402 determining the machine learning model corresponding to the question type includes: receiving the machine learning model input by the user, and determining the received machine learning model as corresponding to the question type The corresponding machine learning model. In this embodiment, the machine learning model input by the user is determined as the machine learning model corresponding to the problem type, so that professional R&D personnel can add more machine learning models for sample training according to their own plans.

所述訓練模組403接收使用者輸入的樣本資料對確定出的所述機器學習模型進行訓練。 The training module 403 receives the sample data input by the user to train the determined machine learning model.

本實施方式中,所述樣本資料類別至少包括第一樣本類別及第二樣本類別兩個不同的類別。所述訓練模組403接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括: In this embodiment, the sample data category includes at least two different categories: a first sample category and a second sample category. The training module 403 receives the sample data input by the user to train the determined machine learning model, including:

1)獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤。 1) Obtain the sample data of the positive sample and the sample data of the negative sample, and label the sample data of the positive sample with the sample category, so that the sample data of the positive sample can carry the sample category label.

例如,分別選取500個第一樣本類別、第二樣本類別對應的樣本資料,並對每個樣本資料標注類別,可以以“1”作為第一樣本類別的樣本資料標籤,以“2”作為第二樣本類別的樣本資料標籤。 For example, to select 500 sample data corresponding to the first sample category and the second sample category, and label each sample data with a category, "1" can be used as the sample data label of the first sample category, and "2" can be used as the sample data label of the first sample category. As the sample data label of the second sample category.

2)將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率。 2) randomly dividing the sample data of the positive sample and the sample data of the negative sample into a training set of a first preset ratio and a verification set of a second preset ratio, and using the training set to train the machine learning model, And use the verification set to verify the accuracy of the trained machine learning model.

先將不同樣本類別的訓練集中的訓練樣本分發到不同的資料夾裡。例如,將第一樣本類別的訓練樣本分發到第一資料夾裡、將第二樣本類別的訓練樣本分發到第二資料夾裡。然後從不同的資料夾裡分別提取第一預設比例(例如,70%)的訓練樣本作為總的訓練樣本進行機器學習模型的訓練,從不同的 資料夾裡分別取剩餘第二預設比例(例如,30%)的訓練樣本作為總的測試樣本對訓練完成的所述機器學習模型進行準確性驗證。 First distribute the training samples in the training set of different sample categories to different folders. For example, the training samples of the first sample category are distributed to the first folder, and the training samples of the second sample category are distributed to the second folder. Then, the training samples of the first preset proportion (for example, 70%) are respectively extracted from different folders as the total training samples to train the machine learning model. The remaining second preset proportion (for example, 30%) of the training samples in the data folder are respectively taken as the total test samples to verify the accuracy of the trained machine learning model.

3)若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 3) If the accuracy rate is greater than or equal to the preset accuracy rate, end the training; if the accuracy rate is less than the preset accuracy rate, increase the number of positive samples and the number of negative samples to retrain the machine learning model until The accuracy rate is greater than or equal to a preset accuracy rate.

本實施方式中,所述機器學習模型包括多個卷積層、最大池採樣層、全連接層。其中,卷積層和最大池採樣層交替連接組成,用於對所述樣本資料進行特徵提取得到特徵向量。所述多個全連接層相互連接。多個所述最大池採樣層中的最後一個最大池採樣層與多個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 In this embodiment, the machine learning model includes multiple convolutional layers, max-pooling sampling layers, and fully-connected layers. Among them, the convolution layer and the maximum pool sampling layer are alternately connected, and are used for feature extraction of the sample data to obtain feature vectors. The plurality of fully connected layers are connected to each other. The last max-pool sampling layer in the multiple max-pool sampling layers is connected to the first fully-connected layer of the multiple fully-connected layers, and is used for inputting the feature vector obtained through feature extraction to the first fully-connected layer , the last fully connected layer of the multiple fully connected layers is a classifier, and the classifier is used to classify the feature vector to obtain a detection result.

在一實施方式中,所述訓練模組403使用樣本資料(如圖像資料),以及與樣本資料對應的類別標籤建立訓練集;藉由機器學習模型的卷積層將訓練集中的樣本資料進行卷積運算和抽樣運算;將最後一個卷積層連接到一個或多個全連接層,其中全連接層被配置為將進行卷積和抽樣運算後提取到的樣本資料的特徵進行綜合並輸出訓練參數和特徵模型,其中,所述特徵模型為樣本資料的一個抽象特徵表達;判斷機器學習模型是否滿足收斂條件,即判斷特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤是否一致,其中,當特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤一致時確定機器學習模型滿足收斂條件,否則確定機器學習模型不滿足收斂條件;當特徵模型與預設的標準特徵模型相一致時則輸出特徵模型;及當特徵模型不滿足收斂條件時反向傳播調整機器學習模型的權矩陣。 In one embodiment, the training module 403 uses sample data (such as image data) and class labels corresponding to the sample data to create a training set; the sample data in the training set is rolled through the convolution layer of the machine learning model. Product operation and sampling operation; connect the last convolutional layer to one or more fully connected layers, where the fully connected layer is configured to synthesize the features of the sample data extracted after the convolution and sampling operations and output the training parameters and feature model, wherein the feature model is an abstract feature expression of the sample data; judging whether the machine learning model satisfies the convergence condition, that is, judging whether the feature model is consistent with the preset standard feature model or the category label of the sample data, wherein , when the feature model is consistent with the preset standard feature model or the category label of the sample data, it is determined that the machine learning model satisfies the convergence condition, otherwise it is determined that the machine learning model does not meet the convergence condition; when the feature model is consistent with the preset standard feature model When they are consistent, the feature model is output; and when the feature model does not meet the convergence condition, the weight matrix of the machine learning model is adjusted by backpropagation.

本實施方式中,在機器學習模型的訓練過程中,若輸出的特徵模型與標準特徵模型之間存在誤差,則所述訓練模組403藉由反向傳播將誤差資訊沿原來的路徑反傳,從而修正各層(例如,卷積層和抽樣層)的訓練參數,訓 練參數例如可以包括加權值和偏置,然後利用修正後的卷積層和抽樣層重新對訓練資料進行卷積運算和抽樣運算,直到特徵模型滿足結束條件為止。本實施方式中,在進行卷積運算時,可以對樣本資料應用多個特徵映射圖,從而獲取樣本資料的不同特徵,其中,每個特徵映射圖提取出樣本資料的一種特徵。本實施方式中,在進行抽樣運算時可以採用平均值合併、最大值合併、以及隨機合併等方法對訓練集中的資料進行處理。 In this embodiment, in the training process of the machine learning model, if there is an error between the output feature model and the standard feature model, the training module 403 backpropagates the error information along the original path by backpropagation, Thus, the training parameters of each layer (for example, the convolutional layer and the sampling layer) are modified, and the training The training parameters may include, for example, weighted values and biases, and then the training data are re-convolutional and sampled by using the revised convolutional layer and sampling layer until the feature model satisfies the end condition. In this embodiment, when performing the convolution operation, multiple feature maps can be applied to the sample data to obtain different features of the sample data, wherein each feature map extracts one feature of the sample data. In this embodiment, methods such as mean value combination, maximum value combination, and random combination can be used to process the data in the training set when performing the sampling operation.

所述顯示模組404分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示。 The display module 404 analyzes the training results of the machine learning model obtained after the training is completed, and displays the training results that meet the preset conditions.

本實施方式中,所述訓練結果為準確率、精確率或網路大小。與準確率、精確率或網路大小對應的預設條件分別為:準確率大於第一預設值(例如90%),精確率大於第二預設值(例如85%),機器學習模型的網路層數小於第三預設值(如100)。本實施方式中,所述顯示模組404當訓練完成後得到的機器學習模型的準確率大於第一預設值時將所述機器學習模型的準確率進行顯示,或當訓練完成後得到的機器學習模型的精確率大於第二預設值時將所述機器學習模型的精確率進行顯示,或當訓練完成後得到的機器學習模型的網路層數小於第三預設值時將所述機器學習模型的網路層數進行顯示。 In this embodiment, the training result is an accuracy rate, a precision rate, or a network size. The preset conditions corresponding to the accuracy rate, precision rate or network size are: the accuracy rate is greater than the first preset value (eg 90%), the accuracy rate is greater than the second preset value (eg 85%), the machine learning model The number of network layers is less than the third preset value (eg 100). In this embodiment, the display module 404 displays the accuracy of the machine learning model when the accuracy of the machine learning model obtained after the training is greater than the first preset value, or when the accuracy of the machine learning model obtained after the training is completed is displayed. When the accuracy rate of the learning model is greater than the second preset value, the accuracy rate of the machine learning model is displayed, or when the number of network layers of the machine learning model obtained after training is less than the third preset value, the machine learning model is displayed. The number of network layers of the learning model is displayed.

本實施方式中,所述機器學習模型的準確率根據公式A=(TP+TN)/(TP+FP+FN+TN)計算得到,其中,A為準確率,TP為被機器學習模型預測為正的正樣本數,FP為被機器學習模型預測為正的負樣本數,FN為被機器學習模型預測為負的正樣本數,TN為被機器學習模型預測為負的負樣本數。本實施方式中,所述機器學習模型的精確率根據公式P=TP/(TP+FP)計算得到。 In this embodiment, the accuracy of the machine learning model is calculated according to the formula A=(TP+TN)/(TP+FP+FN+TN), where A is the accuracy, and TP is predicted by the machine learning model as The number of positive positive samples, FP is the number of negative samples predicted as positive by the machine learning model, FN is the number of positive samples predicted as negative by the machine learning model, and TN is the number of negative samples predicted as negative by the machine learning model. In this embodiment, the accuracy of the machine learning model is calculated according to the formula P=TP/(TP+FP).

所述模型提供模組405將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 The model providing module 405 provides the user with the machine learning model corresponding to the training result that meets the preset condition.

本實施方式中,所述訓練模組403還用於:在所述機器學習模型的訓練結果不符合預設條件時接收用戶對所述機器學習模型的參數進行修改 的操作,並根據修改後的參數重新訓練所述機器學習模型。在具體實施方式中,提供參數設置介面(圖中未示),並藉由所述參數設置介面接收使用者對所述機器學習模型的參數進行修改的操作,並根據修改後的參數重新訓練所述機器學習模型。 In this embodiment, the training module 403 is further configured to receive the user to modify the parameters of the machine learning model when the training result of the machine learning model does not meet the preset conditions operation, and retrain the machine learning model according to the modified parameters. In a specific embodiment, a parameter setting interface (not shown in the figure) is provided, and the user's operation of modifying the parameters of the machine learning model is received through the parameter setting interface, and the modified parameters are retrained. described machine learning model.

本實施方式中,所述設置模組406用於:接收使用者對類型與模型關係表60中的問題類型與機器學習模型的對應關係的修改操作,並按照所述修改操作設定所述問題類型與機器學習模型的對應關係。 In this embodiment, the setting module 406 is configured to: receive a user's modification operation on the correspondence between the question type and the machine learning model in the type-model relationship table 60, and set the question type according to the modification operation Correspondence with machine learning models.

本實施方式中,接收使用者選擇的待處理的問題類型,確定與問題類型相對應的機器學習模型,接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練,並將符合預設條件的訓練結果所對應的機器學習模型提供給使用者,從而使得使用者根據問題類型快速確定出對應的機器學習模型,簡化了選擇機器學習模型進行訓練的過程,並提高了機器學習模型的訓練效率。 In this embodiment, the problem type to be processed selected by the user is received, the machine learning model corresponding to the problem type is determined, the sample data input by the user is received to train the determined machine learning model, and the determined machine learning model will meet the preset conditions. The machine learning model corresponding to the training result is provided to the user, so that the user can quickly determine the corresponding machine learning model according to the type of problem, which simplifies the process of selecting a machine learning model for training and improves the training efficiency of the machine learning model. .

實施例3 Example 3

圖5為本發明一實施方式中電子設備6的示意圖。 FIG. 5 is a schematic diagram of an electronic device 6 in an embodiment of the present invention.

所述電子設備6包括記憶體61、處理器62以及存儲在所述記憶體61中並可在所述處理器62上運行的電腦程式63。所述處理器62執行所述電腦程式63時實現上述機器學習模型訓練方法實施例中的步驟,例如圖1所示的步驟S11~S15。或者,所述處理器62執行所述電腦程式63時實現上述機器學習模型訓練裝置實施例中各模組/單元的功能,例如圖4中的模組401~406。 The electronic device 6 includes a memory 61 , a processor 62 and a computer program 63 stored in the memory 61 and executable on the processor 62 . When the processor 62 executes the computer program 63 , the steps in the above-mentioned embodiment of the machine learning model training method are implemented, for example, steps S11 to S15 shown in FIG. 1 . Alternatively, when the processor 62 executes the computer program 63 , the functions of each module/unit in the above-mentioned embodiment of the machine learning model training apparatus, such as modules 401 to 406 in FIG. 4 , are realized.

示例性的,所述電腦程式63可以被分割成一個或多個模組/單元,所述一個或者多個模組/單元被存儲在所述記憶體61中,並由所述處理器62執行,以完成本發明。所述一個或多個模組/單元可以是能夠完成特定功能的一系列電腦程式指令段,所述指令段用於描述所述電腦程式63在所述電子設備6中的執行過程。例如,所述電腦程式63可以被分割成圖6中的問題類型接收模組401、模型確定模組402、訓練模組403、顯示模組404、模型提供模組405及設置模組406,各模組具體功能參見實施例2。 Exemplarily, the computer program 63 can be divided into one or more modules/units, and the one or more modules/units are stored in the memory 61 and executed by the processor 62 , to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 63 in the electronic device 6 . For example, the computer program 63 can be divided into the question type receiving module 401, the model determining module 402, the training module 403, the display module 404, the model providing module 405 and the setting module 406 in FIG. For the specific functions of the module, see Embodiment 2.

本實施方式中,所述電子設備6還可以是桌上型電腦、筆記本、掌上型電腦及雲端終端裝置等計算設備。本領域技術人員可以理解,所述示意圖僅僅是電子設備6的示例,並不構成對電子設備6的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電子設備6還可以包括輸入輸出設備、網路接入設備、匯流排等。 In this embodiment, the electronic device 6 may also be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud terminal device. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 6, and does not constitute a limitation to the electronic device 6, and may include more or less components than the one shown, or combine some components, or different Components such as the electronic device 6 may also include input and output devices, network access devices, bus bars, and the like.

所稱處理器62可以是中央處理模組(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器62也可以是任何常規的處理器等,所述處理器62是所述電子設備6的控制中心,利用各種介面和線路連接整個電子設備6的各個部分。 The processor 62 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs) ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor 62 can also be any conventional processor, etc. The processor 62 is the control center of the electronic device 6, and uses various interfaces and lines to connect the entire electronic device 6. various parts.

所述記憶體61可用於存儲所述電腦程式63和/或模組/單元,所述處理器62藉由運行或執行存儲在所述記憶體61內的電腦程式和/或模組/單元,以及調用存儲在記憶體61內的資料,實現所述電子設備6的各種功能。所述記憶體61可主要包括存儲程式區和存儲資料區,其中,存儲程式區可存儲作業系統、至少一個功能所需的應用程式(比如聲音播放功能、圖像播放功能等)等;存儲資料區可存儲根據電子設備6的使用所創建的資料(比如音訊資料、電話本等)等。此外,記憶體61可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。 The memory 61 can be used to store the computer programs 63 and/or modules/units, and the processor 62 runs or executes the computer programs and/or modules/units stored in the memory 61, And call the data stored in the memory 61 to realize various functions of the electronic device 6 . The memory 61 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; storage data The area may store data (such as audio data, phone book, etc.) created according to the use of the electronic device 6, and the like. In addition, the memory 61 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (Secure Digital, SD) card, flash memory card (Flash Card), at least one disk memory device, flash memory device, or other volatile solid state memory device.

所述電子設備6集成的模組/單元如果以軟體功能模組的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本發明實現上述實施例方法中的全部或部分流程,也可以藉由電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於一電腦可讀存儲 介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、U盤、移動硬碟、磁碟、光碟、電腦記憶體、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、電載波信號、電信信號以及軟體分發介質等。需要說明的是,所述電腦可讀介質包含的內容可以根據司法管轄區內立法和專利實踐的要求進行適當的增減,例如在某些司法管轄區,根據立法和專利實踐,電腦可讀介質不包括電載波信號和電信信號。 If the modules/units integrated in the electronic device 6 are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage In the medium, when the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of original code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-only memory) Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium Electric carrier signals and telecommunication signals are not included.

在本發明所提供的幾個實施例中,應該理解到,所揭露的電子設備和方法,可以藉由其它的方式實現。例如,以上所描述的電子設備實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 In the several embodiments provided by the present invention, it should be understood that the disclosed electronic devices and methods may be implemented in other manners. For example, the above-described electronic device embodiments are only illustrative. For example, the division of the modules is only a logical function division, and other division methods may be used in actual implementation.

另外,在本發明各個實施例中的各功能模組可以集成在相同處理模組中,也可以是各個模組單獨物理存在,也可以兩個或兩個以上模組集成在相同模組中。上述集成的模組既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 In addition, each functional module in each embodiment of the present invention may be integrated in the same processing module, or each module may exist physically alone, or two or more modules may be integrated in the same module. The above-mentioned integrated modules can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.

對於本領域技術人員而言,顯然本發明不限於上述示範性實施例的細節,而且在不背離本發明的精神或基本特徵的情況下,能夠以其他的具體形式實現本發明。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本發明的範圍由所附權利要求而不是上述說明限定,因此旨在將落在權利要求的等同要件的含義和範圍內的所有變化涵括在本發明內。不應將權利要求中的任何附圖標記視為限制所涉及的權利要求。此外,顯然“包括”一詞不排除其他模組或步驟,單數不排除複數。電子設備權利要求中陳述的多個模組或電子設備也可以由同一個模組或電子設備藉由軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定的順序。 It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the invention is to be defined by the appended claims rather than the foregoing description, which are therefore intended to fall within the scope of the claims. All changes within the meaning and range of the equivalents of , are included in the present invention. Any reference signs in the claims shall not be construed as limiting the involved claim. Furthermore, it is clear that the word "comprising" does not exclude other modules or steps, and the singular does not exclude the plural. A plurality of modules or electronic devices recited in the electronic device claims can also be realized by one and the same module or electronic device by means of software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.

綜上所述,本發明符合發明專利要件,爰依法提出專利申請。惟,以上所述僅為本發明之較佳實施方式,舉凡熟悉本案技藝之人士,在援依本案創作精神所作之等效修飾或變化,皆應包含於以下之申請專利範圍內。 To sum up, the present invention complies with the requirements of an invention patent, and a patent application can be filed in accordance with the law. However, the above descriptions are only the preferred embodiments of the present invention, and for those who are familiar with the techniques of this case, equivalent modifications or changes made in accordance with the creative spirit of this case shall be included in the scope of the following patent application.

S11~S15:步驟 S11~S15: Steps

Claims (10)

一種機器學習模型訓練方法,其改良在於,所述方法包括:接收用戶選擇的待處理的問題類型;確定與所述問題類型相對應的機器學習模型;接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練;分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示,其中,所述訓練結果包括準確率,所述預設條件為所述準確率大於第一預設值,所述準確率根據公式A=(TP+TN)/(TP+FP+FN+TN)計算得到,其中,A為準確率,TP為被機器學習模型預測為正的正樣本數,FP為被機器學習模型預測為正的負樣本數,FN為被機器學習模型預測為負的正樣本數,TN為被機器學習模型預測為負的負樣本數;及將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 A machine learning model training method, which is improved in that the method comprises: receiving a question type to be processed selected by a user; determining a machine learning model corresponding to the question type; The machine learning model is trained; the training results of the machine learning model obtained after training are analyzed, and the training results that meet the preset conditions are displayed, wherein the training results include the accuracy rate, and the preset conditions are the The accuracy rate is greater than the first preset value, and the accuracy rate is calculated according to the formula A=(TP+TN)/(TP+FP+FN+TN), where A is the accuracy rate, and TP is predicted by the machine learning model as The number of positive positive samples, FP is the number of negative samples predicted as positive by the machine learning model, FN is the number of positive samples predicted as negative by the machine learning model, TN is the number of negative samples predicted as negative by the machine learning model; and The machine learning model corresponding to the training result that meets the preset conditions is provided to the user. 如請求項1所述的機器學習模型訓練方法,其中,所述確定與問題類型相對應的機器學習模型包括:藉由所確定的問題類型查找類型與模型關係表確定出與所述問題類型對應的機器學習模型,其中所述類型與模型關係表定義了多個問題類型與多個機器學習模型的對應關係。 The method for training a machine learning model according to claim 1, wherein the determining the machine learning model corresponding to the problem type comprises: searching a type-model relationship table by using the determined problem type to determine the problem type corresponding to the problem type The machine learning model, wherein the type and model relationship table defines the corresponding relationship between multiple problem types and multiple machine learning models. 如請求項1所述的機器學習模型訓練方法,其中,所述樣本資料類別至少包括第一樣本類別及第二樣本類別,所述接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括:獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤;將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率;及 若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 The method for training a machine learning model according to claim 1, wherein the sample data categories include at least a first sample category and a second sample category, and the sample data received by the user is used to perform a training procedure on the determined machine learning model. The training includes: obtaining the sample data of the positive samples and the sample data of the negative samples, and labeling the sample data of the positive samples with the sample category, so that the sample data of the positive samples carry the sample category labels; The sample data of the negative samples are randomly divided into a training set of a first preset ratio and a verification set of a second preset ratio, use the training set to train the machine learning model, and use the verification set to verify the trained machine the accuracy of the learned model; and If the accuracy rate is greater than or equal to the preset accuracy rate, end the training; if the accuracy rate is less than the preset accuracy rate, increase the number of positive samples and the number of negative samples to retrain the machine learning model until the The accuracy rate is greater than or equal to the preset accuracy rate. 如請求項1所述的機器學習模型訓練方法,其中,所述訓練結果為準確率、精確率或網路大小,與所述準確率對應的預設條件為所述準確率大於第一預設值,與所述精確率對應的預設條件為所述精確率大於第二預設值,與所述網路大小對應的預設條件為所述機器學習模型的網路層數小於第三預設值。 The machine learning model training method according to claim 1, wherein the training result is an accuracy rate, a precision rate or a network size, and a preset condition corresponding to the accuracy rate is that the accuracy rate is greater than a first preset The preset condition corresponding to the accuracy rate is that the accuracy rate is greater than the second preset value, and the preset condition corresponding to the network size is that the number of network layers of the machine learning model is less than the third preset value. set value. 如請求項1所述的機器學習模型訓練方法,其中,所述機器學習模型包括多個卷積層、多個最大池採樣層、全連接層,其中,所述多個卷積層和所述多個最大池採樣層交替連接組成,所述多個最大池採樣層用於對所述樣本資料進行特徵提取得到特徵向量,所述多個全連接層相互連接,所述多個最大池採樣層中的最後一個最大池採樣層與多個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 The machine learning model training method according to claim 1, wherein the machine learning model includes multiple convolutional layers, multiple max-pooling sampling layers, and fully connected layers, wherein the multiple convolutional layers and the multiple The max-pool sampling layers are alternately connected, the multiple max-pool sampling layers are used to perform feature extraction on the sample data to obtain feature vectors, the multiple fully-connected layers are connected to each other, and the multiple max-pool sampling layers are The last max-pool sampling layer is connected to the first fully-connected layers of the multiple fully-connected layers, and is used to input the feature vector obtained through feature extraction to the first fully-connected layer. The last fully connected layer is a classifier, and the classifier is used to classify the feature vector to obtain the detection result. 如請求項5所述的機器學習模型訓練方法,其中,所述接收使用者輸入的樣本資料對確定出的所述機器學習模型進行訓練包括:使用樣本資料以及與樣本資料對應的類別標籤建立訓練集;藉由所述機器學習模型的卷積層將所述訓練集中的樣本資料進行卷積運算和抽樣運算;將所述機器學習模型的最後一個卷積層連接到一個或多個全連接層,其中全連接層被配置為將進行卷積和抽樣運算後提取到的樣本資料的特徵進行綜合並輸出訓練參數和特徵模型;判斷機器學習模型是否滿足收斂條件,其中,當特徵模型與預設的標準特徵模型或所述樣本資料的類別標籤一致時確定機器學習模型滿足收斂條件,否則確定機器學習模型不滿足收斂條件;當特徵模型與預設 的標準特徵模型相一致時則輸出特徵模型;及當特徵模型不滿足收斂條件時反向傳播調整所述機器學習模型的權矩陣。 The method for training a machine learning model according to claim 5, wherein the receiving the sample data input by the user to train the determined machine learning model comprises: using the sample data and the class labels corresponding to the sample data to establish training Convolution operation and sampling operation are performed on the sample data in the training set by the convolution layer of the machine learning model; the last convolution layer of the machine learning model is connected to one or more fully connected layers, wherein The fully connected layer is configured to synthesize the features of the sample data extracted after the convolution and sampling operations, and output the training parameters and the feature model; to determine whether the machine learning model satisfies the convergence condition, wherein, when the feature model matches the preset standard When the feature model or the category label of the sample data is consistent, it is determined that the machine learning model satisfies the convergence conditions, otherwise it is determined that the machine learning model does not meet the convergence conditions; when the feature model and the preset When the standard feature model of the machine learning model is consistent, the feature model is output; and when the feature model does not meet the convergence condition, the weight matrix of the machine learning model is adjusted by backpropagation. 一種機器學習模型訓練裝置,其改良在於,所述裝置包括:問題類型接收模組,用於接收使用者選擇的待處理的問題類型;模型確定模組,用於確定與所述問題類型相對應的機器學習模型;訓練模組,用於接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練;顯示模組,用於分析訓練完成後得到的所述機器學習模型的訓練結果,將符合預設條件的訓練結果進行顯示,其中,所述訓練結果包括準確率,所述預設條件為所述準確率大於第一預設值,所述準確率根據公式A=(TP+TN)/(TP+FP+FN+TN)計算得到,其中,A為準確率,TP為被機器學習模型預測為正的正樣本數,FP為被機器學習模型預測為正的負樣本數,FN為被機器學習模型預測為負的正樣本數,TN為被機器學習模型預測為負的負樣本數;及模型提供模組,用於將符合預設條件的訓練結果所對應的機器學習模型提供給使用者。 A machine learning model training device, which is improved in that the device comprises: a question type receiving module for receiving a question type to be processed selected by a user; a model determining module for determining a question type corresponding to the question type The training module is used to receive the sample data input by the user to train the determined machine learning model; the display module is used to analyze the training results of the machine learning model obtained after the training is completed, and The training results that meet the preset conditions are displayed, wherein the training results include the accuracy rate, the preset condition is that the accuracy rate is greater than the first preset value, and the accuracy rate is based on the formula A=(TP+TN) /(TP+FP+FN+TN), where A is the accuracy rate, TP is the number of positive samples predicted as positive by the machine learning model, FP is the number of negative samples predicted as positive by the machine learning model, and FN is The number of positive samples predicted to be negative by the machine learning model, TN is the number of negative samples predicted to be negative by the machine learning model; and the model providing module is used to provide the machine learning model corresponding to the training results that meet the preset conditions to the user. 如請求項7所述的機器學習模型訓練裝置,其中,所述樣本資料類別至少包括第一樣本類別及第二樣本類別,所述接收使用者輸入的樣本資料對確定出的機器學習模型進行訓練包括:獲取正樣本的樣本資料及負樣本的樣本資料,並將正樣本的樣本資料標注樣本類別,以使正樣本的樣本資料攜帶樣本類別標籤;將所述正樣本的樣本資料及所述負樣本的樣本資料隨機分成第一預設比例的訓練集和第二預設比例的驗證集,利用所述訓練集訓練所述機器學習模型,並利用所述驗證集驗證訓練後的所述機器學習模型的準確率;及 若所述準確率大於或者等於預設準確率時,則結束訓練;若所述準確率小於預設準確率時,則增加正樣本數量及負樣本數量以重新訓練所述機器學習模型直至所述準確率大於或者等於預設準確率。 The machine learning model training device according to claim 7, wherein the sample data categories include at least a first sample category and a second sample category, and the sample data inputted by the user is used to perform training on the determined machine learning model. The training includes: obtaining the sample data of the positive samples and the sample data of the negative samples, and labeling the sample data of the positive samples with the sample category, so that the sample data of the positive samples carry the sample category labels; The sample data of the negative samples are randomly divided into a training set of a first preset ratio and a verification set of a second preset ratio, use the training set to train the machine learning model, and use the verification set to verify the trained machine the accuracy of the learned model; and If the accuracy rate is greater than or equal to the preset accuracy rate, end the training; if the accuracy rate is less than the preset accuracy rate, increase the number of positive samples and the number of negative samples to retrain the machine learning model until the The accuracy rate is greater than or equal to the preset accuracy rate. 如請求項7所述的機器學習模型訓練裝置,其中,所述機器學習模型包括多個卷積層、多個最大池採樣層、全連接層,其中,所述多個卷積層和所述多個最大池採樣層交替連接組成,所述多個最大池採樣層用於對所述樣本資料進行特徵提取得到特徵向量,所述多個全連接層相互連接,所述多個最大池採樣層中的最後一個最大池採樣層與多個所述全連接層的第一全連接層連接,用於向所述第一全連接層輸入經過特徵提取得到的特徵向量,多個所述全連接層中的最後一個全連接層為一個分類器,所述分類器用於對所述特徵向量進行分類得到檢測結果。 The apparatus for training a machine learning model according to claim 7, wherein the machine learning model comprises multiple convolutional layers, multiple max-pooling sampling layers, and fully connected layers, wherein the multiple convolutional layers and the multiple The max-pool sampling layers are alternately connected, the multiple max-pool sampling layers are used to perform feature extraction on the sample data to obtain feature vectors, the multiple fully-connected layers are connected to each other, and the multiple max-pool sampling layers are The last max-pool sampling layer is connected to the first fully-connected layers of the multiple fully-connected layers, and is used to input the feature vector obtained through feature extraction to the first fully-connected layer. The last fully connected layer is a classifier, and the classifier is used to classify the feature vector to obtain the detection result. 一種電子設備,其改良在於,所述電子設備包括處理器及記憶體,所述處理器用於執行所述記憶體中存儲的電腦程式時實現如請求項1至6中任一項所述的機器學習模型訓練方法。 An electronic device, which is improved in that the electronic device includes a processor and a memory, and the processor is used to implement the machine according to any one of claims 1 to 6 when executing a computer program stored in the memory Learn about model training methods.
TW109116326A 2020-05-15 2020-05-15 Training method, device for machine learning model and electronic device TWI765266B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109116326A TWI765266B (en) 2020-05-15 2020-05-15 Training method, device for machine learning model and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109116326A TWI765266B (en) 2020-05-15 2020-05-15 Training method, device for machine learning model and electronic device

Publications (2)

Publication Number Publication Date
TW202145084A TW202145084A (en) 2021-12-01
TWI765266B true TWI765266B (en) 2022-05-21

Family

ID=80783902

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109116326A TWI765266B (en) 2020-05-15 2020-05-15 Training method, device for machine learning model and electronic device

Country Status (1)

Country Link
TW (1) TWI765266B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW202001696A (en) * 2018-06-29 2020-01-01 由田新技股份有限公司 Defect inspection and classification apparatus and training apparatus using deep learning system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW202001696A (en) * 2018-06-29 2020-01-01 由田新技股份有限公司 Defect inspection and classification apparatus and training apparatus using deep learning system

Also Published As

Publication number Publication date
TW202145084A (en) 2021-12-01

Similar Documents

Publication Publication Date Title
CN112346567B (en) Virtual interaction model generation method and device based on AI (Artificial Intelligence) and computer equipment
CN109345553B (en) Palm and key point detection method and device thereof, and terminal equipment
WO2021151296A1 (en) Multi-task classification method and apparatus, computer device, and storage medium
CN111860573A (en) Model training method, image class detection method and device and electronic equipment
WO2021174723A1 (en) Training sample expansion method and apparatus, electronic device, and storage medium
CN110874716A (en) Interview evaluation method and device, electronic equipment and storage medium
CN109214446B (en) Potential performance personnel type identification method, system, terminal and computer readable storage medium
CN110263009A (en) Generation method, device, equipment and the readable storage medium storing program for executing of log classifying rules
CN109815448B (en) Slide generation method and device
WO2022042297A1 (en) Text clustering method, apparatus, electronic device, and storage medium
CN110399488A (en) File classification method and device
CN111815169A (en) Business approval parameter configuration method and device
CN110489747A (en) A kind of image processing method, device, storage medium and electronic equipment
CN112131322A (en) Time series classification method and device
CN111144215A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112507095A (en) Information identification method based on weak supervised learning and related equipment
CN116204714A (en) Recommendation method, recommendation device, electronic equipment and storage medium
CN111399745A (en) Music playing method, music playing interface generation method and related products
CN111427990A (en) Intelligent examination control system and method assisted by intelligent campus teaching
CN107729491A (en) Improve the method, apparatus and equipment of the accuracy rate of topic answer search
WO2021174814A1 (en) Answer verification method and apparatus for crowdsourcing task, computer device, and storage medium
TWI765266B (en) Training method, device for machine learning model and electronic device
US20210357806A1 (en) Machine learning model training method and machine learning model training device
CN110705955A (en) Contract detection method and device
CN111859985B (en) AI customer service model test method and device, electronic equipment and storage medium