Git Product home page Git Product logo

yolov5_tf's Introduction

YoloVx(yolov5/yolov4/yolov3/yolo_tiny)

Tensorflow

  1. Install NVIDIA driver
  2. Install CUDA10.1 and cudnn7.5
  3. Install Anaconda3, download website
  4. Install tensorflow, such as "sudo pip install tensorflow>=1.15 or tensorflow > 2.0" etc.

Introduction

A tensorflow implementation of YOLOv5 inspired by https://github.com/ultralytics/yolov5.

A tensorflow implementation of YOLOv4 inspired by https://github.com/AlexeyAB/darknet.

Frame code from https://github.com/YunYang1994/tensorflow-yolov3.

Backbone: Darknet53; CSPDarknet53[1], Mish[2]; MobileNetV2; MobileNetV3(large and small)

Neck: SPP[3], PAN[4];

Head: YOLOv5/YOLOv4(Mish), YOLOv3(Leaky_ReLU)[10];

Loss: DIOU CIOU[5], Focal_Loss[6]; Other: Label_Smoothing[7];

Environment

Python 3.6.8

Tensorflow 1.13.1 or Tensorflow 2.0 up

Quick Start

  1. Download YOLOv5 weights from yolov5.weights.
  2. Download YOLOv4 weights from yolov4.weights.
  3. Convert the Darknet YOLOv4 model to a tf model.
  4. Train Yolov5/Yolov4/Yolov3/Yolo_tiny.
  5. Run Yolov5/Yolov4/Yolov3/Yolo_tiny detection.

Convert weights

Running from_darknet_weights_to_ckpt.py will get tf yolov4 weight file yolov4_coco.ckpt.

python scripts/from_darknet_weights_to_ckpt.py

Running ckpt2pb.py will get tf yolov4 weight file yolov4.pb.

python scripts/ckpt2pb.py

Or running from_darknet_weights_to_pb.py directly.

python scripts/from_darknet_weights_to_pb.py

Train

In core/config.py add your own path.

usage: python train.py gpu_id net_type(yolov5/yolov4/yolov3/tiny)

python train.py 0 yolov5

Usage

Inference

python test.py
python demo.py

Reference

[1] Cross Stage Partial Network (CSPNet)

[2] A Self Regularized Non-Monotonic Neural Activation Function

[3] Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition

[4] Path Aggregation Network for Instance Segmentation

[5] Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression

[6] Focal Loss for Dense Object Detection

[7] When Does Label Smoothing Help?

[8] Convolutional Block Attention Module

[9] YOLOv4: Optimal Speed and Accuracy of Object Detection

[10] YOLOv3: An Incremental Improvement

[11] Aggregated Residual Transformations for Deep Neural Networks

Acknowledgment

keras_yolov3 https://github.com/qqwweee/keras-yolo3.

keras_yolov4 https://github.com/Ma-Dan/keras-yolo4.

yolov5_tf's People

Contributors

avbuffer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolov5_tf's Issues

yolov5 weights link not working and train on custom data

Hi,
Can you please update the link to download yolov5 weights ?
Also, can you please update on how to train the model on custom data ?
What is the configuration etc to use ? or is it the same like Pytorch implementation ?
Thanks

utils.py:268: RuntimeWarning: invalid value encountered in greater

Hi man, I am using yolov4 and running demo.py has the following problems:
utils.py:268: RuntimeWarning: invalid value encountered in greater
invalid_mask = np.logical_or((pred_coor[:, 0] > pred_coor[:, 2]), (pred_coor[:, 1] > pred_coor[:, 3]))
May I ask how is this going?

yolov5.pt

How to use Yolov5 weight file for detection?

Converting YoloV5s to Pb file failed

I am getting this error message when I convert yolov5s.pt to pb file

Traceback (most recent call last):
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1607, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Depth of input (16) is not a multiple of input depth of filter (512) for 'conv_route4/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,16], [1,1,512,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/kaldarabsah/Downloads/Yolov5_tf/core/yolov5.py", line 170, in init
self.conv_lbbox, self.conv_mbbox, self.conv_sbbox = self.__build_network(input_data)
File "/Users/kaldarabsah/Downloads/Yolov5_tf/core/yolov5.py", line 199, in __build_network
y19, layer_num = cspstage(input_data, self.trainable, 16init_width_size, init_depth_size, layer_num, 4, 1+7init_depth_size)
File "/Users/kaldarabsah/Downloads/Yolov5_tf/core/yolov5.py", line 92, in cspstage
route = conv(route, (1, 1, c, c / 2), trainable=trainable, name='conv_route%d' % route_nums, act_fun='mish')
File "/Users/kaldarabsah/Downloads/Yolov5_tf/core/yolov5.py", line 33, in conv
conv = tf.nn.conv2d(input=input_data, filter=weight, strides=strides, padding=padding)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 2010, in conv2d
name=name)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_nn_ops.py", line 1071, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1770, in init
control_input_ops)
File "/opt/miniconda2/envs/airflow/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op
raise ValueError(str(e))
ValueError: Depth of input (16) is not a multiple of input depth of filter (512) for 'conv_route4/Conv2D' (op: 'Conv2D') with input shapes: [?,?,?,16], [1,1,512,256].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "from_darknet_weights_to_pb.py", line 18, in
model = YOLOV5(input_data, trainable=False)
File "/Users/kaldarabsah/Downloads/Yolov5_tf/core/yolov5.py", line 172, in init
raise NotImplementedError('Can not build up yolov5 network')
NotImplementedError: Can not build up yolov5 network

