evaluating on OULU video frames gave an error
Opened this issue · 0 comments
JavanehBahrami commented
I extracted frames from videos in OULU dataset and then run test.py but in loop over the features the evaluation failed:
shape of items of my ALLDATA=[image_face_cat_reshaped, vertices_map_cat, mask_cat] is as below
image_face_cat.shape = (256, 256, 15)
vertices_map_cat.shape = (1, 32, 32, 3, 5)
mask_cat.shape = (1, 32, 32, 3, 5)
def officialEvalSub(txt_name, data_list, mode, path_model_now):
def realProb(logits):
#return np.exp(logits[1])/(np.exp(logits[0])+np.exp(logits[1]))
x = np.array(logits)
y = np.exp(x[0])/np.sum(np.exp(x))
#y = x[0]
return y
def name_encode(name_):
if mode == 'dev':
return name_
elif mode == 'test':
name_split = name_.split('_')
name_10 = name_split[0] + name_split[3] + name_split[1] + name_split[2]
name_16 = hex(int(name_10))
name_16 = name_16[0] + name_16[2:]
return name_16
else:
print('Error mode: requires dev or test')
exit(1)
eval_input_fn = input_fn_maker(data_list, shuffle=False,
batch_size = 1,
epoch=1)
features=mnist_classifier.predict(
input_fn=eval_input_fn,
checkpoint_path= path_model_now )
fid = open(txt_name, 'w')
fea_ind = 0
acc_mean = 0.0
video_name = None
video_score = 0.0
video_frame_count = 0.0
for feature in features:
logits = feature['logits']
'''
logits_tmp = logits[1]
logits[1] = logits[0]
logits[0] = logits_tmp
'''
labels = feature['labels']
names = feature['names']
depth_map = feature['depth_map']
masks = feature['masks']
the error:
Traceback (most recent call last):
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node __inference_Dataset_map_parser_fun_70}} Input to reshape is a tensor with 15360 values, but the requested shape has 5120
[[{{node Reshape_2}}]]
[[IteratorGetNext]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test_ref2.py", line 164, in <module>
evaluator.evaluate(is_online=FLAGS.flags.isOnline)
File "test_ref2.py", line 71, in evaluate
self.online_eval()
File "test_ref2.py", line 90, in online_eval
self.perform_evaluation(iter_now)
File "test_ref2.py", line 118, in perform_evaluation
for feature in features:
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 640, in predict
preds_evaluated = mon_sess.run(predictions)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 754, in run
run_metadata=run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 1259, in run
run_metadata=run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 1360, in run
raise six.reraise(*original_exc_info)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/six.py", line 719, in reraise
raise value
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 1345, in run
return self._sess.run(*args, **kwargs)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 1418, in run
run_metadata=run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/training/monitored_session.py", line 1176, in run
return self._sess.run(*args, **kwargs)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/javaneh/miniconda3/envs/tf1_conda_env/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 15360 values, but the requested shape has 5120
[[{{node Reshape_2}}]]
[[IteratorGetNext]]
@clks-wzz , Thanks in advance for your help