I just trying to add label to numpy.ndarray.

numpy.ndarray's shape is (?, 1, 100, 100)

[[[ 1 1 1 ... 1 1 1]
          ...
  [ 1 1 1 ... 1 1 1]]]

and label is [1,0] or [0,1]

so i want shape like this

[[[ 1 1 1 ... 1 1 1]
          ...
  [ 1 1 1 ... 1 1 1]]] , [1,0]

or

[[[ 1 1 1 ... 1 1 1]
          ...
  [ 1 1 1 ... 1 1 1]]] , [0,1]

how to make this shape???

I tried like this but doesn't work.

data_train = []
for i in range(len(true_data.tolist())):
    true_data[i].append([1,0])
    data_train.append(true_data[i])

1 Answers

0
Chan Chan On

i found answer by myself!

this is my code

data_train = []
true_list = true_data.tolist()
for index in range(len(true_list)):
    true_list[index].append([1,0])
    temp = np.asarray(true_list[index])
    data_train.append(temp)