TW202219750A - Machine learning model training method, electronic device, controller, and storage medium - Google Patents
Machine learning model training method, electronic device, controller, and storage medium Download PDFInfo
- Publication number
- TW202219750A TW202219750A TW109138498A TW109138498A TW202219750A TW 202219750 A TW202219750 A TW 202219750A TW 109138498 A TW109138498 A TW 109138498A TW 109138498 A TW109138498 A TW 109138498A TW 202219750 A TW202219750 A TW 202219750A
- Authority
- TW
- Taiwan
- Prior art keywords
- machine learning
- learning model
- electronic devices
- model
- prediction accuracy
- Prior art date
Links
Images
Abstract
Description
本發明涉及機器學習模型訓練技術領域,具體涉及一種基於邊緣計算設備的協同式模型訓練方法、電子設備、控制器及存儲介質。The invention relates to the technical field of machine learning model training, in particular to a collaborative model training method based on an edge computing device, an electronic device, a controller and a storage medium.
隨著人工智慧技術的發展,通過機器學習模型來進行推理和判斷應用到了各個領域,例如圖像識別領域、智慧製造領域、醫學診斷領域、物流運輸領域等等。機器學習模型是通過收集大量的資料樣本進行訓練得到的,而訓練機器學習模型需要強大的計算能力和強大的資料處理能力,一般訓練機器學習模型的工作是通過雲計算環境實現,但是,雲計算不僅昂貴,而且需要極高的電力消耗、以及網路資源的消耗。另一方面,在訓練機器學習模型時,由於訓練樣本數量的限制可能導致機器學習模型的準確度不能達到理想的水準。With the development of artificial intelligence technology, reasoning and judgment through machine learning models have been applied to various fields, such as image recognition, smart manufacturing, medical diagnosis, logistics and transportation, and so on. Machine learning models are obtained by collecting a large number of data samples for training, and training machine learning models requires strong computing power and strong data processing capabilities. Generally, the work of training machine learning models is achieved through cloud computing environments. However, cloud computing Not only expensive, but also requires extremely high power consumption and consumption of network resources. On the other hand, when training a machine learning model, the accuracy of the machine learning model may not reach an ideal level due to the limitation of the number of training samples.
本發明提出一種模型訓練方法、電子設備、控制器及存儲介質,以解決上述問題。The present invention provides a model training method, electronic device, controller and storage medium to solve the above problems.
本申請的第一方面提供一種模型訓練方法,應用於模型訓練系統,所述模型訓練系統包括多個電子設備及至少一控制器,每個所述電子設備中均部署有相同的初始機器學習模型,所述模型訓練方法應用在每個所述電子設備。所述模型訓練方法包括:收集用於訓練所述初始機器學習模型的資料,作為訓練樣本資料集;按照預設比例將所述訓練樣本資料集劃分為訓練集和驗證集,利用所述訓練集訓練所述初始機器學習模型,得到訓練後的機器學習模型;通過所述驗證集驗證所述訓練後的機器學習模型,得到所述訓練後的機器學習模型的預測準確率,以及訓練後的機器學習模型中各神經元之間的權重,並將所述預測準確率及權重發送至所述控制器,使得所述控制器根據多個電子設備發送的預測準確率在所述多個電子設備發送的權重之間確定更新權重,並將所述更新權重發送至所述多個電子設備;獲取所述控制器發送的更新權重,將所述訓練後的機器學習模型中各神經元之間的權重對應更新為所述更新權重。A first aspect of the present application provides a model training method, which is applied to a model training system, where the model training system includes a plurality of electronic devices and at least one controller, and each of the electronic devices is deployed with the same initial machine learning model , the model training method is applied to each of the electronic devices. The model training method includes: collecting data for training the initial machine learning model as a training sample data set; dividing the training sample data set into a training set and a verification set according to a preset ratio, and using the training set Train the initial machine learning model to obtain the trained machine learning model; verify the trained machine learning model through the verification set, obtain the prediction accuracy of the trained machine learning model, and the trained machine learning model Learning the weights between the neurons in the model, and sending the prediction accuracy and weight to the controller, so that the controller sends the prediction accuracy rates sent by the multiple electronic devices to the multiple electronic devices. Determine the update weight between the weights of , and send the update weight to the plurality of electronic devices; obtain the update weight sent by the controller, and calculate the weight between the neurons in the trained machine learning model. The corresponding update is the update weight.
優選地,收集預設時長內用於訓練所述初始機器學習模型的資料,作為所述訓練樣本資料集;或收集預設數量的用於訓練所述初始機器學習模型的資料,作為所述訓練樣本資料集。Preferably, the data used for training the initial machine learning model within a preset time period is collected as the training sample data set; or a preset amount of data used for training the initial machine learning model is collected as the training sample dataset.
優選地,所述方法還包括:接收恢復指令,將所述訓練完成的機器學習模型恢復至初始機器學習模型,其中,所述恢復指令是在所述更新權重對應的預測準確率低於所述初始機器學習模型的預測準確率時生成的。Preferably, the method further includes: receiving a restoration instruction, and restoring the trained machine learning model to an initial machine learning model, wherein the restoration instruction is performed when the prediction accuracy corresponding to the update weight is lower than the Generated when the prediction accuracy of the initial machine learning model.
優選地,所述模型訓練方法所應用的電子設備為邊緣計算設備。Preferably, the electronic device to which the model training method is applied is an edge computing device.
本申請第二方面提供一種模型訓練方法,應用於模型訓練系統,所述模型訓練系統包括多個電子設備及至少一控制器,每個所述電子設備中均部署有相同的初始機器學習模型,所述模型訓練方法應用在所述控制器中,所述模型訓練方法包括:生成控制指令並將所述控制指令發送至每個所述電子設備,其中,所述控制指令用於觸發每個所述電子設備收集用於訓練初始機器學習模型的訓練樣本資料集,並根據所述訓練樣本資料集訓練所述初始機器學習模型,並得到訓練後的機器學習模型的預測準確率以及各神經元之間的權重;接收所述多個電子設備發送的訓練後的機器學習模型的預測準確率以及各神經元之間的權重,並根據預設規則及所述多個電子設備發送的預測準確率,從所述多個電子設備發送的權重中確定更新權重,並將所述更新權重發送至每一所述電子設備,使得每一所述電子設備將所述訓練後的機器學習模型中各神經元之間的權重對應更新為所述更新權重。A second aspect of the present application provides a model training method, which is applied to a model training system, where the model training system includes a plurality of electronic devices and at least one controller, and each of the electronic devices is deployed with the same initial machine learning model, The model training method is applied in the controller, and the model training method includes: generating a control instruction and sending the control instruction to each of the electronic devices, wherein the control instruction is used to trigger each of the electronic devices. The electronic device collects the training sample data set for training the initial machine learning model, and trains the initial machine learning model according to the training sample data set, and obtains the prediction accuracy of the trained machine learning model and the relationship between each neuron. Receive the prediction accuracy of the trained machine learning model sent by the multiple electronic devices and the weight between each neuron, and according to the preset rules and the prediction accuracy sent by the multiple electronic devices, The update weight is determined from the weights sent by the plurality of electronic devices, and the update weight is sent to each of the electronic devices, so that each of the electronic devices will send each neuron in the trained machine learning model The weight correspondence between them is updated to the update weight.
優選地,所述根據所述預設規則及所述多個電子設備發送的預測準確率,從所述多個電子設備發送的權重中確定更新權重,包括:選擇多個預測準確率中最高者,將預測準確率最高者對應的權重作為更新權重。Preferably, the determining the update weight from the weights sent by the plurality of electronic devices according to the preset rule and the prediction accuracy rates sent by the plurality of electronic devices includes: selecting the highest among the plurality of prediction accuracy rates , and take the weight corresponding to the one with the highest prediction accuracy as the update weight.
優選地,將更新權重發送至每一所述電子設備之前,所述方法還包括:將所述更新權重對應的預測準確率與所述初始機器學習模型的預測準確率進行比較;若所述更新權重對應的預測準確率高於所述初始機器學習模型的預測準確率,則將所述更新權重發送至所述多個電子設備;若所述更新權重對應的預測準確率低於所述初始機器學習模型的預測準確率,則向所述多個電子設備發送一恢復指令,使得所述多個電子設備根據所述恢復指令,將各自訓練完成的機器學習模型恢復至初始機器學習模型。Preferably, before sending the updated weight to each of the electronic devices, the method further comprises: comparing the prediction accuracy rate corresponding to the update weight with the prediction accuracy rate of the initial machine learning model; If the prediction accuracy rate corresponding to the weight is higher than the prediction accuracy rate of the initial machine learning model, the update weight is sent to the plurality of electronic devices; if the prediction accuracy rate corresponding to the update weight is lower than the initial machine learning model If the prediction accuracy of the learning model is determined, a restoration instruction is sent to the plurality of electronic devices, so that the plurality of electronic devices restore the respective trained machine learning models to the initial machine learning model according to the restoration instruction.
優選地,所述模型訓練方法的終止條件包括如下任一種:訓練時長達到預設時長;訓練後的機器學習模型的預測準確率達到設定標準;訓練次數達到預設值;或接收到停止指令。Preferably, the termination conditions of the model training method include any of the following: the training duration reaches a preset duration; the prediction accuracy of the trained machine learning model reaches a set standard; the number of training times reaches a preset value; instruction.
本申請第三方面提供一種電子設備,與多個其他電子設備通信連接,每一所述電子設備中部署有相同的機器學習模型,所述電子設備包括處理器,所述處理器用於執行記憶體中存儲的電腦程式時實現如前所述的模型訓練方法。A third aspect of the present application provides an electronic device that is communicatively connected to a plurality of other electronic devices, each of the electronic devices is deployed with the same machine learning model, the electronic device includes a processor, and the processor is used to execute a memory The model training method described above is implemented when the computer program stored in the computer is used.
本申請第四方面提供一種電腦可讀存儲介質,其上存儲有電腦程式,所述電腦程式被處理器執行時實現如前所述的模型訓練方法。A fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the aforementioned model training method.
本發明通過多個互相通信的邊緣計算設備協同訓練機器學習模型,降低機器學習模型訓練的成本及電力消耗、使得網路資源得到更合理的利用,同時也對機器學習模型進行不斷優化,提高機器學習模型的準確度。The invention uses multiple edge computing devices that communicate with each other to collaboratively train the machine learning model, reduces the cost and power consumption of the machine learning model training, makes the network resources more reasonably used, and also continuously optimizes the machine learning model to improve the machine learning model. Accuracy of the learned model.
為了能夠更清楚地理解本發明的上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明的是,在不衝突的情況下,本申請的實施例及實施例中的特徵可以相互組合。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.
實施例一Example 1
請參閱圖1,為本發明第一實施例提供的模型訓練系統的示意圖。如圖1所示,在本實施例中,所述模型訓練系統100中包括多個電子設備200以及控制器300,多個電子設備200與控制器300之間通過網路建立連接,並能夠互相通信。其中,所述網路可以是有線網路,也可以是無線網路,例如第四代(4th Generation, 4G)移動通信網路、第五代(5th Generation,5G)移動通信網路、無線保真(Wireless Fidelity, WIFI)、藍牙等。其中,所述控制器300可以是但不限於臺式電腦、筆記型電腦、伺服器等終端設備,也可以是雲計算伺服器,本發明不做具體限制。Please refer to FIG. 1 , which is a schematic diagram of a model training system provided by a first embodiment of the present invention. As shown in FIG. 1 , in this embodiment, the
在本申請實施例中,所述多個電子設備200可以是邊緣計算設備,所述的邊緣計算設備具有收集物聯網或工業互聯網的邊緣側資料,用於訓練、優化機器學習模型的能力,還具有基於機器學習的智慧運算能力。舉例而言,所述多個電子設備200可以是位於工業互聯網一個工廠中不同生產線的控制設備,也可以是屬於不同使用者的不同電腦裝置或伺服器等,本申請對此不做限制。In the embodiment of the present application, the plurality of
在本申請實施例中,每一所述電子設備200均部署有相同的機器學習模型,所述機器學習模型是已經經過訓練的機器學習模型。其中,所述機器學習模型可以是但不限於神經網路模型,所述機器學習模型包括多個神經元,神經元之間的連接對應有權重,為方便描述,本申請實施例中將所述電子設備200中最初部署的機器學習模型稱為初始機器學習模型,將該初始機器學習模型中的權重統稱為第一權重W1。In this embodiment of the present application, each of the
在一些實施方式中,所述每一電子設備200中的機器學習模型均可以是從雲端存儲裝置獲取的,例如,雲計算設備訓練完所述機器學習模型後,每一所述電子設備200均從所述雲端存儲裝置中獲取所述訓練完的機器學習模型。在另一些實施方式中,所述每一電子設備200中的機器學習模型也可以是通過使用者導入的,例如,每一所述電子設備200的使用者購買相同的機器學習模型後,將所述機器學習模型分別導入至每一所述電子設備200。In some embodiments, the machine learning model in each
本申請實施例中,每一電子設備200均可以在部署所述初始機器學習模型後,回應控制器300的控制指令執行模型訓練功能,其中,所述模型訓練功能包括:In this embodiment of the present application, after deploying the initial machine learning model, each
1)即時收集用於訓練所述初始機器學習模型的資料,作為訓練樣本資料集;1) Immediately collect data for training the initial machine learning model as a training sample data set;
所述電子設備200收集的資料可以是物聯網或工業互聯網中的設備運行過程中產生的資料,也可以是電子設備200自身運行過程中產生的資料,例如,電子設備200是生產線中的生產設備時,在生產過程中會產生可以用於訓練所述機器學習模型的資料,那麼所述電子設備200即時收集所述資料作為所述訓練樣本資料集。在另一些實施方式中,所述電子設備20中的作為訓練樣本資料集的資料也可以是使用者導入的。The data collected by the
在一個實施方式中,所述每一電子設備200均收集預設時長內的資料後,將所述預設時長內收集的資料作為訓練樣本資料集,例如,收集24小時之內的資料;In one embodiment, after each
在另一個實施方式中,所述每一電子設備200收集預設數量的資料,並將預設數量的資料作為訓練樣本資料集,舉例而言,若所述資料為產品瑕疵圖片,則收集一千張產品瑕疵圖片後,將所述一千張圖片作為訓練樣本資料集;In another embodiment, each
2)按照預設比例將所述訓練樣本資料集劃分為訓練集和驗證集,利用所述訓練集訓練所述初始機器學習模型,得到訓練後的機器學習模型;2) Dividing the training sample data set into a training set and a verification set according to a preset ratio, and using the training set to train the initial machine learning model to obtain a trained machine learning model;
3)通過所述驗證集驗證所述訓練後的機器學習模型,得到所述訓練後的機器學習模型的預測準確率,以及訓練後的機器學習模型中各神經元之間的權重(為方便描述,後續稱為第二權重),並將所述預測準確率及第二權重發送至所述控制器300。可以理解,機器學習模型中會有多個神經元,各神經元之間的連接都有對應的權重,因此,本申請所說的第一權重、第二權重、更新權重均是指機器學習模型中各個神經元之間的權重,是一組權重。3) Verify the trained machine learning model through the verification set, obtain the prediction accuracy of the trained machine learning model, and the weights between neurons in the trained machine learning model (for the convenience of description) , hereinafter referred to as the second weight), and the prediction accuracy and the second weight are sent to the
所述控制器300在接收到所述多個電子設備發送的預測準確率和第二權重後,還用於根據預設規則及所述多個電子設備200發送的預測準確率,從所述多個電子設備200發送的第二權重中選擇一組作為更新權重,並將所述更新權重發送至每一電子設備200,使得電子設備200根據所述更新權重更新所述訓練後的機器學習模型。所述預設規則可以是選擇多個預測準確率中最高者,也可以是選擇預測準確率居中者。After receiving the prediction accuracy rates and the second weights sent by the multiple electronic devices, the
舉例而言,所述控制器300與四個電子設備200通信,為方便描述,將所述四個電子設備200分別命名為E1、E2、E3、E4。所述四個電子設備200回應所述控制器300的控制指令分別收集資料,得到的訓練樣本資料集分別為D1、D2、D3、D4。其中,電子設備E1通過D1訓練所述初始機器學習模型,訓練完成的機器學習模型的預測準確率L1。所述電子設備E2通過D2訓練所述初始機器學習模型,訓練完成的機器學習模型的預測準確率為L2,同理,電子設備E3通過D3訓練所述初始機器學習模型,得到訓練後的機器學習模型的預測準確率為L3、電子設備E4通過D4訓練後的機器學習模型的預測準確率為L4。所述控制器300可以根據預設規則選擇預測準確率最高者,將預測準確率最高者對應的第二權重作為更新權重。例如預測準確率L4最高,則將電子設備E4訓練的機器學習模型的第二權重作為更新權重,發送給其他三個電子設備,使得其他三個電子設備根據所述更新權重對各自的機器學習模型進行更新。For example, the
本申請實施例中,根據所述更新權重更新所述機器學習模型是指將所述機器學習模型中各神經元的權重對應替換為所述更新權重。In the embodiment of the present application, updating the machine learning model according to the update weight refers to correspondingly replacing the weight of each neuron in the machine learning model with the update weight.
通過採用該技術方案,使得作為邊緣計算設備的電子設備200具有訓練機器學習模型的能力,而不需要使用雲計算環境,節約成本的同時也更充分、合理的利用了網路資源。另一方面,每個電子設備200都可以獲取到訓練樣本資料集,通過多個電子設備200分別對初始機器學習模型進行後續的訓練和優化,克服了因訓練樣本不足導致的機器學習模型準確度不高的問題,使得模型準確率滿足使用者的需求。By adopting this technical solution, the
在一些可選的實施方式中,所述控制器300在將所述更新權重發送至所述電子設備200之前,還可以執行如下操作:In some optional implementation manners, before sending the updated weight to the
將所述更新權重對應的預測準確率與所述初始機器學習模型的預測準確率進行比較;comparing the prediction accuracy rate corresponding to the update weight with the prediction accuracy rate of the initial machine learning model;
若所述更新權重對應的預測準確率高於所述初始機器學習模型的預測準確率,則將所述更新權重發送至所述多個電子設備200;If the prediction accuracy rate corresponding to the update weight is higher than the prediction accuracy rate of the initial machine learning model, sending the update weight to the plurality of
若所述更新權重對應的預測準確率低於所述初始機器學習模型的預測準確率,則向所述多個電子設備200發送一恢復指令,使得所述多個電子設備200根據所述恢復指令,將各自訓練完成的機器學習模型恢復至初始機器學習模型。If the prediction accuracy rate corresponding to the update weight is lower than the prediction accuracy rate of the initial machine learning model, a restoration instruction is sent to the plurality of
通過採用這種技術方案,使得訓練後的機器學習模型準確率低於初始機器學習模型時,可以將模型恢復至較高的準確率,避免電子設備訓練後的機器學習模型準確率降低的問題,從而保證訓練出的模型的準確度。By adopting this technical solution, when the accuracy of the trained machine learning model is lower than that of the initial machine learning model, the model can be restored to a higher accuracy, so as to avoid the problem that the accuracy of the machine learning model after the training of electronic equipment is reduced. This ensures the accuracy of the trained model.
鑒於機器學習模型的訓練是一個可持續的、不斷優化的過程,因此,在本申請實施例中,所述控制器300將所述更新權重發送至所述多個電子設備200後,所述控制器300繼續生成控制指令,控制所述多個電子設備200重複執行如前所述的模型訓練功能,所述控制器300也繼續執行如前所述的確定及發送更新權重的功能。通過對機器學習模型的持續訓練,可以不斷提升模型的準確度。Since the training of the machine learning model is a sustainable and continuously optimized process, in this embodiment of the present application, after the
在一些實施方式中,當所述訓練時長達到預設時長時,所述控制器300停止生成訓練停止訓練所述機器學習模型。例如,訓練時長達到30天時,結束所述模型的訓練。In some embodiments, when the training duration reaches a preset duration, the
另一些實施方式中,當所述訓練後的機器學習模型的預測準確率達到設定標準時,停止訓練所述機器學習模型。例如,當訓練後的機器學習模型的預測準確率達到95%時,停止訓練。In other embodiments, when the prediction accuracy of the trained machine learning model reaches a set standard, the training of the machine learning model is stopped. For example, stop training when the prediction accuracy of the trained machine learning model reaches 95%.
再一些實施方式中,當訓練次數達到預設值時停止訓練所述機器學習模型。In still other embodiments, the training of the machine learning model is stopped when the number of training times reaches a preset value.
又一些實施方式中,可以回應使用者的停止指令,停止訓練所述機器學習模型。In still other embodiments, the training of the machine learning model may be stopped in response to the user's stop instruction.
實施例二Embodiment 2
如圖2所示,為本申請第二實施例提供的模型訓練系統示意圖。在本實施例中,所述模型訓練系統100中包括多台電子設備200,所述多台電子設備200之間通過網路互相通信,所述多個電子設備200中的任意一台可以被設定作為控制器。也就是說,所述控制器也可以是邊緣計算設備,被設定為控制器的電子設備200用於回應使用者的操作執行如前一實施例所述的模型訓練功能,還用於回應該使用者操作生成控制指令,並將控制指令發送至其他電子設備200,控制其他電子設備200執行如前一實施例所述的模型訓練功能。該被設定為控制器的電子設備200還用於接收其他電子設備200發送的訓練後的機器學習模型的預測準確率以及第二權重值,並根據預設規則及所述其他電子設備200發送的預測準確率,從所述多個電子設備200發送的第二權重中選擇一個作為更新權重,更新所述控制器中機器學習模型的權重,並將所述更新權重發送至其他每一電子設備200,使得其他電子設備200根據所述更新權重更新所述機器學習模型。As shown in FIG. 2 , it is a schematic diagram of a model training system provided by the second embodiment of the present application. In this embodiment, the
在本實施例中,所述電子設備200執行模型訓練功能的過程與前一實施例相同,在此不做重複。In this embodiment, the process of executing the model training function by the
通過採用該技術方案,無需設立單獨的控制器,模型訓練系統100中每台電子設備200都可以在遵循一定的協定下,根據實際應用需要被設置為控制器,控制其他電子設備執行模型訓練功能,使得網路資源得到合理利用。By adopting this technical solution, there is no need to set up a separate controller, and each
基於前述實施例,結合圖3闡述本發明一實施例提供的模型訓練方法。Based on the foregoing embodiment, a model training method provided by an embodiment of the present invention is described with reference to FIG. 3 .
圖3為本發明一個實施例提供的模型訓練方法流程圖,所述模型訓練方法應用於如前所述實施例中的電子設備200。根據不同的需求,該流程圖中步驟的順序可以改變,某些步驟可以省略。為了便於說明,僅示出了與本發明實施例相關的部分。FIG. 3 is a flowchart of a model training method provided by an embodiment of the present invention, where the model training method is applied to the
S301、電子設備收集用於訓練所述初始機器學習模型的資料,作為訓練樣本資料集。S301. The electronic device collects data for training the initial machine learning model as a training sample data set.
一個實施方式中,所述電子設備200收集預設時間長度內的資料作為訓練樣本資料集。另一個實施方式中,所述電子設備200收集預設數量的資料作為訓練樣本資料集。In one embodiment, the
S302、按照預設比例將所述訓練樣本資料集劃分為訓練集和驗證集,利用所述訓練集訓練所述初始機器學習模型,得到訓練後的機器學習模型。S302. Divide the training sample data set into a training set and a verification set according to a preset ratio, and use the training set to train the initial machine learning model to obtain a trained machine learning model.
S303、通過所述驗證集驗證所述訓練後的機器學習模型,得到所述訓練後的機器學習模型的預測準確率,以及訓練後的機器學習模型中各神經元之間的權重,並將所述預測準確率及權重發送至所述控制器。S303, verify the trained machine learning model through the verification set, obtain the prediction accuracy of the trained machine learning model, and the weights between the neurons in the trained machine learning model, and assign all the The prediction accuracy and weight are sent to the controller.
所述電子設備將預測準確率及權重發送至控制器後,使得所述控制器根據多個電子設備發送的預測準確率在所述多個電子設備發送的權重之間選擇一組權重作為更新權重,並將更新權重發送至多個電子設備。After the electronic device sends the prediction accuracy and the weight to the controller, the controller selects a set of weights among the weights sent by the multiple electronic devices as the update weight according to the prediction accuracy sent by the multiple electronic devices , and send the updated weights to multiple electronic devices.
S304、獲取所述控制器發送的更新權重,根據所述更新權重更新機器學習模型中對應神經元的權重。S304. Obtain the update weight sent by the controller, and update the weight of the corresponding neuron in the machine learning model according to the update weight.
本申請實施例中,根據所述更新權重更新所述機器學習模型是指將所述機器學習模型中各神經元的權重對應替換為所述更新權重。In the embodiment of the present application, updating the machine learning model according to the update weight refers to correspondingly replacing the weight of each neuron in the machine learning model with the update weight.
基於前述實施例,結合圖4闡述本發明另一實施例提供的模型訓練方法。圖4所述模型訓練方法應用於如前所述實施例中的控制器300。根據不同的需求,該流程圖中步驟的順序可以改變,某些步驟可以省略。為了便於說明,僅示出了與本發明實施例相關的部分。Based on the foregoing embodiment, a model training method provided by another embodiment of the present invention is described with reference to FIG. 4 . The model training method described in FIG. 4 is applied to the
S401、生成控制指令並將所述控制指令發送至多個電子設備,所述控制指令用於觸發所述多個電子設備收集用於訓練初始機器學習模型的訓練樣本資料集,並根據所述訓練樣本資料集訓練初始機器學習模型,得到訓練後的機器學習模型的預測準確率以及各神經元之間的權重;S401. Generate a control instruction and send the control instruction to multiple electronic devices, where the control instruction is used to trigger the multiple electronic devices to collect a training sample data set for training an initial machine learning model, and generate a data set of training samples for training an initial machine learning model. The data set trains the initial machine learning model, and obtains the prediction accuracy of the trained machine learning model and the weight between each neuron;
S402、接收所述多個電子設備發送的各自訓練後的機器學習模型的預測準確率以及各神經元之間的權重,並根據預設規則及所述多個電子設備發送的預測準確率,從所述多個電子設備發送的權重中選擇一組作為更新權重,並將所述更新權重發送至每一電子設備,使得電子設備根據所述更新權重更新所述訓練後的機器學習模型。S402. Receive the prediction accuracy rates of the respective trained machine learning models and the weights between neurons sent by the multiple electronic devices, and according to preset rules and the prediction accuracy rates sent by the multiple electronic devices, from A group of the weights sent by the plurality of electronic devices is selected as the update weight, and the update weight is sent to each electronic device, so that the electronic device updates the trained machine learning model according to the update weight.
所述預設規則如前所述,在此不做重複。The preset rules are as described above, and are not repeated here.
在一些實施方式中,在S402中,將更新權重發送至每一所述電子設備之前,所述方法還包括:In some embodiments, in S402, before sending the update weight to each of the electronic devices, the method further includes:
將所述更新權重對應的預測準確率與所述初始機器學習模型的預測準確率進行比較;comparing the prediction accuracy rate corresponding to the update weight with the prediction accuracy rate of the initial machine learning model;
若所述更新權重對應的預測準確率高於所述初始機器學習模型的預測準確率,則將所述更新權重發送至所述多個電子設備;If the prediction accuracy rate corresponding to the update weight is higher than the prediction accuracy rate of the initial machine learning model, sending the update weight to the plurality of electronic devices;
若所述更新權重對應的預測準確率低於所述初始機器學習模型的預測準確率,則向所述多個電子設備發送一恢復指令,使得所述多個電子設備根據所述恢復指令,將各自訓練完成的機器學習模型恢復至初始機器學習模型。If the prediction accuracy rate corresponding to the update weight is lower than the prediction accuracy rate of the initial machine learning model, a restoration instruction is sent to the plurality of electronic devices, so that the plurality of electronic devices, according to the restoration instruction The respective trained machine learning models are restored to the original machine learning models.
在另一實施例中,模型訓練方法應用的控制器是所述多個電子設備中的一者時,所述控制器除執行步驟S401-402之外,還執行類似如前所述S301-S304步驟:收集用於訓練所述初始機器學習模型的資料,作為訓練樣本資料集;按照預設比例將所述訓練樣本資料集劃分為訓練集和驗證集,利用所述訓練集訓練所述初始機器學習模型,得到訓練後的機器學習模型;通過所述驗證集驗證所述訓練後的機器學習模型,得到所述訓練後的機器學習模型的預測準確率,以及訓練後的機器學習模型中各神經元之間的權重。在接收到其他電子設備發送的預測準確率及權重後,根據控制器自身獲取到的預測準確率和權重,以及多個其他電子設備發送的預測準確率,在所述權重之間選擇一組權重作為更新權重,並將所述更新權重發送至所述多個電子設備之外,該控制器也根據所述更新權重更新該控制器中的機器學習模型。In another embodiment, when the controller to which the model training method is applied is one of the plurality of electronic devices, in addition to performing steps S401-402, the controller also performs steps S301-S304 similar to those described above Steps: collecting data for training the initial machine learning model as a training sample data set; dividing the training sample data set into a training set and a verification set according to a preset ratio, and using the training set to train the initial machine learning model to obtain a trained machine learning model; verifying the trained machine learning model through the verification set, obtaining the prediction accuracy of the trained machine learning model, and each neural network in the trained machine learning model weights between elements. After receiving the prediction accuracy and weight sent by other electronic devices, select a set of weights among the weights according to the prediction accuracy and weight obtained by the controller itself and the prediction accuracy sent by multiple other electronic devices As the update weight, and the update weight is sent to the outside of the plurality of electronic devices, the controller also updates the machine learning model in the controller according to the update weight.
本申請實施例中,所述模型訓練方法的終止條件包括如下任一種:In the embodiment of the present application, the termination condition of the model training method includes any of the following:
訓練時長達到預設時長;The training time reaches the preset time;
訓練後的機器學習模型的預測準確率達到設定標準;The prediction accuracy of the trained machine learning model reaches the set standard;
訓練次數達到預設值;或The number of training sessions reaches a preset value; or
接收到停止指令。A stop command was received.
在本申請實施例的一個使用場景中,所述多個電子設備200可以是屬於不同企業使用者的電腦裝置,各企業使用者通過購買等方式獲取到相同的機器學習後,在使用模型過程中可以繼續通過自己的訓練樣本對模型進行訓練和優化。一方面,通過使用者自己收集的訓練樣本對模型訓練,有助於使用者對訓練樣本的保密性,另一方面,不斷提高模型準確率,再一方面,模型的訓練可以不依賴於雲計算環境,節約成本,合理利用網路資源。In a usage scenario of the embodiment of the present application, the plurality of
如圖5所示,為本申請一實施例提供的電子設備的硬體架構示意圖。As shown in FIG. 5 , a schematic diagram of a hardware architecture of an electronic device according to an embodiment of the present application is shown.
所述電子設備200包括記憶體201、處理器202、存儲在所述記憶體201中並可在所述處理器202上運行的電腦程式203,例如模型訓練程式,以及通信單元204。所述處理器202執行所述電腦程式203時實現上述模型訓練方法實施例中電子設備執行的步驟。The
本領域技術人員可以理解,所述示意圖5僅僅是電子設備200的示例,並不構成限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電子設備200還可以包括輸入輸出設備、網路接入設備、匯流排等。Those skilled in the art can understand that the schematic diagram 5 is only an example of the
所稱處理器202可以是中央處理單元(Central Processing Unit,CPU),還可以包括其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現成可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者該處理器也可以是任何常規的處理器等,所述處理器202是所述電子設備200的控制中心,利用各種介面和線路連接整個電子設備200的各個部分。The so-called
所述記憶體201可用於存儲所述電腦程式203,所述處理器202通過運行或執行存儲在所述記憶體201內的電腦程式,以及調用存儲在記憶體201內的資料,實現所述電子設備200的各種功能。記憶體201可以包括外部存儲介質,也可以包括記憶體。此外,記憶體201可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card, SMC),安全數位(Secure Digital, SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。The
所述通信單元204用於與其他電子設備及控制器建立通信連接,所述通信單元204可以是WIFI模組、藍牙模組等。The
如圖6所示,為本申請一實施例提供的控制器300的架構示意圖。所示控制器包括通信單元601、記憶體602、處理器603、存儲在所述記憶體602中並可在所述處理器603上運行的電腦程式604,例如模型訓練程式。所述處理器603執行所述電腦程式604時實現上述模型訓練方法實施例中控制器執行的步驟。As shown in FIG. 6 , a schematic structural diagram of a
對於本領域技術人員而言,顯然本發明不限於上述示範性實施例的細節,而且在不背離本發明的精神或基本特徵的情況下,能夠以其他的具體形式實現本發明。因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本發明的範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本發明內。不應將請求項中的任何附圖標記視為限制所涉及的請求項。此外,顯然“包括”一詞不排除其他單元或步驟,單數不排除複數。電腦裝置請求項中陳述的多個單元或電腦裝置也可以由同一個單元或電腦裝置通過軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定的順序。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 present invention is defined by the appended claims rather than the foregoing description, and is 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 sign in a claim should not be construed as limiting the claim to which it relates. Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. A plurality of units or computer devices stated in the claim for computer device may also be implemented by the same unit or computer device through software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.
最後應說明的是,以上實施例僅用以說明本發明的技術方案而非限制,儘管參照較佳實施例對本發明進行了詳細說明,本領域的普通技術人員應當理解,可以對本發明的技術方案進行修改或等同替換,而不脫離本發明技術方案的精神和範圍。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present invention.
100:模型訓練系統
200:電子設備
300:控制器
201、602:記憶體
202、603:處理器
203、604:電腦程式
204、601:通信單元
100: Model Training System
200: Electronic Equipment
300:
圖1是本發明一個實施例提供的模型訓練系統的示意圖。FIG. 1 is a schematic diagram of a model training system provided by an embodiment of the present invention.
圖2是本發明另一個實施例提供的模型訓練系統的示意圖。FIG. 2 is a schematic diagram of a model training system provided by another embodiment of the present invention.
圖3是本發明一實施例提供的模型訓練方法流程示意圖。FIG. 3 is a schematic flowchart of a model training method provided by an embodiment of the present invention.
圖4是本發明另一實施例提供的模型訓練方法流程示意圖。FIG. 4 is a schematic flowchart of a model training method provided by another embodiment of the present invention.
圖5是本發明一實施方式提供的電子設備的架構示意圖。FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
圖6是本發明一實施方式提供的控制器的架構示意圖。FIG. 6 is a schematic structural diagram of a controller according to an embodiment of the present invention.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109138498A TW202219750A (en) | 2020-11-04 | 2020-11-04 | Machine learning model training method, electronic device, controller, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109138498A TW202219750A (en) | 2020-11-04 | 2020-11-04 | Machine learning model training method, electronic device, controller, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
TW202219750A true TW202219750A (en) | 2022-05-16 |
Family
ID=82558887
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW109138498A TW202219750A (en) | 2020-11-04 | 2020-11-04 | Machine learning model training method, electronic device, controller, and storage medium |
Country Status (1)
Country | Link |
---|---|
TW (1) | TW202219750A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI809874B (en) * | 2022-05-17 | 2023-07-21 | 華碩電腦股份有限公司 | Artificial intelligence model control system |
-
2020
- 2020-11-04 TW TW109138498A patent/TW202219750A/en unknown
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI809874B (en) * | 2022-05-17 | 2023-07-21 | 華碩電腦股份有限公司 | Artificial intelligence model control system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110263921B (en) | Method and device for training federated learning model | |
CN110506260B (en) | Methods, systems, and media for enhanced data processing in a neural network environment | |
WO2021083276A1 (en) | Method, device, and apparatus for combining horizontal federation and vertical federation, and medium | |
CN110874484A (en) | Data processing method and system based on neural network and federal learning | |
CN113033703B (en) | Quantum neural network training method and device, electronic device and medium | |
JP6753200B2 (en) | Methods, systems and computer programs for cloud-based computing clusters for simulated operator training systems | |
US20170039485A1 (en) | System and Method for Balancing Computation with Communication in Parallel Learning | |
JP2022008781A (en) | Decentralized training method, system, device, storage medium and program | |
WO2023124296A1 (en) | Knowledge distillation-based joint learning training method and apparatus, device and medium | |
CN105446896A (en) | MapReduce application cache management method and device | |
WO2020199690A1 (en) | Cloud platform-based sharing learning system and method, sharing platform and method, and medium | |
CN112667400B (en) | Edge cloud resource scheduling method, device and system managed and controlled by edge autonomous center | |
CN113435682A (en) | Gradient compression for distributed training | |
WO2019019926A1 (en) | System parameter optimization method, apparatus and device, and readable medium | |
WO2022111002A1 (en) | Method and apparatus for training neural network, and computer readable storage medium | |
US11706289B1 (en) | System and method for distributed management of hardware using intermediate representations of systems to satisfy user intent | |
US11023825B2 (en) | Platform as a service cloud server and machine learning data processing method thereof | |
US11569278B1 (en) | Systems and methods for callable options values determination using deep machine learning | |
TW202219750A (en) | Machine learning model training method, electronic device, controller, and storage medium | |
CN114297934A (en) | Model parameter parallel simulation optimization method and device based on proxy model | |
US20210150371A1 (en) | Automatic multi-objective hardware optimization for processing of deep learning networks | |
CN114528893A (en) | Machine learning model training method, electronic device and storage medium | |
WO2022127603A1 (en) | Model processing method and related device | |
CN113486583B (en) | Method and device for evaluating health of equipment, computer equipment and computer readable storage medium | |
CN117011118A (en) | Model parameter updating method, device, computer equipment and storage medium |