在Epochs之后,Alexnet val_acc为0,val_loss为0

时间:2017-07-07 18:26:10

标签: python tensorflow neural-network deep-learning

我正在尝试根据我收集的数据训练Alexnet。 它包含转换为灰度的图像和相关的键。 这是一个模拟自驾车的程序。

关键是:

w = [1,0,0]
a = [0,1,0]
d = [0,0,1]

这是我的代码

import numpy as np
from alexnet import alexnet

WIDTH = 100
HEIGHT = 80
LR = 1e-3
EPOCHS = 8
MODEL_NAME = 'Udacity Model Car NN'

model = alexnet(WIDTH,HEIGHT,LR)

train_data = np.load('data.npy',encoding="bytes")
train = train_data[:-200]
test = train_data[-200:]

X = np.array([i[0] for i in train]).reshape(-1,WIDTH,HEIGHT,1)
Y = [i[1] for i in train]

test_X = np.array([i[0] for i in test]).reshape(-1,WIDTH,HEIGHT,1)
test_Y = [i[1] for i in test]


model.fit({'input':X},{'targets':Y},n_epoch=EPOCHS,validation_set=({'input':test_X},{'targets:test_y'}),snapshot_step=500,show_metric=True,run_id=MODEL_NAME)


model.save(MODEL_NAME)

但是在每个Epoch之后,验证准确度仍然为0,验证损失也保持为0。

Training Step: 104  | total loss: 1.31713 | time: 119.279s| Momentum |epoch: 008 | loss: 1.31713 - acc: 0.3878 | val_loss: 0.00000 - val_acc: 0.0000 -- iter: 801/801

1 个答案:

答案 0 :(得分:0)

这可能是一个错字,看看你传递的是验证:

C2440 'type cast': cannot convert from 'unsigned __int64 (__cdecl std::basic_string<char,std::char_traits<char>,std::allocator<char>>::* )(void) noexcept const' to 'char *'

虽然它应该是

{'input':test_X},{'targets:test_y'}
\______________/ \_______________/
correct dict      this is a set with a string!