thoughtworksarts / EmoPy

A deep neural net toolkit for emotion analysis via Facial Expression Recognition (FER)
https://thoughtworksarts.io/blog/emopy-emotional-expression-toolkit/
GNU Affero General Public License v3.0
919 stars 264 forks source link

ConvolutionalNN prediction #70

Open SaakshiNarula opened 3 years ago

SaakshiNarula commented 3 years ago

image

Hi I was just trying to run /examples/convolutional_model.py using the sample images you have provided. I have 2 questions around that-

1) I am not sure I understand how you generate input for the CNN but regardless of that, I have a question about train-test split. You train the model on train_images and use test_images for validation...Shouldn't there be a validation set for validation and the test_images be used for prediction?

2) I was also trying to predict output on a single test image as marked in the image. But I get this error below, and I am guessing is not the way to input to the CNN here, could you guide me on how i can do this?

image

Aronja commented 3 years ago

Hi @SaakshiNarula, thanks for your questions

  1. This seems to be badly named, the test images are actually only used for validation but not for testing. You're right that you shouldn't use the same images to testing and validation. If you would like to test the model you would have to use your own test data and split the test data into three parts (train, validation and test set) prior to training the model.

  2. It seems like you're using a too new tensorflow version. Please make sure that you're using the versions defined in the requirements.txt, I'm attaching a pip freeze that's working.

You'll need to use Python 3.6.6 and install the deps using pip install -r requirements.txt (please refer to the README.md for more details) Please also pull the newest version of Emopy as we updated some dependencies recently

Aronja commented 3 years ago

absl-py==0.11.0 astor==0.8.1 attrs==20.3.0 cachetools==4.1.1 certifi==2020.11.8 chardet==3.0.4 coverage==4.5.3 cycler==0.10.0 decorator==4.4.2 -e git+git@github.com:thoughtworksarts/EmoPy.git@037b26afc92c5f9d36262c41902c6012796c157b#egg=EmoPy gast==0.2.2 google-auth==1.23.0 google-auth-oauthlib==0.4.2 google-pasta==0.2.0 graphviz==0.15 grpcio==1.33.2 h5py==2.10.0 idna==2.10 importlib-metadata==3.1.0 iniconfig==1.1.1 joblib==0.17.0 Keras==2.2.4 Keras-Applications==1.0.8 Keras-Preprocessing==1.1.2 kiwisolver==1.3.1 Lasagne==0.1 Markdown==3.3.3 matplotlib==3.3.3 mock==4.0.2 networkx==2.5 numpy==1.17.4 oauthlib==3.1.0 opencv-python==4.4.0.46 opt-einsum==3.3.0 packaging==20.4 Pillow==8.0.1 pluggy==0.13.1 protobuf==3.14.0 py==1.9.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pydot==1.4.1 pyparsing==2.4.7 pytest==6.1.2 python-dateutil==2.8.1 PyWavelets==1.1.1 PyYAML==5.3.1 requests==2.25.0 requests-oauthlib==1.3.0 rsa==4.6 scikit-image==0.13.1 scikit-learn==0.23.2 scikit-neuralnetwork==0.7 scipy==1.0.0 six==1.15.0 tensorboard==1.13.1 tensorflow==1.13.1 tensorflow-estimator==1.13.0 termcolor==1.1.0 Theano==1.0.5 threadpoolctl==2.1.0 toml==0.10.2 urllib3==1.26.2 Werkzeug==1.0.1 wrapt==1.12.1 zipp==3.4.0