avBuffer / Yolov5_tf

Yolov5/Yolov4/ Yolov3/ Yolo_tiny in tensorflow
288 stars 108 forks source link

when i train with yolov5 and no weights,i get some error .please help ,thanks #20

Open mozeqiu opened 3 years ago

mozeqiu commented 3 years ago

=> Now it starts to train YOLO-yolov5 from scratch ... 0%| | 0/5979 [00:00<?, ?it/s] 2021-02-05 11:11:31.769602: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7 2021-02-05 11:11:32.382686: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10 0%| | 0/5979 [00:08<?, ?it/s] Traceback (most recent call last): File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1365, in _do _call return fn(*args) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _ru n_fn target_list, run_metadata) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1443, in _ca ll_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,76,76,256] vs. shape[1] = [2,38,38,2 56] [[{{node define_loss/route_0/concat}}]] [[define_loss/conf_loss/add_1/_913]] (1) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,76,76,256] vs. shape[1] = [2,38,38,2 56] [[{{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 "train.py", line 260, in YoloTrain(net_type).train() File "train.py", line 207, in train self.trainable: True,}) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 958, in run run_metadata_ptr) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1181, in _ru n feed_dict_tensor, options, run_metadata) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1359, in _do _run run_metadata) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1384, in _do _call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,76,76,256] vs. shape[1] = [2,38,38,2 56] [[node define_loss/route_0/concat (defined at /home/yolov5-tf/Yolov5_tf/core/yolov5.py:215) ]] [[define_loss/conf_loss/add_1/_913]] (1) Invalid argument: ConcatOp : Dimensions of inputs should match: shape[0] = [2,76,76,256] vs. shape[1] = [2,38,38,2 56] [[node define_loss/route_0/concat (defined at /home/yolov5-tf/Yolov5_tf/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/upsample0/ResizeNearestNeighbor (defined at /home/yolov5-tf/Yolov5_tf/core/yolov5.py:75) define_loss/route_0/conv_route_0/LeakyRelu (defined at /home/yolov5-tf/Yolov5_tf/core/yolov5.py:55)

Input Source operations connected to node define_loss/route_0/concat: define_loss/upsample0/ResizeNearestNeighbor (defined at /home/yolov5-tf/Yolov5_tf/core/yolov5.py:75) define_loss/route_0/conv_route_0/LeakyRelu (defined at /home/yolov5-tf/Yolov5_tf/core/yolov5.py:55)

Original stack trace for 'define_loss/route_0/concat': File "train.py", line 260, in YoloTrain(net_type).train() File "train.py", line 105, in init self.model = YOLOV5(self.input_data, self.trainable) File "/home/yolov5-tf/Yolov5_tf/core/yolov5.py", line 176, in init self.conv_lbbox, self.conv_mbbox, self.conv_sbbox = self.__build_network(input_data) File "/home/yolov5-tf/Yolov5_tf/core/yolov5.py", line 215, in build_network y38 = tf.concat([y38, y19_upsample], axis=-1) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 201, in wrapp er return target(*args, **kwargs) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1654, in conc at return gen_array_ops.concat_v2(values=values, axis=axis, name=name) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1222, in concat_v2 "ConcatV2", values=values, axis=axis, name=name) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 74 4, in _apply_op_helper attrs=attr_protos, op_def=op_def) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3485, in _cre ate_op_internal op_def=op_def) File "/root/.virtualenvs/yolov5-tf/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1949, in in it__ self._traceback = tf_stack.extract_stack()

RitwickJoshi commented 3 years ago

Did you find any thing related to this ?

lyghe commented 3 years ago

core/yolov5.py : line 155

    # 4096x38x38 -> 1024x38x38
    input_data = conv(input_data, (1, 1, 64*init_width_size, 16*init_width_size), trainable=trainable, 
                      name='conv%d' % (layer_num + 2), downsample=True, act_fun='mish')

downsample=True should be False

Tracy-git commented 3 years ago

@lyghe i use your method , the error is missing. thank you .but i don't know why this working

lyghe commented 3 years ago

@lyghe i use your method , the error is missing. thank you .but i don't know why this working

if u look into function conv, u will find the difference of strides.

payal211 commented 3 years ago

@lyghe, I tried your method and model training started successfully. But model is not converge very well. And so that output is also not good. Any suggestions?

Thanks in advance.