Giter Club home page Giter Club logo

emotion-recognition-neural-networks's People

Contributors

2around avatar arierobbert avatar isseu avatar justinshenk avatar mmoiozo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emotion-recognition-neural-networks's Issues

ValueError: Cannot feed value of shape (48, 48, 1) for Tensor u'InputData/X:0', which has shape '(?, 48, 48, 1)'

first i was working on tensorflow version 1.7 but now i upgraded it to 1.10 still getting error:-
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tflearn/initializations.py:119: UniformUnitScaling.init (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tflearn/objectives.py:66: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead

I had already reshaped using( image = image.reshape([-1, SIZE_FACE, SIZE_FACE, 1])
print(image.shape))and getting output(1,48,48,1)but after it when it goes to model.predict it raises the error :- Cannot feed value of shape (48, 48, 1) for Tensor u'InputData/X:0', which has shape '(?, 48, 48, 1)'

using these-
absl-py==0.2.0
astor==0.6.2
bleach==1.5.0
gast==0.2.0
grpcio==1.11.0
html5lib==0.9999999
Keras==2.1.5
Markdown==2.6.11
numpy==1.14.2
opencv-python==3.4.0.12
pandas==0.22.0
Pillow==5.1.0
protobuf==3.5.2.post1
python-dateutil==2.7.2
pytz==2018.4
PyYAML==3.12
scikit-learn==0.19.1
scipy==1.0.1
six==1.11.0
sklearn==0.0
tensorboard==1.7.0
tensorflow==1.7.0
termcolor==1.1.0
tflearn==0.3.2
Werkzeug==0.14.1

Error when running cvs_to_numpy.py

I am using an Ubuntu 16.04 Docker with python 3.5. Also tried it with python 3.6.

Traceback (most recent call last):
  File "/home/admin/emotion/emotion-recognition-neural-networks/lib/python3.5/site-packages/pandas/core/indexes/base.py", line 2566, in get_value
    return libts.get_value_box(s, key)
  File "pandas/_libs/tslib.pyx", line 1017, in pandas._libs.tslib.get_value_box
  File "pandas/_libs/tslib.pyx", line 1025, in pandas._libs.tslib.get_value_box
TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "cvs_to_numpy.py", line 76, in <module>
    emotion = emotion_to_vec(row['emotion'])
  File "/home/admin/emotion/emotion-recognition-neural-networks/lib/python3.5/site-packages/pandas/core/series.py", line 623, in __getitem__
    result = self.index.get_value(self, key)
  File "/home/admin/emotion/emotion-recognition-neural-networks/lib/python3.5/site-packages/pandas/core/indexes/base.py", line 2574, in get_value
    raise e1
  File "/home/admin/emotion/emotion-recognition-neural-networks/lib/python3.5/site-packages/pandas/core/indexes/base.py", line 2560, in get_value
    tz=getattr(series.dtype, 'tz', None))
  File "pandas/_libs/index.pyx", line 83, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 91, in pandas._libs.index.IndexEngine.get_value
  File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'emotion'

Help - Dataset Access

Hello,

I'm testing your code.
But I stopped initially in obtaining the
fer2013 dataset

I already signed up for kagler but I did not find this dataset.

Do you have a link that helps me find it?

Test and validate files

I ran the cvs_to_numpy.py file and now I have the data_kike.npy and labels_kike.npy files. However, I cant find the files for validation. If i'm not wrong then these files are fro training. How can i generate the validation files?

Requirements.txt

Is it possible for someone to create a requirements.txt using pip freeze? It would make things easier because some of the code is dependant on specific version of the modules.

Already trained model

Hi! Can anybody provide an already trained model through an external link. This will save a lot of time as my system lacks a GPU as of now.

IndexError: index 21761 is out of bounds for axis 0 with size 10809 during training

I have process the image using cvs_to_numpy, then when i try to train the following error appears:

