bubbliiiing / yolo3-keras Goto Github PK
View Code? Open in Web Editor NEW这是一个yolo3-keras的源码,可以用于训练自己的模型。
License: MIT License
这是一个yolo3-keras的源码,可以用于训练自己的模型。
License: MIT License
感谢博主分享。
博主,请问为什么我按照提供的训练步骤进行了操作后进行训练loss一直是0.0000呢?
3.6以上的python 无法解释protobuf包下某个py文件 下的某些syntax
如何转onnx模型
Input image filename:img/street.jpg
Traceback (most recent call last):
File "predict.py", line 53, in
r_image = yolo.detect_image(image)
File "/home/zcw/yolo3-keras/yolo.py", line 144, in detect_image
image_data = np.array(boxed_image, dtype='float32')
TypeError: array() takes 1 positional argument but 2 were given
博主您好,我在训练自己的模型的时候,发现stage1最终的loss=44,stage2最终的loss=46,这个问题的话我是不是要继续训练一遍stage2??
发现训练速度很慢,~10000 sample的情况下一个epoch要接近20分钟(~1100s)。任务管理器显示显存≈7.6/8G,但是运算占用就百分之几,CPU占用也不高。推测是data_generate里单线程做augmentation出了瓶颈,因为在服务器上四块V100跑占用也上不去。然后训练到10个epoch上下出现了Loss NaN,翻了一下其他implementation里的issue,有提到说bad sample/改小lr一类的(有点随机性),不知道作者大大有无想法。
请问您的coco训练的loss能低到多少?我心里没有一把尺
如题目所示,在yolo3中我尝试更换backone为densenet121并使用keras自带的预训练权重,发现mAP从0.849掉到了0.828。如果从头训练不使用预训练权重的话mAP更是掉到了0.63左右,根本无法从头开始训练,我也尝试在从头训练中将LR调大到0.05然而效果一般,看了很多关于dense-yolo3的论文进行复现也得不到论文的效果......
也尝试了densenet201,和densenet121的效果差不多.....
不知道啥问题了,快困扰我两三个星期了,希望能够达到作者大大的回复......
大佬 你好 ,非常感谢您发的视频 ,给你学了很多东西。我这有一个问题想请教一下。我这标注了一些数据集,想训练自己的目标检测模型。我大概用了您写的YOLOV3 的程序,和SSD MOBILENET的模型。训练,到最后模型预测不成功,总是不收敛。我用tensorflow object detection api用同样的数据集训练模型能收敛,可以预测成功,我现在不知道怎么回事?能帮帮我吗 ?大佬。大佬 可以加我QQ285745340
博主您好,我将您的代码稍微改进之后在coco数据集上训练,冻住和解冻都训练完之后最终loss值大概是51;我觉得这个值有点大,之后又再上一次模型基础上继续冻住和解冻训练,发现这次训练时loss值还在下降,所以我应该不断地冻住和解冻训练吗,直到loss值始终不变??
您好!我尝试在FPN部分增加了几个残差连接,想问一下这样的话官方的预训练权重是不是可以用?但如果我想修改残差快,比如在每个残差块里再增加几个卷积层,这样是不是就要在coco数据集上重新训练,得到预加载权重?
博主您好,我想我问一下您的代码中加载的预训练模型是在YOLOv3-416上训练的结果还是YOLOv3-608上的结果??
”训练所需的yolo_weights.h5可以在Release里面下载。
https://github.com/bubbliiiing/yolo3-keras/releases
也可以去百度网盘下载
链接: https://pan.baidu.com/s/1izPebZ6PVU25q1we1UgSGQ 提取码: tbj3”
您好,训练过程中loss一直维持在50左右,但计算mAP却显示有80%+,当我运行predict.py检测时,效果很差,很多都检测不到,请问这可能是什么原因呢
anchor是固定的?不应该是kmeans聚类出来的么
老哥,我每次运行总是会报错,配置了好几种Anaconda的环境也还报错
报错信息:
Using TensorFlow backend.
Traceback (most recent call last):
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\Anaconda3\envs\keras\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "D:\Anaconda3\envs\keras\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/yolo3/yolo3-keras-master/yolo.py", line 6, in
from keras import backend as K
File "D:\Anaconda3\envs\keras\lib\site-packages\keras_init_.py", line 3, in
from . import utils
File "D:\Anaconda3\envs\keras\lib\site-packages\keras\utils_init_.py", line 6, in
from . import conv_utils
File "D:\Anaconda3\envs\keras\lib\site-packages\keras\utils\conv_utils.py", line 9, in
from .. import backend as K
File "D:\Anaconda3\envs\keras\lib\site-packages\keras\backend_init_.py", line 84, in
from .tensorflow_backend import *
File "D:\Anaconda3\envs\keras\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in
import tensorflow as tf
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python_init_.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Anaconda3\envs\keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "D:\Anaconda3\envs\keras\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "D:\Anaconda3\envs\keras\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
请问TF2版本的代码在哪里
你好,我用自己的数据集训练,mAP接近98%、每一类精准率都很高,接近99%,召回率60%左右
但是用测试集图片检测时,大部分目标置信度低(0.3-0.5),必须在代码中调低score值才可以检测出这部分目标,
anchor box是自己聚类生成的,匹配度大概98%
不知道这种情况如何解决?求指点
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 255. Shapes are [1,1,1024,18] and [255,1024,1,1]. for 'Assign_360' (op: 'Assign') with input shapes: [1,1,1024,18], [255,1024,1,1].
求助:一直报错这个因为什么呀
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\Aanconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "d:/yolo3/predict.py", line 11, in
from yolo import YOLO
File "d:\yolo3\yolo.py", line 9, in
from nets.yolo import yolo_body
File "D:\Aanconda\envs\tensorflow\lib\site-packages\nets_init.py", line 5, in
from nets.autograd import Hook, Parameter
File "D:\Aanconda\envs\tensorflow\lib\site-packages\nets\autograd_init.py", line 3, in
from .functional import *
File "D:\Aanconda\envs\tensorflow\lib\site-packages\nets\autograd\functional.py", line 15,
in
import nets.autograd.function as fc
AttributeError: module 'nets' has no attribute 'autograd'
请问博主能否提供利用VOC数据集心里训练好的模型权重?心里没什么第,loss不知道该下降到什么程度才算合适
1、在train.py代码下在构建模型时,为什么image_input = Input(shape=(None, None, 3))是三维,不需要加上batch_size吗?
2、在yolo_body这个函数里,一开始darknet_body(inputs)返回的feat3的维度你写的是13, 13, 1024,是三维,为什么经过make_last_layers()之后得到的y1的维度变成了batch_size, 13, 13, 3, (5+num_class),变成了四维。
大家好,求教一问题。我想用一个深度摄像头,不管是哪个CNN model,比如YOLO,如何能输出物体的三维坐标?不知道有没有相关的教程?谢谢
你好,我按照你的环境配置,程序也运行起来了,但是输入img/street.jpg后,一直停在那不出结果
thank you
运行predict.py文件后,警告
WARNING:tensorflow:From D:\Anaconda\envs\tf\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
您好大大,在一轮训练没有结束时,意外中断后如何重新训练呢? 我看过您断点续传的教程,但是您那已经生成了h5文件。当一轮训练没结束是好像没有h5文件的,请问这种情况可以继续训练吗?
不知道怎么解决,目前只能训练您提供的VOC数据集
我想修改一下yolo的顶层网络模型,但奈何找不到可以用的darknet的tf或者keras的权重,作者大大有什么可行的方法,麻烦指导一下
`0it [00:00, ?it/s]
Conversion completed!
Process finished with exit code 0`
就这样然后没了
大佬 你好 ,非常感谢您发的视频 ,给你学了很多东西。我这有一个问题想请教一下。我这标注了一些数据集,想训练自己的目标检测模型。我大概用了您写的YOLOV3 的程序,和SSD MOBILENET的模型。训练,到最后模型预测不成功,总是不收敛。我用tensorflow object detection api用同样的数据集训练模型能收敛,可以预测成功,我现在不知道怎么回事?
UP主,我这边训练完了100epoch,几乎每一个h5都不能发现框,全是0box,但是用官方的yolo_weights.h5是可以预测的,请问是什么原因啊,迷茫了
我训练模型,两类,训练到loss值在30多一点,就一直不下降了,请问有什么 优化的建议吗?emmm,楼主能否更新一份数据增强的代码呢?
我把input改成有三个class的customized dataset,然后修改了部分代码迁移到tf2.0,具体改动如下:
1. from keras.layers import修改为from tensorflow.keras.layers import
2. 移除train.py中的tf.config和tf.session移除
3. loss.py中line 148修改为tf.while_loop
代码能够顺利compile,在第一次model.compile时报错,报错如下:
Traceback (most recent call last):
File "f:/RM/yolo3-keras/train.py", line 206, in <module>
'yolo_loss': lambda y_true, y_pred: y_pred})
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 446, in compile
self._compile_weights_loss_and_weighted_metrics()
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 1592, in _compile_weights_loss_and_weighted_metrics
self.total_loss = self._prepare_total_loss(masks)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 1652, in _prepare_total_loss
per_sample_losses = loss_fn.call(y_true, y_pred)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\keras\losses.py", line 220, in call
y_pred, y_true)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\ops\losses\util.py", line 79, in squeeze_or_expand_dimensions
is_last_dim_1 = math_ops.equal(1, array_ops.shape(y_pred)[-1])
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 898, in _slice_helper
name=name)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\ops\array_ops.py", line 1064, in strided_slice
shrink_axis_mask=shrink_axis_mask)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\ops\gen_array_ops.py", line 9535, in strided_slice
shrink_axis_mask=shrink_axis_mask, name=name)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 742, in _apply_op_helper
attrs=attr_protos, op_def=op_def)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\framework\func_graph.py", line 595, in _create_op_internal
compute_device)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3322, in _create_op_internal
op_def=op_def)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1786, in __init__
control_input_ops)
File "C:\Users\jiany\.conda\envs\deep_stock\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1622, in _create_c_op
raise ValueError(str(e))
ValueError: slice index -1 of dimension 0 out of bounds. for 'loss/yolo_loss_loss/strided_slice' (op: 'StridedSlice') with input shapes: [0], [1], [1], [1] and with computed input tensors: input[1] = <-1>, i
我怀疑是loss.py
的line 153 expand dim出的问题,但是不熟悉customized loss不太会debug,希望作者大大解答
大家谁知道如何在先验框里进一步进行视觉处理?比如说做边缘检测,或者模糊框出来的内容?图片上可以完成,但是视频实时检测的话目前做不到,因为框实时在动。。。。。。
谢谢!!
我只需要检测一个种类的目标,请问可以使用这个yolo3-keras模型吗?主要需要改哪些东西呢
我看了一下在nets/loss.py中对于锚框中心点xy的损失计算为
xy_loss = object_mask * box_loss_scale * K.binary_crossentropy(raw_true_xy, raw_pred[...,0:2], from_logits=True)
其中raw_pred是yolo_head方法中返回的feats,也就是网络的原输出值。那么raw_pred[...,0:2]所代表的不应该是没有经过sigmod激活函数激活前的值吗?而不是sigmod激活过后在0~1的偏移量值。
而raw_true_xy = y_true[l][..., :2]*grid_shapes[l][:] - grid代表的是对于某一网格的偏移量值,是处在0~1之间的值,通过这两个tensor来做损失计算是否有问题呢?
望解答疑惑,十分感谢!
训练自己的数据集,一共321张图片,epoch=500,batch_size==8(10就会显示out of memory),
2020-09-30 09:26:59.030397: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9484 MB memory) -> physical GPU (device: 0, name: TITAN Xp, pci bus id: 0000:07:00.0, compute capability: 6.1) 2020-09-30 09:26:59.033584: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 9484 MB memory) -> physical GPU (device: 1, name: TITAN Xp, pci bus id: 0000:08:00.0, compute capability: 6.1) 2020-09-30 09:26:59.036737: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:2 with 9484 MB memory) -> physical GPU (device: 2, name: TITAN Xp, pci bus id: 0000:89:00.0, compute capability: 6.1) 2020-09-30 09:26:59.039634: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:3 with 9484 MB memory) -> physical GPU (device: 3, name: TITAN Xp, pci bus id: 0000:8a:00.0, compute capability: 6.1)
这个报应该时4个gpu都用上了吧,为啥我都得10个小时左右才能训练完。
而且训练过程中的loss周期性的起伏
是什么原因呢?期待您的回答,谢谢!
UnknownError (see above for traceback): Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node conv2d_1/convolution (defined at C:\Users\tian\Anaconda3\envs\tensorflow-gpu\lib\site-packages\keras\backend\tensorflow_backend.py:3335) ]]
[[node boolean_mask_143/GatherV2 (defined at E:\project\yolo3-keras-master\yolo3-keras-master\nets\yolo3.py:291) ]]
时好时坏的
请问训练模型是用了什么设备?模型训练的时间要多长呢?
不知道能不能有一个关于yolo3-keras的ubuntu环境的配置。
比如类似requirement.txt文件
tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node conv2d_1/convolution}}]]
[[{{node boolean_mask_128/GatherV2}}]]
在 preprocess_true_boxes 函数中有如下代码:
intersect_mins = np.maximum(box_mins, anchor_mins)
intersect_maxes = np.minimum(box_maxes, anchor_maxes)
intersect_wh = np.maximum(intersect_maxes - intersect_mins, 0.)
intersect_area = intersect_wh[..., 0] * intersect_wh[..., 1]
上面这段代码中box_mins ,anchor_mins 都是负值,为什么需要设置这些负值呢?对计算IOU有啥帮助
您好大大,我训练的时候报错了这个,求帮助~
Freeze the first 184 layers of total 252 layers.
Train on 7 samples, val on 0 samples, with batch size 8.
Epoch 1/50
Traceback (most recent call last):
File "/Users/liminghe/yolo3-keras/train.py", line 312, in
callbacks=[logging, checkpoint, reduce_lr, early_stopping])
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/engine/training.py", line 2244, in fit_generator
max_queue_size=max_queue_size)
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/engine/training.py", line 2362, in evaluate_generator
generator_output = next(output_generator)
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/utils/data_utils.py", line 793, in get
six.reraise(value.class, value, value.traceback)
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/six.py", line 696, in reraise
raise value
File "/Users/liminghe/.virtualenvs/pytorch/lib/python3.7/site-packages/keras/utils/data_utils.py", line 658, in _data_generator_task
generator_output = next(self._generator)
File "/Users/liminghe/yolo3-keras/train.py", line 49, in data_generator
image, box = get_random_data(annotation_lines[i], input_shape, random=random)
IndexError: list index out of range
Process finished with exit code 1
————————————————————————————————————
我设置的classes是:classes = ["perf", "icon"]
图片数量7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.