训练一个基本的神经网络,该网络接收一系列帧/数字对,并在被赋予一系列新的帧后生成新的数字



我对这个主题很陌生,所以我不确定从哪里开始这个任务。我有大量的训练数据,基本上只是一系列图片帧,每个图片帧都有对应的数字。序列本身有点像一个只会一点一点地变化的视频,这也反映在相应的数字中,这些数字永远不会产生任何"变化";大跳跃;并且仅根据各种因素缓慢地改变,例如像素改变的速度或曾经进入屏幕的像素再次退出的速度。

我已经尝试过使用keras来查找设置方法,但很多术语和语法对我来说仍然是陌生的,这就是为什么我不确定在哪里可以找到我可以用于特定问题的示例。

尝试使用tensorflow:

#We start by importing everything that we will need
import tensorflow #This will train our model
import pandas    #Pandas is to read the data
import keras    
import numpy    #Numpy will build the matrices
import sklearn    #sklearn is to choose the model that we will be using
from sklearn import linear_model
from sklearn.utils import shuffle
import matplotlib.pyplot as pyplot
import pickle    #pickle is used to save the model
from matplotlib import style

data = pandas.readcsv("path to the data", sep = ';') #You need to change the sep = ';'
#if your data is not separated with a ';'
data = data["Whatever","Label","you want","to include"]
predict = ["Label you want to predict"]
x = numpy.array(data.drop([predict], 1))
y = numpy.array(data[predict])

x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(x, y, 
test_size=0.3)
linear = linear_model.LinearRegression()
linear.fit(x_train, y_train)
acc = linear.score(x_test, y_test)
print(acc)
predictions = linear.predict[x_test]
for x in range(len(predictions)):
print("Prediction:", predictions[x], "reality:", y_test[x]

最新更新