aqeelanwar / DRLwithTL_real

Python code for Deep Reinforcement Learning with Transfer Learning in aReal Environment using DJI Tello
MIT License
68 stars 18 forks source link

Automatic mode error #10

Closed haesungjeong closed 3 years ago

haesungjeong commented 4 years ago

Hi Aqeel, thanks for sharing the code and the paper. But I have a little problem here. When I press 'M' to toggle from 'manual' to 'automatic', this error occured. I cannot find any solution to solve this..

+m ------------- Error ------------- <class 'tensorflow.python.framework.errors_impl.FailedPreconditionError'> main_code.py 132 Attempting to use uninitialized value layer16x_br1_BN/mean [[node layer16x_br1_BN/mean/read (defined at C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]

Original stack trace for 'layer16x_br1_BN/mean/read': File "main_code.py", line 67, in DepthAgent = heat_map() File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map.py", line 18, in init self.net = ResNet50UpProj({'data': self.input_node}, batch_size, 1, False) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 72, in init self.setup() File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map.py", line 266, in setup .up_project([3, 3, 128, 64], id = '16x', stride = 1, BN=True) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 358, in up_project out = self.unpool_as_conv(size, input_data, id_br1, stride, ReLU=True, BN=True) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 340, in unpool_as_conv self.batch_normalization(name=layerName, scale_offset=True, relu=False) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 47, in layer_decorated layer_output = op(self, layer_input, *args, kwargs) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 263, in batch_normalization pop_mean = tf.get_variable("mean", shape, initializer=tf.constant_initializer(0.0), trainable=False) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1500, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1243, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 567, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 519, in _true_getter aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 933, in _get_single_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 258, in call return cls._variable_v1_call(*args, kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 219, in _variable_v1_call shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 197, in previous_getter = lambda kwargs: default_variable_creator(None, *kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 2519, in default_variable_creator shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 262, in call return super(VariableMetaclass, cls).call(args, kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 1688, in init shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 1872, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper return target(*args, *kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 203, in identity ret = gen_array_ops.identity(input, name=name) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\gen_array_ops.py", line 4239, in identity "Identity", input=input, name=name) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func return func(args, **kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op attrs, op_def, compute_device) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal op_def=op_def) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

Traceback (most recent call last): File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call return fn(*args) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn target_list, run_metadata) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value layer16x_br1_BN/mean [[{{node layer16x_br1_BN/mean/read}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main_code.py", line 132, in depth_map_3D, depth_float_2D, global_depth = DepthAgent.depth_map_gen(frame) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map.py", line 41, in depth_map_gen pred = self.sess.run(self.net.get_output(), feed_dict={self.input_node: img}) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 956, in run run_metadata_ptr) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\client\session.py", line 1359, in _do_run run_metadata) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\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.FailedPreconditionError: Attempting to use uninitialized value layer16x_br1_BN/mean [[node layer16x_br1_BN/mean/read (defined at C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]

Original stack trace for 'layer16x_br1_BN/mean/read': File "main_code.py", line 67, in DepthAgent = heat_map() File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map.py", line 18, in init self.net = ResNet50UpProj({'data': self.input_node}, batch_size, 1, False) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 72, in init self.setup() File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map.py", line 266, in setup .up_project([3, 3, 128, 64], id = '16x', stride = 1, BN=True) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 358, in up_project out = self.unpool_as_conv(size, input_data, id_br1, stride, ReLU=True, BN=True) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 340, in unpool_as_conv self.batch_normalization(name=layerName, scale_offset=True, relu=False) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 47, in layer_decorated layer_output = op(self, layer_input, *args, kwargs) File "C:\Users\hshsh\OneDrive\Desktop\pedrar\DeepNet\network\heat_map_network.py", line 263, in batch_normalization pop_mean = tf.get_variable("mean", shape, initializer=tf.constant_initializer(0.0), trainable=False) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1500, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1243, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 567, in get_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 519, in _true_getter aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 933, in _get_single_variable aggregation=aggregation) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 258, in call return cls._variable_v1_call(*args, kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 219, in _variable_v1_call shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 197, in previous_getter = lambda kwargs: default_variable_creator(None, *kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 2519, in default_variable_creator shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 262, in call return super(VariableMetaclass, cls).call(args, kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 1688, in init shape=shape) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\variables.py", line 1872, in _init_from_args self._snapshot = array_ops.identity(self._variable, name="read") File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\util\dispatch.py", line 180, in wrapper return target(*args, *kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 203, in identity ret = gen_array_ops.identity(input, name=name) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\ops\gen_array_ops.py", line 4239, in identity "Identity", input=input, name=name) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func return func(args, **kwargs) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op attrs, op_def, compute_device) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal op_def=op_def) File "C:\Users\hshsh\Anaconda3\envs\hsreal\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in init self._traceback = tf_stack.extract_stack()

Landing the drone and shutting down