How do I create training data with fer2013 format
takeofuture opened this issue · 0 comments
takeofuture commented
I know fer2013 is 48 x 48 pixel data
https://github.com/oarriaga/face_classification
I try to convert my own jpg file to pixcel as fer2013.
https://stackoverflow.com/questions/43416114/how-to-convert-images-to-pixels-values-and-store-them-in-a-text-file
from PIL import Image
import numpy as np
im = Image.open('a.png')
pixels = list(im.getdata())
width, height = im.size
pixels = [pixels[i * width:(i + 1) * width] for i in xrange(height)]
np.savetxt("pixel_data.txt", pixels, fmt='%d', delimiter=" ")
But I do not see that data in fer2013.csv in pixcel_data.txt
What is the format of data in fer2013 and how do I convert pixcel data same as fer2013 from JPG image?
from PIL import Image
import numpy as np
im = Image.open('Training/0/Training_10007474.jpg')
pixels = list(im.getdata())
width, height = im.size
pixels = [pixels[i * width:(i + 1) * width] for i in range(height)]
print(pixels)
#np.savetxt("Training_10007474.txt", pixels, delimiter=" ")
np.savetxt('Training_10007474.txt', pixels, fmt='%d', delimiter=" ")
I do not see any pixels values combination in fer2013.csv
How do I create from my own jpg to pixcl same as fer2013 training data?