1

i'm looking at some code, trying to see how it works , it's for neural network which is using numpy arrays, i changed dataset with less images but now i get this error in numpy array: " ValueError: setting an array element with a sequence. " Can anyone tell me what's the problem , or do you need whole code?

train = train_data[:-1]
test = train_data[-191:]

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

test_x = np.array([i[0] for i in test]).reshape(-1,IMG_SIZE,IMG_SIZE,1)
test_y = [i[1] for i in test]

model.fit({'input': X}, {'targets': Y}, n_epoch=3, validation_set=({'input': test_x}, {'targets': test_y}),
    snapshot_step=500, show_metric=True, run_id=MODEL_NAME)
HelloStack
  • 11
  • 1
  • 1
    Which line? Theis error often is the result of trying to make an array from objects or arrays of differing sizes. It's trying to make a regular multidimensional array, and can't. Look at the dtype and shape of all objects used in the problem `np.array` call. – hpaulj Jun 24 '17 at 22:50
  • On model.fit i get this error. It is the problem in array sizes, but not sure how to check those sizes and how to fix it, hard to understand how it works. – HelloStack Jun 25 '17 at 14:04
  • Yea i see now, arrays are different by far because of different dataset. I think i figured it oit – HelloStack Jun 25 '17 at 14:26

0 Answers0