简体   繁体   中英

Alexnet val_acc is 0 and val_loss is 0 after Epochs

I am trying to train the Alexnet upon the data that i collected. It contains the images converted to grayscale and the associated key. This is a program to simulate a self driving car.

The keys are :

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

This is my code

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)

But after every Epoch the validation accuracy remains 0 as well as the validation loss remains 0 as well.

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

This is probably a typo, look what you are passing as validation:

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

while it should be

{'input':test_X},{'targets':test_Y}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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