Run id: expression_detection
Log directory: /tmp/tflearn_logs/

Training samples: 32427
Validation samples: 9495

Exception in thread Thread-3:
Traceback (most recent call last):
File "E:\AnacondaInstaller\envs\ML_learn\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "E:\AnacondaInstaller\envs\ML_learn\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "E:\AnacondaInstaller\envs\ML_learn\lib\site-packages\tflearn\data_flow.py", line 187, in fill_feed_dict_queue
data = self.retrieve_data(batch_ids)
File "E:\AnacondaInstaller\envs\ML_learn\lib\site-packages\tflearn\data_flow.py", line 222, in retrieve_data
utils.slice_array(self.feed_dict[key], batch_ids)
File "E:\AnacondaInstaller\envs\ML_learn\lib\site-packages\tflearn\utils.py", line 187, in slice_array
return X[start]
IndexError: index 21761 is out of bounds for axis 0 with size 10809

Can someone guide me in this issue?

Problems in training data/test data

Hi, I have an issue with the training data.
cvs_to_numpy.py outputs 'labels_kike.npy' and 'data_kike.npy', where the emotion_recognition.py searches for 'data_set_fer2013.npy' and 'data_labels_fer2013.npy' while training and cannot find it.
Also using poc, I guess it cannot find the image instead of the faces. I get the error message:

AttributeError: 'NoneType' object has no attribute 'shape'

Can you help with these?

Validating Model

First of all, thank you for providing this model! I am working on a term project for a computational neuroscience course and wanted to study biases in emotion detector nets-- and your model seems like a good starting point for my research. Now onto my issue..

I want to test the model's accuracy against the JEFFE and FER2013 validation image sets. Can I pass in images (.png format) to be manually classified? I was able to successfully train the model using the FER2013 dataset, but I don't understand how to validate the model's accuracy.

I am fairly new at machine learning and just starting out with TF/TFLearn/OpenCV-- so thank you for the help!

why my predict always are angry

I'm sorry,I train the network of fer2013,then I use the pro to predict my picture and my video.But In my screen, it's always tell me its angry, although the pciture is not right emothion's picture.
So, please help me.

emotion result varies between 2 iteration for the same image

Hi,

I did a small modification to make poc.py read from an image file instead of continuous video capture. However I got different result each time I predict the same image. i.e.

frame = cv2.imread('test.jpg')

# Predict result with network
result = network.predict(format_image(frame))
print([ '%.2f' % i for i in result[0] ])

The results are as below:

['0.13', '0.17', '0.13', '0.17', '0.13', '0.17', '0.11']
['0.09', '0.22', '0.16', '0.15', '0.13', '0.13', '0.12']
...

Is this expected or I did something wrong?

Thanks,
-yi

Indentation error

File "C:\Users\Akshay\Desktop\New folder\true\emotion-recognition-neural-networks-master\poc.py", line 75
for c in range(0, 3):
^
IndentationError: unexpected indent

does not recognize

trained 400 epochs, tried only 3 emotions, but the network still does not want to recognize anything. Shows one emotion, how not to bite the columns only move a little, the main emotion does not change

Bug in the dataset_loader.py file

Hi @isseu ,
There are two mistakes in the dataset_loader.py file. I wonder if you need to revise them.
See Line 17 and Line 19.
I think they should be changed to:
self._images_test = self._images_test .reshape([-1, SIZE_FACE, SIZE_FACE, 1])
self._labels_test = self._labels_test .reshape([-1, len(EMOTIONS)])

cvs_to_numpy

[ INFO:0] Initialize OpenCL runtime...
Traceback (most recent call last):
File "cvs_to_numpy.py", line 72, in
image = data_to_image(row['pixels'])
File "cvs_to_numpy.py", line 60, in data_to_image
data_image = format_image(data_image)
File "cvs_to_numpy.py", line 43, in format_image
print %image.shape
TypeError: unsupported operand type(s) for %: 'builtin_function_or_method' and 'tuple'

Code is not working with new tensorflow 1.0

Hi,
Good Job in developing this great app using tensorflow; but I tried to run it using the new tensorflow release 1.00 but I have a lot of errors . what version this code work with

**Error **
hdf5 not supported (please install/reinstall h5py)
Scipy not supported!
[+] Building CNN
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 491, in apply_op
preferred_dtype=default_dtype)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 716, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 176, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 169, in constant
attrs={"value": tensor_value, "dtype": dtype_value}, name=name).outputs[0]
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2395, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1220, in init
raise ValueError("'%s' is not a valid node name" % node_def.name)
ValueError: '-_Loss/tags' is not a valid node name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "emotion_recognition.py", line 101, in
import poc
File "C:\Users\Mohamed\Desktop\Capstone Project\emotion-recognition-neural-networks-master\poc.py", line 46, in
network.build_network()
File "C:\Users\Mohamed\Desktop\Capstone Project\emotion-recognition-neural-networks-master\emotion_recognition.py", line 42, in build_network
tensorboard_verbose = 2
File "C:\Program Files\Python35\lib\site-packages\tflearn\models\dnn.py", line 57, in init
session=session)
File "C:\Program Files\Python35\lib\site-packages\tflearn\helpers\trainer.py", line 111, in init
clip_gradients)
File "C:\Program Files\Python35\lib\site-packages\tflearn\helpers\trainer.py", line 561, in initialize_training_ops
ema_num_updates=self.training_steps)
File "C:\Program Files\Python35\lib\site-packages\tflearn\summaries.py", line 243, in add_loss_summaries
summaries_collection_key)
File "C:\Program Files\Python35\lib\site-packages\tflearn\summaries.py", line 46, in get_summary
summ = tf.summary.scalar(tag, value)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\summary\summary.py", line 120, in scalar
tags=scope.rstrip('/'), values=tensor, name=scope)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 281, in _scalar_summary
name=name)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 504, in apply_op
values, as_ref=input_arg.is_ref).dtype.name
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 716, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 176, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\constant_op.py", line 169, in constant
attrs={"value": tensor_value, "dtype": dtype_value}, name=name).outputs[0]
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2395, in create_op
original_op=self._default_original_op, op_def=op_def)
File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1220, in init
raise ValueError("'%s' is not a valid node name" % node_def.name)
ValueError: '-_Loss/Const' is not a valid node name

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[18432,3072]

