Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I create training data with fer2013 format #138

Open
takeofuture opened this issue May 7, 2020 · 0 comments
Open

How do I create training data with fer2013 format #138

takeofuture opened this issue May 7, 2020 · 0 comments

Comments

@takeofuture
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant