Yolov5_tf icon indicating copy to clipboard operation
Yolov5_tf copied to clipboard

yolov5:Dimensions of inputs should match

Open jttqbc666 opened this issue 5 years ago • 4 comments

Instructions for updating: Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts. 0%| | 0/1804 [00:00<?, ?it/s]=> Restoring weights from: ckpts/yolov5_test-loss=10.0817.ckpt-125 ... => ckpts/yolov5_test-loss=10.0817.ckpt-125 does not exist !!! => Now it starts to train YOLO-yolov5 from scratch ... 0%| | 0/1804 [00:11<?, ?it/s] Traceback (most recent call last):

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1365, in _do_call return fn(*args)

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _run_fn target_list, run_metadata)

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1443, in _call_tf_sessionrun run_metadata)

InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,44,44,384] vs. shape[1] = [2,22,22,384] [[{{node define_loss/route_0/concat}}]] [[define_loss/iou_loss/add_1/_209]] (1) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,44,44,384] vs. shape[1] = [2,22,22,384] [[{{node define_loss/route_0/concat}}]] 0 successful operations. 0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 261, in YoloTrain(net_type).train()

File "", line 207, in train self.trainable: True,})

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 958, in run run_metadata_ptr)

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1181, in _run feed_dict_tensor, options, run_metadata)

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1359, in _do_run run_metadata)

File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\client\session.py", line 1384, in _do_call raise type(e)(node_def, op, message)

InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,44,44,384] vs. shape[1] = [2,22,22,384] [[node define_loss/route_0/concat (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:215) ]] [[define_loss/iou_loss/add_1/_209]] (1) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,44,44,384] vs. shape[1] = [2,22,22,384] [[node define_loss/route_0/concat (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:215) ]] 0 successful operations. 0 derived errors ignored.

Errors may have originated from an input operation. Input Source operations connected to node define_loss/route_0/concat: define_loss/route_0/conv_route_0/LeakyRelu (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:55) define_loss/upsample0/ResizeNearestNeighbor (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:75)

Input Source operations connected to node define_loss/route_0/concat: define_loss/route_0/conv_route_0/LeakyRelu (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:55) define_loss/upsample0/ResizeNearestNeighbor (defined at D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py:75)

Original stack trace for 'define_loss/route_0/concat': File "D:\ruanjian\anaconda\envs\tf1\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\ruanjian\anaconda\envs\tf1\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\spyder_kernels\console_main.py", line 11, in start.main() File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\spyder_kernels\console\start.py", line 318, in main kernel.start() File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\kernelapp.py", line 583, in start self.io_loop.start() File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\platform\asyncio.py", line 149, in start self.asyncio_loop.run_forever() File "D:\ruanjian\anaconda\envs\tf1\lib\asyncio\base_events.py", line 442, in run_forever self._run_once() File "D:\ruanjian\anaconda\envs\tf1\lib\asyncio\base_events.py", line 1462, in _run_once handle._run() File "D:\ruanjian\anaconda\envs\tf1\lib\asyncio\events.py", line 145, in _run self._callback(*self._args) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\ioloop.py", line 690, in lambda f: self._run_callback(functools.partial(callback, future)) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\ioloop.py", line 743, in _run_callback ret = callback() File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\gen.py", line 787, in inner self.run() File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\gen.py", line 748, in run yielded = self.gen.send(value) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\kernelbase.py", line 361, in process_one yield gen.maybe_future(dispatch(*args)) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\kernelbase.py", line 268, in dispatch_shell yield gen.maybe_future(handler(stream, idents, msg)) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\kernelbase.py", line 541, in execute_request user_expressions, allow_stdin, File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\ipkernel.py", line 300, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\ipykernel\zmqshell.py", line 536, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\interactiveshell.py", line 2858, in run_cell raw_cell, store_history, silent, shell_futures) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\interactiveshell.py", line 2886, in _run_cell return runner(coro) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\async_helpers.py", line 68, in pseudo_sync_runner coro.send(None) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\interactiveshell.py", line 3063, in run_cell_async interactivity=interactivity, compiler=compiler, result=result) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\interactiveshell.py", line 3254, in run_ast_nodes if (await self.run_code(code, result, async=asy)): File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 261, in YoloTrain(net_type).train() File "", line 105, in init self.model = YOLOV5(self.input_data, self.trainable) File "D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py", line 176, in init self.conv_lbbox, self.conv_mbbox, self.conv_sbbox = self.__build_network(input_data) File "D:\Artificial_Intelligence\anaconda_spyder\Yolov5_tf-master\core\yolov5.py", line 215, in __build_network y38 = tf.concat([y38, y19_upsample], axis=-1) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\util\dispatch.py", line 180, in wrapper return target(*args, **kwargs) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1606, in concat return gen_array_ops.concat_v2(values=values, axis=axis, name=name) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 1189, in concat_v2 "ConcatV2", values=values, axis=axis, name=name) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 744, in _apply_op_helper attrs=attr_protos, op_def=op_def) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\framework\ops.py", line 3327, in _create_op_internal op_def=op_def) File "D:\ruanjian\anaconda\envs\tf1\lib\site-packages\tensorflow\python\framework\ops.py", line 1791, in init self._traceback = tf_stack.extract_stack()

jttqbc666 avatar Oct 16 '20 05:10 jttqbc666

Hey jttqbc666, Thanks, could you mind telling which net type selecting on backbone, such as darknet53 or mobilenet?

avBuffer avatar Nov 17 '20 02:11 avBuffer

I have the same problem, I used the 'darknet53' net_tpye to train yolov5s.

Crystalxd avatar Dec 21 '20 10:12 Crystalxd

Hello @avBuffer @Crystalxd, Have you solved it? I have the same issue. I too used “darknet53” and net_type yolov5.

can you please update ASAP? Thanks in advance.

payal211 avatar May 03 '21 04:05 payal211

Hello, I have the same issue. can you please update ? Thank you

wafa-bouzouita avatar Oct 21 '22 08:10 wafa-bouzouita