akshaybahadur21 / Emojinator

A simple emoji classifier for humans. 🖖
MIT License
501 stars 190 forks source link

Please Help #10

Closed saransh808 closed 5 years ago

saransh808 commented 5 years ago

I am using Terminal for all python programming. successfully executed first 2 files but ran into an error when tried running "TrainEmojinator.py". This is the error I encountered. Please Help.

screenshot 2018-12-02 at 1 56 36 am

Using TensorFlow backend. number of training examples = 1199 number of test examples = 0 X_train shape: (1199, 2500) Y_train shape: (1, 1199) X_test shape: (0, 2500) Y_test shape: (1, 0) Traceback (most recent call last): File "TrainEmojinator.py", line 82, in main() File "TrainEmojinator.py", line 63, in main train_y = np_utils.to_categorical(Y_train) File "/Users/Saransh/anaconda2/lib/python2.7/site-packages/keras/utils/np_utils.py", line 23, in to_categorical y = np.array(y, dtype='int') ValueError: invalid literal for long() with base 10: 'es/1'

samrudh commented 5 years ago

I also faced similar issues. I believe that is because folder name was changed later to 'gestures'. Last 2 characters of the folder name viz. 'es' are appearing in csv. As a workaround, you can replace those with respective number in csv file 'train_foo.csv' manually. For eg. es/1 -> 1, es/2 -> 2 and so on

saransh808 commented 5 years ago
X_train = X[0:12000, :]
    X_train = X_train / 255.
    X_test = X[12000:13201, :]
    X_test = X_test / 255.

    # Reshape
    Y = Y.reshape(Y.shape[0], 1)
    Y_train = Y[0:12000, :]
    Y_train = Y_train.T
    Y_test = Y[12000:13201, :]
    Y_test = Y_test.T

This part of the code in

TrainEmojinator.py

as defined by

akshaybahadur21

has fixed number of rows in the CSV file. basically it is working with 12 Emojis, and also you are forced to have 1200 images for each gesture. In gestures folder, we create another folder <int> (Ex: /gesture/1/)to create 1200 images of each gesture in that folder.

So, actually I modified the code to work with just 100 images for each gesture, but forgot to modify the file code mentioned above. Hence, the original error I faced above was solved when I again modified the CreateGest.py file to take 1200 photos for each gesture, also you have to create all the 12 gestures to be able to successfully execute the file TrainEmojinator.py.

Since each gesture of 1200 images takes approximately 1 min to capture, I am going to modify every thing to work for just 200-300 images for each gesture since I am going to use this project to make a gesture recognition for English Sign language, so there I need to work with 26 gestures instead of 12.

saransh808 commented 5 years ago

I also faced similar issues. I believe that is because folder name was changed later to 'gestures'. Last 2 characters of the folder name viz. 'es' are appearing in csv. As a workaround, you can replace those with respective number in csv file 'train_foo.csv' manually. For eg. es/1 -> 1, es/2 -> 2 and so on

X_train = X[0:12000, :]
    X_train = X_train / 255.
    X_test = X[12000:13201, :]
    X_test = X_test / 255.

    # Reshape
    Y = Y.reshape(Y.shape[0], 1)
    Y_train = Y[0:12000, :]
    Y_train = Y_train.T
    Y_test = Y[12000:13201, :]
    Y_test = Y_test.T

This part of the code in

TrainEmojinator.py

as defined by

akshaybahadur21

has fixed number of rows in the CSV file. basically it is working with 12 Emojis, and also you are forced to have 1200 images for each gesture. In gestures folder, we create another folder <int> (Ex: /gesture/1/)to create 1200 images of each gesture in that folder.

So, actually I modified the code to work with just 100 images for each gesture, but forgot to modify the file code mentioned above. Hence, the original error I faced above was solved when I again modified the CreateGest.py file to take 1200 photos for each gesture, also you have to create all the 12 gestures to be able to successfully execute the file TrainEmojinator.py.

Since each gesture of 1200 images takes approximately 1 min to capture, I am going to modify every thing to work for just 200-300 images for each gesture since I am going to use this project to make a gesture recognition for English Sign language, so there I need to work with 26 gestures instead of 12.