简体   繁体   English

开发后如何部署神经网络?

[英]How to deploy a neural network after developing it?

I found a simple tutorial for a neural network. 我找到了一个简单的神经网络教程。 Now I would like to deploy it. 现在,我想部署它。 I wish to make it a desktop application. 我希望使其成为桌面应用程序。 I can find out how to make a .exe from it. 我可以找到如何从中制作一个.exe文件。 But my question is this. 但是我的问题是这个。

According to the code, for the training purpose we have to input all inputs and the outputs when predicting. 根据代码,出于培训目的,我们必须在预测时输入所有输入和输出。 But when we deploy it we have to give only the inputs and neural network predict the output. 但是,当我们部署它时,我们只需要给出输入,神经网络就可以预测输出。 So according to the I can't figure out what changes I should make. 因此,根据我无法弄清楚我应该进行哪些更改。

import numpy as np
def nonlin(x,deriv=False):
   if(deriv==True):
      return x*(1-x)

X = np.array([[0,0,1],
             [0,1,1],
             [1,0,1],
             [1,1,1]])

y = np.array([[0],
              [1],
              [1],
              [0]])

np.random.seed(1)
syn0 = 2*np.random.random((3,4)) - 1
syn1 = 2*np.random.random((4,1)) - 1


for j in xrange(60000):
   l0 = X
   l1 = nonlin(np.dot(l0,syn0))
   l2 = nonlin(np.dot(l1,syn1))
   l2_error = y - l2

   l2_delta = l2_error*nonlin(l2,deriv=True)
   l1_error = l2_delta.dot(syn1.T)

   l1_delta = l1_error * nonlin(l1,deriv=True)

   syn1 += l1.T.dot(l2_delta)
   syn0 += l0.T.dot(l1_delta)                

As I understand in when we deploy this there cant be an array as y with values (which contains the out put values). 据我了解,当我们部署它时,不能有一个带有值的y数组(其中包含输出值)。

Build your model using a framework such as Keras, so that you can save it. 使用诸如Keras之类的框架构建模型,以便您可以保存它。 Then create a desktop application using Tkinter and load the model when needed to make a prediction. 然后使用Tkinter创建一个桌面应用程序,并在需要进行预测时加载模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM