Closed dgai91 closed 6 years ago
Hi, I've been testing the code of test_spatial_only.py there are some errors in model
Hi, for the max pooling error, can you try to run using theano backend and see if it works? for the test_spatial_only.py, i apologize that the code is a quick script i wrote pretty in a pretty hardcoded manner. its usage is to test how well the vgg itself in classifying emotion, without the use of lstm. or can you specify the error on the test_spatial_only so that i can help?
for replicating our work in single db, you can run this
python main.py --dB 'CASME2_Optical' --batch_size=1 --spatial_epochs=100 --temporal_epochs=100 --train_id='default_test' --spatial_size=224 --flag='st'
or you can refer to the documentation below.
I'd found the cause of these error. Because of the channel whether first
Oh. great. Any further issues please do not hesitate to msg me. :)
so kind of you :)
sorry for bother you this time. when I run main.py there is 2 strange error. the error is ValueError: cannot reshape array of size 373309440 into shape (2232,224,224,3) This error is raised because of the timestep_tim=9. if I change timestep_tim=10 there is a new error: ValueError: Input arrays should have the same number of samples as target arrays. Found 2480 input samples and 2370 target samples.
to clarify, timestep_tim = 9 is because optical_flow_image and optical_strain_image is taking displacement/derivative of the 10 original frames. Are you training on optical_image or the grayscale image? What is the db name you are using?
btw, just asking, are you from MEGC?
emmm.... no.I am a NLP researcher in a CN U. my db is CASME2_Optical
btw, do you know Detriot: Become human :)
Nope.
Do you have this line in your code?
listOfIgnoredSamples, IgnoredSamples_index = ignore_casme_samples(db_path, list_db)
elif db_name == 'CASME2_Optical':
print("arrived")
table = loading_casme_table(db_home + 'CASME2_label_Ver_2.xls')
listOfIgnoredSamples, IgnoredSamples_index = ignore_casme_samples(db_path, list_db)
r = w = spatial_size
subjects = 26
samples = 246
n_exp = 5
VidPerSubject = get_subfolders_num(db_images, IgnoredSamples_index)
timesteps_TIM = 10
data_dim = r * w
channel = 3
if os.path.isdir(db_home + "Classification/" + db_name + "_label.txt") == True:
os.remove(db_home + "Classification/" + db_name + "_label.txt")
is your folders named in this format for subject and video directory? eg: subject 9 and video 13_02 'sub09/EP13_02/'
yeah, the dataset has been downloaded from the url you offered, and I did not modify any thing
The error exists because the algorithm should omit some files (due to small class problem) and 11 videos should be omitted. I am confuse as well....
May I know how to do you call python main.py?
thank you all the same :) if you fix this problem, plz update this repo
Because it works on my pc. does the following works? python main.py --dB 'CASME2_Optical' --batch_size=30 --spatial_epochs=100 --temporal_epochs=100 --train_id='default_test' --spatial_size=224 --flag='st'
I can not run this code using these param but I deleted the data which should be ignored. and that worked :)
Testing started at 14:37 ... C:\ProgramData\Anaconda3\python.exe "C:\Program Files\JetBrains\PyCharm 2017.3.4\helpers\pycharm_jb_pytest_runner.py" --path C:/Users/LawLi/PycharmProjects/Micro-Expression-with-Deep-Learning-master/test_spatial_only.py Launching py.test with arguments C:/Users/LawLi/PycharmProjects/Micro-Expression-with-Deep-Learning-master/test_spatial_only.py in C:\Users\LawLi\PycharmProjects\Micro-Expression-with-Deep-Learning-master
============================= test session starts ============================= platform win32 -- Python 3.6.4, pytest-3.3.2, py-1.5.2, pluggy-0.6.0 rootdir: C:\Users\LawLi\PycharmProjects\Micro-Expression-with-Deep-Learning-master, inifile:Datasets/CASME2_TIM/CASME2_TIM/ [ 9. 13. 7. 5. 19. 5. 9. 3. 15. 14. 10. 12. 8. 4. 3. 4. 36. 3.
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
. from ._conv import register_converters as _register_converters Using TensorFlow backend.test_spatial_only.py:None (test_spatial_only.py) C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1567: in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) E tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].
During handling of the above exception, another exception occurred: test_spatial_only.py:112: in
vgg_model = VGG_16_tim(spatial_size, classes=5, channels=3)
models.py:199: in VGG_16_tim
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
C:\ProgramData\Anaconda3\lib\site-packages\keras\models.py:492: in add
output_tensor = layer(self.outputs[0])
C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py:619: in call
output = self.call(inputs, **kwargs)
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\pooling.py:158: in call
data_format=self.data_format)
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\pooling.py:221: in _pooling_function
pool_mode='max')
C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py:3657: in pool2d
data_format=tf_data_format)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py:2142: in max_pool
name=name)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py:5045: in max_pool
data_format=data_format, name=name)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py:787: in _apply_op_helper
op_def=op_def)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:3392: in create_op
op_def=op_def)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1734: in init
control_input_ops)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1570: in _create_c_op
raise ValueError(str(e))
E ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].
collected 0 items / 1 errors
=================================== ERRORS ====================================
____ ERROR collecting test_spatial_only.py ____
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1567: in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
E tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].
During handling of the above exception, another exception occurred: test_spatial_only.py:112: in
vgg_model = VGG_16_tim(spatial_size, classes=5, channels=3)
models.py:199: in VGG_16_tim
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
C:\ProgramData\Anaconda3\lib\site-packages\keras\models.py:492: in add
output_tensor = layer(self.outputs[0])
C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py:619: in call
output = self.call(inputs, **kwargs)
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\pooling.py:158: in call
data_format=self.data_format)
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\pooling.py:221: in _pooling_function
pool_mode='max')
C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py:3657: in pool2d
data_format=tf_data_format)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py:2142: in max_pool
name=name)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py:5045: in max_pool
data_format=data_format, name=name)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py:787: in _apply_op_helper
op_def=op_def)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:3392: in create_op
op_def=op_def)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1734: in init
control_input_ops)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py:1570: in _create_c_op
raise ValueError(str(e))
E ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].
------------------------------- Captured stdout -------------------------------
Datasets/CASME2_TIM/CASME2_TIM/
[ 9. 13. 7. 5. 19. 5. 9. 3. 15. 14. 10. 12. 8. 4. 3. 4. 36. 3.
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
. from ._conv import register_converters as _register_converters Using TensorFlow backend. !!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!! ========================== 1 error in 14.94 seconds =========================== Process finished with exit code 0