0

Add binary labels to an array of shape (752, 227, 227, 3) where 752 is the number of images, images size is 227x227x3 with RGB channels.

I need to label the 752 images with class 1. I want class 0 to be represented as 2 columns with values [0, 1].

The output should be train_ben_all with shape (752, 227, 227, 3, 2).

labels_ben = np.concatenate((np.ones((752,1)),np.zeros((752, 1))), axis=1)

labels_ben.shape
Out[4]: (752, 2)

train_ben.shape
Out[3]: (752, 227, 227, 3)

I need to concatenate those two arrays together.

I tried to expand dimensions and then concatenate but it seems too complicated.

Is it better to use a dictionary ? I need to shuffle the 752 images with their label after joining the other class dataset.

Any solution?

Boels Maxence
  • 349
  • 3
  • 16

0 Answers0