hdf5 is not supported on this machine (please install/reinstall h5py for optimal experience)
Scipy not supported!
[+] Building CNN
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tflearn/initializations.py:119: init (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tflearn/objectives.py:66: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
2018-06-09 09:37:52.181904: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:37:53.283209: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:37:53.642209: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:37:54.366458: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:37:54.729838: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:37:54.736810: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:38:08.227552: W tensorflow/core/framework/allocator.cc:101] Allocation of 226492416 exceeds 10% of system memory.
2018-06-09 09:38:08.369418: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at assign_op.h:112 : Resource exhausted: OOM when allocating tensor with shape[18432,3072] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu
Traceback (most recent call last):
File "emotion_recognition.py", line 97, in
import poc
File "/home/pi/EmotionReceiptMusic/poc.py", line 66, in
network.build_network()
File "/home/pi/EmotionReceiptMusic/emotion_recognition.py", line 39, in build_network
tensorboard_verbose = 2
File "/usr/local/lib/python2.7/dist-packages/tflearn/models/dnn.py", line 65, in init
best_val_accuracy=best_val_accuracy)
File "/usr/local/lib/python2.7/dist-packages/tflearn/helpers/trainer.py", line 170, in init
self.session.run(init)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[18432,3072] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu
[[Node: FullyConnected/W/Assign = Assign[T=DT_FLOAT, use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected/W, FullyConnected/W/Initializer/truncated_normal)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

Caused by op u'FullyConnected/W/Assign', defined at:
File "emotion_recognition.py", line 97, in
import poc
File "/home/pi/EmotionReceiptMusic/poc.py", line 66, in
network.build_network()
File "/home/pi/EmotionReceiptMusic/emotion_recognition.py", line 30, in build_network
self.network = fully_connected(self.network, 3072, activation = 'relu')
File "/usr/local/lib/python2.7/dist-packages/tflearn/layers/core.py", line 157, in fully_connected
restore=restore)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 183, in func_with_args
return func(*args, **current_args)
File "/usr/local/lib/python2.7/dist-packages/tflearn/variables.py", line 65, in variable
validate_shape=validate_shape)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1317, in get_variable
constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 1079, in get_variable
constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 425, in get_variable
constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 394, in _true_getter
use_resource=use_resource, constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 786, in _get_single_variable
use_resource=use_resource)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 2220, in variable
use_resource=use_resource)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 2210, in
previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.py", line 2193, in default_variable_creator
constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 235, in init
constraint=constraint)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 387, in _init_from_args
validate_shape=validate_shape).op
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 283, in assign
validate_shape=validate_shape)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
use_locking=use_locking, name=name)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/pi/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[18432,3072] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu
[[Node: FullyConnected/W/Assign = Assign[T=DT_FLOAT, use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected/W, FullyConnected/W/Initializer/truncated_normal)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

===============================================================
What should i do? Please help me...

OpenCV Error

Hi,
I am trying to implement Emotion recognition using DNN with TensorFlow. And i have successfully trained the model using the data as mentioned.

But when i try to run this
$ python emotion_recognition.py poc
I am getting below error :

[+] Building CNN
2017-06-19 17:18:55.833946: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-19 17:18:55.833974: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-19 17:18:55.833991: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /Users/travis/build/skvark/opencv-python/opencv/modules/highgui/src/window.cpp, line 583
Traceback (most recent call last):
  File "emotion_recognition.py", line 101, in <module>
    import poc
  File "/Users/krishna/tf_emotion_recogn/poc.py", line 80, in <module>
    cv2.imshow('Video', frame)
cv2.error: /Users/travis/build/skvark/opencv-python/opencv/modules/highgui/src/window.cpp:583: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage```

OpenCV library version is
```opencv-python==3.2.0.7```

Operating system
```OS X EI Capitan 10.11.6 ```

Any help would be appreciated
Thanks

License

Hello Enrique (@isseu),
May I use parts of your project in a demo? I like the emoticon display and would use it for my model, with credit to you of course. If you can add a license (eg, MIT) then I will happily include a reference to your code in my project.

Weights

How to find your pre-trained weights? , please upload it...

Draw face in frame not worked

there are "Unresolved referenced 'faces'"

how can i resolve it?

Draw face in frame

for (x,y,w,h) in faces:
cv2.rectangle(frame, (x,y), (x+w,y+h), (255,0,0), 2)

something about the padding="same" or "valid"

Thanks for you code, it helps me to learn how to emotion recognition.
But when I read your code,there is something I can't understand.
In the paper inside your repo,I find that it use a "valid" padding so the image shape is
[4848]->[4444]->[2222]->.....->3072
while in your code it is that:
[48
48]->[4848]->[2424]->......->3072
I can't understand this.Can you tell me why?Thanks very much

No module named constants

File "cvs_to_numpy.py", line 1, in
from constants import *
ImportError: No module named constants

error in the first import statement of the file cvs_to_numpy.py.

Any idea what to do?

Conversion error

Im getting the following error while conversion

File "cvs_to_numpy.py", line 71, in <module>
    image = data_to_image(row['pixels'])
  File "cvs_to_numpy.py", line 59, in data_to_image
    data_image = format_image(data_image)
  File "cvs_to_numpy.py", line 16, in format_image
    gray_border[((150 / 2) - (SIZE_FACE/2)):((150/2)+(SIZE_FACE/2)), ((150/2)-(SIZE_FACE/2)):((150/2)+(SIZE_FACE/2))] = image
TypeError: slice indices must be integers or None or have an __index__ method

Issue with python emotion_recognition.py train

Hey,

I'm trying to replicate the training process. I ran the cvs_to_numpy.py script and have the data_kike.npy and labels_kike.npy files within the data folder. When I run python emotion_recognition.py I get "IOError: [Errno 2] No such file or directory: './data/data_set_fer2013.npy'".

How do I go about getting that file/the other files in the constants.py.

How to solve the problem about data_set_fer2013.npy etc.

When we run the csv_to_numpy.py,it will output two files which are the data_kike.npy and labels_kike.npy.
But we dont need these files. So, we should output:
data_set_fer2013.npy
data_labels_fer2013.npy
test_set_fer2013.npy
test_labels_fer2013.npy

  1. we open file which name is fer2013.csv, we will found the Usage have three type:
    Training(this is train set)
    PublicTest(this is test set)
    PrivateTest(not used)

  2. we should change our code as below:
    Usage = row['Usage']
    if image is not None:
    print(Usage)
    if Usage == "Training":
    labels.append(emotion)
    images.append(image)
    index_set += 1
    elif Usage == "PublicTest":
    labels_test.append(emotion)
    images_test.append(image)
    index_test += 1
    then we will get four data:
    labels
    images
    labels_test
    images_test
    then we can save it:
    np.save('data_set_fer2013.npy', images)
    np.save('data_labels_fer2013.npy', labels)
    np.save('test_set_fer2013.npy', images_test)
    np.save('test_labels_fer2013.npy', labels_test)

  3. we also to change the code:
    self._images_test = self._images.reshape([-1, SIZE_FACE, SIZE_FACE, 1])
    self._labels_test = self._labels.reshape([-1, len(EMOTIONS)])
    change the code that we need:
    self._labels_test = self._labels_test.reshape([-1, len(EMOTIONS)])
    self._labels_test = self._labels_test.reshape([-1, len(EMOTIONS)])

at last,thanks
atulapra #17
dearhoper #6

plot_emotion_matrix.py 'PolyCollection' has no attributes 'get_axes()'

Hi. When I run the plot_emotion_matrix.py, I find an error: AttributeError: 'PolyCollection' object has no attribute 'get_axes'. Below is the function concerning the error. I am wondering how to solve it
def show_values(pc, fmt="%.2f", **kw):
#from itertools import zip
pc.update_scalarmappable()
ax = pc.get_axes()

'numpy.ndarray' object has no attribute 'index' ??

face_image = feelings_faces[result[0].index(max(result[0]))]
AttributeError: 'numpy.ndarray' object has no attribute 'index'

is the error I get after the webcam loads then just crashes, when i debug the code in spyder the feelings_faces and results both have values in their arrays

No Proper 'Confusion Matrix'

I have successfully trained and validated. But, When I run plot_emotion_matrix, I get an improper Confusion Matrix.. It shows Values only for One 'predicted Emotion' column.
cnf_matx_angry

Could I get an Information, what is the Problem and the ways to solve it?

cvs_to_numpy.py Index Error

I get the following error on running the file

d[x] = 1.0
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Load model

After training, four files are created.

  1. model_1_nimish.index
  2. model_1_nimish.meta
  3. model_1_nimish.data00000-of-00001
  4. checkpoint
    Which is the file that holds the trained weights? Also, I have trained it on my friend's PC and I want to use it on my own machine. What all files will I have to copy from my friend's PC?

Issue on training

Hello, I was trying to use this app as a base to understand how to make my own emotion recognition software, but the training part seems kind of unexplained. I downloaded the .csv and tried to run the training, but the program didnt seem to find the the file.

Can you please clarify this, or give a more in depth explanation?

Thanks.

Cannot convert CSV to NPY

I am unable to run cvs_to_numpy.py in python 3.6.3 as it throws an error:
Traceback (most recent call last):
File "cvs_to_numpy.py", line 7, in <module>
cascade_classifier = cv2.CascadeClassifier(CASC_PATH)
NameError: name 'CASC_PATH' is not defined

Is trained network available

I have a dekstop with no GPU, so training take a lot of time, Do you have the network you trained to be able to run the code

thanks

error while parsing dataset

while running cvs_to_numpy.py I encountered this error. Can someone help me with it?

for index, row in data.iterrows():
emotion = emotion_to_vec(row['emotion'])
image = data_to_image(row['pixels'])
if image is not None:
labels.append(emotion)
images.append(image)
#labels.append(emotion)
#images.append(flip_image(image))
else:
print "Error"
index += 1
print "Progreso: {}/{} {:.2f}%".format(index, total, index * 100.0 / total)

inside this for loop I don't understand why execution goes into this else case. Because of this else case error is occurring while data parsing

(48, 48)
Progreso: 1/35887 0.00%
Error
Progreso: 2/35887 0.01%
(48, 48)
Progreso: 3/35887 0.01%
Error
Progreso: 4/35887 0.01%
(48, 48)
Progreso: 5/35887 0.01%
(48, 48)
Progreso: 6/35887 0.02%
Error
Progreso: 7/35887 0.02%
(48, 48)
Progreso: 8/35887 0.02%
(48, 48)
Progreso: 9/35887 0.03%
(48, 48)
Progreso: 10/35887 0.03%
(48, 48)
Progreso: 11/35887 0.03%
Error
Progreso: 12/35887 0.03%
Error
Progreso: 13/35887 0.04%
Error
Progreso: 14/35887 0.04%
(48, 48)
Progreso: 15/35887 0.04%
(48, 48)
Progreso: 16/35887 0.04%
Error
Progreso: 17/35887 0.05%
Error
Progreso: 18/35887 0.05%
Error
Progreso: 19/35887 0.05%
Error
Progreso: 20/35887 0.06%
Error
Progreso: 21/35887 0.06%
Error
Progreso: 22/35887 0.06%
(48, 48)
Progreso: 23/35887 0.06%
Error
Progreso: 24/35887 0.07%
Error
Progreso: 25/35887 0.07%
(48, 48)
Progreso: 26/35887 0.07%
Error
Progreso: 27/35887 0.08%
Error
Progreso: 28/35887 0.08%
Error
Progreso: 29/35887 0.08%
Error
Progreso: 30/35887 0.08%
(48, 48)
Progreso: 31/35887 0.09%
Error
Progreso: 32/35887 0.09%
Error
Progreso: 33/35887 0.09%
(48, 48)
Progreso: 34/35887 0.09%
Error
Progreso: 35/35887 0.10%
(48, 48)
Progreso: 36/35887 0.10%
(48, 48)
Progreso: 37/35887 0.10%
(48, 48)
Progreso: 38/35887 0.11%
(48, 48)
Progreso: 39/35887 0.11%
Error
Progreso: 40/35887 0.11%
(48, 48)
Progreso: 41/35887 0.11%
(48, 48)
Progreso: 42/35887 0.12%
Error

Unable to slice using numpy indices in cvs_to_numpy.py

Traceback (most recent call last):
File "cvs_to_numpy.py", line 71, in
image = data_to_image(row['pixels'])
File "cvs_to_numpy.py", line 59, in data_to_image
data_image = format_image(data_image)
File "cvs_to_numpy.py", line 16, in format_image
gray_border[((150 / 2) - (SIZE_FACE/2)):((150/2)+(SIZE_FACE/2)), ((150/2)-(SIZE_FACE/2)):((150/2)+(SIZE_FACE/2))] = image
TypeError: slice indices must be integers or None or have an index `method

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.