When I execute the code 'python em_model.py singleface', it occurs this error. How can I solve this error???
(cv) pi@raspberrypi:~/Emotion-detection $ python em_model.py singleface
/home/pi/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
return f(*args, **kwds)
/home/pi/.virtualenvs/cv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
return f(*args, **kwds)
/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float
to np.floating
is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type
.
from ._conv import register_converters as _register_converters
------------Emotion Detection Program------------
---> Starting Neural Network
Input data (48, 48, 1)
WARNING:tensorflow:From /home/pi/.virtualenvs/cv/local/lib/python3.5/site-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.
Conv1 (48, 48, 64)
Maxpool (24, 24, 64)
Conv2 (24, 24, 64)
Maxpool2 (12, 12, 64)
Conv3 (12, 12, 128)
Dropout (12, 12, 128)
Fully connected (3072,)
Output (4,)
WARNING:tensorflow:From /home/pi/.virtualenvs/cv/local/lib/python3.5/site-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-10-20 00:00:06.073932: W tensorflow/core/framework/allocator.cc:113] Allocation of 12288 exceeds 10% of system memory.
2018-10-20 00:00:06.098093: W tensorflow/core/framework/allocator.cc:113] Allocation of 6400 exceeds 10% of system memory.
2018-10-20 00:00:06.105248: W tensorflow/core/framework/allocator.cc:113] Allocation of 409600 exceeds 10% of system memory.
2018-10-20 00:00:06.108324: W tensorflow/core/framework/allocator.cc:113] Allocation of 524288 exceeds 10% of system memory.
2018-10-20 00:00:06.111486: W tensorflow/core/framework/allocator.cc:113] Allocation of 226492416 exceeds 10% of system memory.
Traceback (most recent call last):
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1292, in _do_call
return fn(*args)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1277, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1367, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [7]
[[{{node save_1/Assign_21}} = Assign[T=DT_FLOAT, _class=["loc:@FullyConnected_1/b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected_1/b/Momentum, save_1/RestoreV2:21)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1538, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 887, in run
run_metadata_ptr)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1110, in _run
feed_dict_tensor, options, run_metadata)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1286, in _do_run
run_metadata)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1308, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [7]
[[{{node save_1/Assign_21}} = Assign[T=DT_FLOAT, _class=["loc:@FullyConnected_1/b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected_1/b/Momentum, save_1/RestoreV2:21)]]
Caused by op 'save_1/Assign_21', defined at:
File "em_model.py", line 77, in
import singleface
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 673, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/pi/Emotion-detection/singleface.py", line 48, in
network.build_network()
File "/home/pi/Emotion-detection/em_model.py", line 50, in build_network
self.model = tflearn.DNN(self.network,checkpoint_path = 'model_1_atul',max_checkpoints = 1,tensorboard_verbose = 2)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/models/dnn.py", line 65, in init
best_val_accuracy=best_val_accuracy)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/helpers/trainer.py", line 147, in init
allow_empty=True)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1094, in init
self.build()
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1106, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1143, in _build
build_save=build_save, build_restore=build_restore)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 787, in _build_internal
restore_sequentially, reshape)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 428, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 119, in restore
self.op.get_shape().is_fully_defined())
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/ops/state_ops.py", line 221, in assign
validate_shape=validate_shape)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/ops/gen_state_ops.py", line 61, in assign
use_locking=use_locking, name=name)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3272, in create_op
op_def=op_def)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1768, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [7]
[[{{node save_1/Assign_21}} = Assign[T=DT_FLOAT, _class=["loc:@FullyConnected_1/b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected_1/b/Momentum, save_1/RestoreV2:21)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "em_model.py", line 77, in
import singleface
File "/home/pi/Emotion-detection/singleface.py", line 48, in
network.build_network()
File "/home/pi/Emotion-detection/em_model.py", line 52, in build_network
self.load_model()
File "/home/pi/Emotion-detection/em_model.py", line 68, in load_model
self.model.load("model_1_atul.tflearn")
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/models/dnn.py", line 308, in load
self.trainer.restore(model_file, weights_only, **optargs)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/helpers/trainer.py", line 490, in restore
self.restorer.restore(self.session, model_file)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1574, in restore
err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [7]
[[{{node save_1/Assign_21}} = Assign[T=DT_FLOAT, _class=["loc:@FullyConnected_1/b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected_1/b/Momentum, save_1/RestoreV2:21)]]
Caused by op 'save_1/Assign_21', defined at:
File "em_model.py", line 77, in
import singleface
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 673, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/pi/Emotion-detection/singleface.py", line 48, in
network.build_network()
File "/home/pi/Emotion-detection/em_model.py", line 50, in build_network
self.model = tflearn.DNN(self.network,checkpoint_path = 'model_1_atul',max_checkpoints = 1,tensorboard_verbose = 2)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/models/dnn.py", line 65, in init
best_val_accuracy=best_val_accuracy)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tflearn/helpers/trainer.py", line 147, in init
allow_empty=True)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1094, in init
self.build()
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1106, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1143, in _build
build_save=build_save, build_restore=build_restore)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 787, in _build_internal
restore_sequentially, reshape)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 428, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 119, in restore
self.op.get_shape().is_fully_defined())
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/ops/state_ops.py", line 221, in assign
validate_shape=validate_shape)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/ops/gen_state_ops.py", line 61, in assign
use_locking=use_locking, name=name)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3272, in create_op
op_def=op_def)
File "/home/pi/.virtualenvs/cv/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1768, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [7]
[[{{node save_1/Assign_21}} = Assign[T=DT_FLOAT, _class=["loc:@FullyConnected_1/b"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](FullyConnected_1/b/Momentum, save_1/RestoreV2:21)]]