本文整理汇总了Python中nolearn.lasagne.NeuralNet.partial_fit方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.partial_fit方法的具体用法?Python NeuralNet.partial_fit怎么用?Python NeuralNet.partial_fit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nolearn.lasagne.NeuralNet
的用法示例。
在下文中一共展示了NeuralNet.partial_fit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: yield
# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import partial_fit [as 别名]
images = glob.glob('../bee_project/*.jpg')
for f_name in images:
if count >= batch_size:
X_train = numpy.array(data,dtype='float32')
y_train = numpy.array(labels,dtype='int32')
data = []
labels = []
count = 0
yield (X_train,y_train)
im = Image.open(f_name,mode='r')
dat = numpy.asarray(im).astype('float32') / 255
im.close()
dat = numpy.rollaxis(dat,2)
data.append(dat)
#hacky way of getting classification from filename
jpg_idx = f_name.find('.jpg')
labels.append(int(f_name[jpg_idx-1:jpg_idx]))
count+=1
yield (X_train,y_train)
for X_epoch,y_epoch in generate_data():
#fit the batchsize to our model
convNet.partial_fit(X_epoch,y_epoch)
with open('convNet.pickle','wb') as f:
#save our model to a file
pickle.dump(convNet,f,-1)