How to open a .raw file containing thousands of face images for classification

94 Views Asked by At

I'am trying to resolve a classification problem of faces images. The images are in a db_train.raw binary file containing 111430 images. Each one is 56*56*3. The labels are in a separate file with 0 or 1, 111430 lines.

Whatever i try, i can't seem to open that .raw file to pre-visualise some images (1) and dont know what to do with this format regarding preprocessing the data to input in my deep learning architecture (2).

i have tried several things like :

image = np.empty((56,56,3), np.uint8)
image.data[:] = open('/Users/macbookpro/Documents/ML/db_train.raw').read()
plt.imshow(image)

i get the following error

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 30: invalid start byte

and this one once :

Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).

I also tried using rawpy but it didn't work either. I've tried some of the solutions here on stack but no luck so far..

0

There are 0 best solutions below