jinyu121 / DW2TF

Darknet Weights to TensorFlow
GNU General Public License v3.0
219 stars 73 forks source link

TypeError: Expected Tensor's shape: (1,), got (). #41

Open AntoineGerardeaux opened 5 years ago

AntoineGerardeaux commented 5 years ago

Hi, i try to convert custom YOLOv3 weights and cfg but i failled, can someone help me ? Thanks in advence.

68 Tensor("yolov3/convolutional48/Activation:0", shape=(?, 13, 13, 1024), dtype=float32) 69 Tensor("yolov3/shortcut21:0", shape=(?, 13, 13, 1024), dtype=float32) Traceback (most recent call last): File "main.py", line 116, in main(args) File "main.py", line 57, in main parse_net(args.layers, args.cfg, args.weights, args.training) File "main.py", line 33, in parse_net training=training, const_inits=const_inits, verbose=verbose) File "/home/linux/Bureau/DW2TF/util/cfg_layer.py", line 198, in get_cfg_layer layer = _cfg_layer_dict.get(layer_name, cfg_ignore)(B, H, W, C, net, param, weights_walker, stack, output_index, scope, training, const_inits, verbose) File "/home/linux/Bureau/DW2TF/util/cfg_layer.py", line 93, in cfg_convolutional net = tf.layers.batch_normalization(net, name=scope+'/BatchNorm', batch_norm_args) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, *kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/layers/normalization.py", line 327, in batch_normalization return layer.apply(inputs, training=training) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1479, in apply return self.call(inputs, args, kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 537, in call outputs = super(Layer, self).call(inputs, *args, kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 591, in call self._maybe_build(inputs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1881, in _maybe_build self.build(input_shapes) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/keras/layers/normalization.py", line 358, in build experimental_autocast=False) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 450, in add_weight kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 384, in add_weight aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 663, in _add_variable_with_custom_getter kwargs_for_getter) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1496, in get_variable aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1239, in get_variable aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 562, in get_variable aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 514, in _true_getter aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 929, in _get_single_variable aggregation=aggregation) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 259, in call return cls._variable_v1_call(*args, kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 220, in _variable_v1_call shape=shape) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 198, in previous_getter = lambda kwargs: default_variable_creator(None, *kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2511, in default_variable_creator shape=shape) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 263, in call return super(VariableMetaclass, cls).call(args, kwargs) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 1568, in init shape=shape) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 1698, in _init_from_args initial_value(), name="initial_value", dtype=dtype) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 901, in partition_info=partition_info) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/ops/init_ops.py", line 244, in call self.value, dtype=dtype, shape=shape, verify_shape=verify_shape) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 180, in constant_v1 allow_broadcast=False) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 284, in _constant_impl allow_broadcast=allow_broadcast)) File "/home/linux/.local/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 523, in make_tensor_proto (tuple(shape), nparray.shape)) TypeError: Expected Tensor's shape: (1,), got ().