0

I am working with imblearn library of Python for undersampling.

Necessary code:

undersample = RandomUnderSampler(sampling_strategy='majority')
X_under, y_under = undersample.fit_resample(X, y)

Here X is my image dataset & of (120, 100, 100) shape and y is images' labels which is of (120,) shape. I am getting an error here. But if I give X of shape (x_value, y_value) then it works. Is there any way I can convert (120, 100, 100) shape of image data to (120, 10000) shape?

Rawnak Yazdani
  • 1,333
  • 2
  • 12
  • 23

1 Answers1

1

convert the image data into an numpy array and then reshape, that would solve it

import numpy as np
# assuming X is the image data of shape (120,100,100)
X = np.asarray(image)
X_reshape = X.reshape(120,10000) 
Krishna Srinidhi
  • 370
  • 1
  • 4
  • 12