Kindly, add an example how to convert pt file to pb

Thank you.

train yolov5 get nan

Hi man, I had train yolov5. now had a problem ,the loss always random getting nan. maybe the problem from iou???

performance

I use demo.py to detect a image,but its performace is bad.
Uploading image.png…

运行 detect.py 报错

硬件: nvidia jetson
操作系统: ubuntu16.04
运行 python detect.py 报错,报 FileNotFoundError:[Error2] No such file or directory : 'D:/datasets/Social/labels.txt',
这个路径是windows 上的路径,同时这个文件 Yolov5_tf 中并未提供,请问应该怎样解决?

yolov5:Dimensions of inputs should match

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()

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

=> 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()

I found some problems

Hello Jay Meng, I've looked over your code and I think your work is very good.Your work has been a great help to me.But I find that there is something wrong with your network structure, which I think is the reason why your work is not working well at present.I am sending you a summary of my work, hoping it will be of some help to you.Looking forward to your more excellent content.

clipboard

The focus operation is missing at the beginning of your network, which is similar to a down sampling operation.Specific I recommend you check the details of the article: https://zhuanlan.zhihu.com/p/164627427, this article analysis the very detailed, I hope you can made great achievements。

Confused about activation chosen and concatenate position

Why did you discard the official mish implementation and change it by setting a threshold?
Also official activation method is mainly using hardswish.
Does it work better than hardswish?

As for concatenating:
In YOLOv5 code, have three routes but not processed by CSP different with pytorch version.

Unsatisfied result on YOLOv4

zidane

bus

I have transformed the 'yolov4.weight' into 'yolov4.pb' and run the 'predict.py'. But it seems that the output is unsatisfactory.

Does anyone has got the same result?

或许数据处理的时候计算iou存在错误

在dataset.py 第234行计算IOU的时候 iou_scale = self.bbox_iou(bbox_xywh_scaled[i][np.newaxis, :], anchors_xywh),代码中用的anchor是实际的相对与实际坐标的anchor大小,比如【10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326】,而bbox_xywh_scaled确是除以strides之后的,这样的话,是否存在矛盾呢? 比如,某gt的宽高都为608,训练时的图片最大宽高,假设gt占满全图。则608/8 = 76。也就是说,bbox_xywh_scaled里面的宽高最大才78,那anchor里面的 大于这个宽高的anchor还有什么用呢?所以,这个地方计算iou的时候感觉存在问题。

以上是个人理解,有不对的,请谅解!

Tiny yolo v3 Training Error

When I try to training this program using tiny yolo v3 (net_type=tiny), I got the under
messages.

train.py

Instructions for updating:
Use standard file APIs to check for files with this prefix.
0%| | 0/39782 [00:00<?, ?it/s]2020-08-26 16:00:13.648868: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1356, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: Incompatible shapes: [2,18,18,3,4] vs. [2,36,36,3,4]
[[{{node define_loss/bigger_box_loss/logistic_loss_2/mul}}]]
[[define_loss/prob_loss/add/_69]]
(1) Invalid argument: Incompatible shapes: [2,18,18,3,4] vs. [2,36,36,3,4]
[[{{node define_loss/bigger_box_loss/logistic_loss_2/mul}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/media/sl/train.py", line 261, in
YoloTrain(net_type).train()
File "/media/sl/train.py", line 201, in train
self.trainable: True,})
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 950, in run
run_metadata_ptr)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run
run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: Incompatible shapes: [2,18,18,3,4] vs. [2,36,36,3,4]
[[node define_loss/bigger_box_loss/logistic_loss_2/mul (defined at media/sl/core/yolov3_tiny.py:197) ]]
[[define_loss/prob_loss/add/_69]]
(1) Invalid argument: Incompatible shapes: [2,18,18,3,4] vs. [2,36,36,3,4]
[[node define_loss/bigger_box_loss/logistic_loss_2/mul (defined at media/sl/core/yolov3_tiny.py:197) ]]
0 successful operations.
0 derived errors ignored.

Plz check my problems

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.