Keras RetinaNet github项目
https://github.com/fizyr/keras-retinanet 根据此网站的方法,利用Pascal VOC 2007数据集开始训练,出现error:
D:\JupyterWorkSpace\keras-retinanet>python D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py pascal D:\\JupyterWorkSpace\\VOCdevkit\\VOC2007 --steps 100
C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 35, in <module>
from .. import layers # noqa: F401
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\layers\__init__.py", line 1, in <module>
from ._misc import RegressBoxes, UpsampleLike, Anchors, ClipBoxes # noqa: F401
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\layers\_misc.py", line 19, in <module>
from ..utils import anchors as utils_anchors
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\utils\anchors.py", line 20, in <module>
from ..utils.compute_overlap import compute_overlap
ModuleNotFoundError: No module named 'keras_retinanet.utils.compute_overlap'
在anchors.py中的from ..utils.compute_overlap import compute_overlap之前加入
import pyximport
pyximport.install()
再运行,出现如下error:
D:\JupyterWorkSpace\keras-retinanet>python D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py pascal D:\\JupyterWorkSpace\\VOCdevkit\\VOC2007 --steps 100
C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
compute_overlap.c
C:\Users\Administrator\.pyxbld\temp.win-amd64-3.6\Release\pyrex\keras_retinanet\utils\compute_overlap.c(567): fatal error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\distutils\_msvccompiler.py", line 423, in compile
self.spawn(args)
File "C:\ProgramData\Anaconda3\lib\distutils\_msvccompiler.py", line 542, in spawn
return super().spawn(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "C:\ProgramData\Anaconda3\lib\distutils\spawn.py", line 38, in spawn
_spawn_nt(cmd, search_path, dry_run=dry_run)
File "C:\ProgramData\Anaconda3\lib\distutils\spawn.py", line 81, in _spawn_nt
"command %r failed with exit status %d" % (cmd, rc))
distutils.errors.DistutilsExecError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 215, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 533, in build_extension
depends=ext.depends)
File "C:\ProgramData\Anaconda3\lib\distutils\_msvccompiler.py", line 425, in compile
raise CompileError(msg)
distutils.errors.CompileError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 35, in <module>
from .. import layers # noqa: F401
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\layers\__init__.py", line 1, in <module>
from ._misc import RegressBoxes, UpsampleLike, Anchors, ClipBoxes # noqa: F401
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\layers\_misc.py", line 19, in <module>
from ..utils import anchors as utils_anchors
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\utils\anchors.py", line 22, in <module>
from ..utils.compute_overlap import compute_overlap
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 458, in load_module
language_level=self.language_level)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 231, in load_module
raise exc.with_traceback(tb)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 215, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 533, in build_extension
depends=ext.depends)
File "C:\ProgramData\Anaconda3\lib\distutils\_msvccompiler.py", line 425, in compile
raise CompileError(msg)
ImportError: Building module keras_retinanet.utils.compute_overlap failed: ["distutils.errors.CompileError: command 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\VC\\\\BIN\\\\x86_amd64\\\\cl.exe' failed with exit status 2\n"]
我猜测python调用c在Windows系统上bug比较多,还好这个Keras RetinaNet github项目的旧版本没有调用c,索性就用旧版本。
但是又出现问题:
Limit: 1551050342
InUse: 1548747008
MaxInUse: 1549328640
NumAllocs: 1403
MaxAllocSize: 119565824 2018-07-31 13:42:42.065436: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\bfc_allocator.cc:277] ****************************************************************************************************
2018-07-31 13:42:42.081028: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\framework\op_kernel.cc:1192] Resource exhausted: OOM when allocating tensor with shape[1,512,100,101]
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1323, in _do_call
return fn(*args)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1302, in _run_fn
status, run_metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1,512,100,101]
[[Node: bn3a_branch2c/FusedBatchNorm = FusedBatchNorm[T=DT_FLOAT, data_format="NHWC", epsilon=1.001e-05, is_training=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](res3a_branch2c/convolution, bn3a_branch2c/gamma/read, bn3a_branch2c/beta/read, bn3a_branch2c/moving_mean/read, bn3a_branch2c/moving_variance/read)]]
[[Node: loss/add/_2253 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_8646_loss/add", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]] During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 443, in <module>
main()
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 438, in main
callbacks=callbacks,
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\training.py", line 1415, in fit_generator
initial_epoch=initial_epoch)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\training_generator.py", line 213, in fit_generator
class_weight=class_weight)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\training.py", line 1215, in train_on_batch
outputs = self.train_function(ins)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 2672, in __call__
return self._legacy_call(inputs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 2654, in _legacy_call
**self.session_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 889, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1120, in _run
feed_dict_tensor, options, run_metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1317, in _do_run
options, run_metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1336, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1,512,100,101]
[[Node: bn3a_branch2c/FusedBatchNorm = FusedBatchNorm[T=DT_FLOAT, data_format="NHWC", epsilon=1.001e-05, is_training=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](res3a_branch2c/convolution, bn3a_branch2c/gamma/read, bn3a_branch2c/beta/read, bn3a_branch2c/moving_mean/read, bn3a_branch2c/moving_variance/read)]]
[[Node: loss/add/_2253 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_8646_loss/add", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]] Caused by op 'bn3a_branch2c/FusedBatchNorm', defined at:
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 443, in <module>
main()
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 410, in main
freeze_backbone=args.freeze_backbone
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\\train.py", line 87, in create_models
model = model_with_weights(backbone_retinanet(num_classes, modifier=modifier), weights=weights, skip_mismatch=True)
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\models\resnet.py", line 33, in retinanet
return resnet_retinanet(*args, backbone=self.backbone, **kwargs)
File "D:\\JupyterWorkSpace\\keras-retinanet\\keras_retinanet\\bin\..\..\keras_retinanet\models\resnet.py", line 75, in resnet_retinanet
resnet = keras_resnet.models.ResNet50(inputs, include_top=False, freeze_bn=True)
File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\keras_resnet\models\_2d.py", line 188, in ResNet50
return ResNet(inputs, blocks, numerical_names=numerical_names, block=keras_resnet.blocks.bottleneck_2d, include_top=include_top, classes=classes, *args, **kwargs)
File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\keras_resnet\models\_2d.py", line 76, in ResNet
x = block(features, stage_id, block_id, numerical_name=(block_id > 0 and numerical_names[stage_id]), freeze_bn=freeze_bn)(x)
File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\keras_resnet\blocks\_2d.py", line 139, in f
y = keras_resnet.layers.BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name="bn{}{}_branch2c".format(stage_char, block_char))(y)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\base_layer.py", line 457, in __call__
output = self.call(inputs, **kwargs)
File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\keras_resnet\layers\_batch_normalization.py", line 17, in call
return super(BatchNormalization, self).call(training=(not self.freeze), *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\normalization.py", line 178, in call
return normalize_inference()
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\normalization.py", line 174, in normalize_inference
epsilon=self.epsilon)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 1905, in batch_normalization
is_training=False
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 831, in fused_batch_norm
name=name)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 2033, in _fused_batch_norm
is_training=is_training, name=name)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op
op_def=op_def)
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1,512,100,101]
[[Node: bn3a_branch2c/FusedBatchNorm = FusedBatchNorm[T=DT_FLOAT, data_format="NHWC", epsilon=1.001e-05, is_training=false, _device="/job:localhost/replica:0/task:0/device:GPU:0"](res3a_branch2c/convolution, bn3a_branch2c/gamma/read, bn3a_branch2c/beta/read, bn3a_branch2c/moving_mean/read, bn3a_branch2c/moving_variance/read)]]
[[Node: loss/add/_2253 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_8646_loss/add", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
cmd上显示的电脑条件如下:
2018-07-31 13:41:32.294261: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
2018-07-31 13:41:32.924335: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GT 740 major: 3 minor: 0 memoryClockRate(GHz): 1.0585
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.66GiB
2018-07-31 13:41:32.931511: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GT 740, pci bus id: 0000:01:00.0, compute capability: 3.0)
出现错误的原因应该是GPU内存太小,所以还需要换个更好的GPU。
Keras RetinaNet github项目的更多相关文章
- Keras RetinaNet github项目安装
在存储库目录/keras-retinanet/中,执行pip install . --user 后,出现错误: D:\>cd D:\JupyterWorkSpace\keras-retinane ...
- 利用Travis CI 让你的github项目持续构建
Travis CI 是目前新兴的开源持续集成构建项目,它与jenkins,GO的很明显的特别在于采用yaml格式,简洁清新独树一帜.目前大多数的github项目都已经移入到Travis CI的构建队列 ...
- 优秀大数据GitHub项目一览
http://blog.csdn.net/yaoxtao/article/details/50540485 优秀大数据GitHub项目一览 VMware CEO Pat Gelsinger曾说: 数据 ...
- 用tortoiseGit管理GitHub项目代码(完整教程)
一.为什么要写这篇博客呢,因为在一开始用tortoiseGit来管理项目的时候,在百度上找了很多教程,但是感觉说的都不是很全,有些东西以及操作没写清楚,所以想写一片比较完整用tortoiseGit管理 ...
- Github项目推荐-图神经网络(GNN)相关资源大列表
文章发布于公号[数智物语] (ID:decision_engine),关注公号不错过每一篇干货. 转自 | AI研习社 作者|Zonghan Wu 这是一个与图神经网络相关的资源集合.相关资源浏览下方 ...
- Eclipse安装git插件以及关联导入GitHub项目
一.Eclipse配置git 1.查看自己eclipse的版本 打开eclipse 导航: help->AboutEclipse 如图: 2.检查Eclipse中是否已安装Git插件 菜单栏He ...
- github项目
一.github项目地址: https://github.com/fairy1231/gitLearning/tree/master 二.github的重要性: Git 是一个快速.可扩展的分布式版本 ...
- 【全网最全的博客美化系列教程】01.添加Github项目链接
全网最全的博客美化系列教程相关文章目录 [全网最全的博客美化系列教程]01.添加Github项目链接 [全网最全的博客美化系列教程]02.添加QQ交谈链接 [全网最全的博客美化系列教程]03.给博客添 ...
- 使用IntelliJ IDEA和Eclipse导入Github项目
使用IntelliJ IDEA导入Github项目 菜单栏File->Settings->分别配置好Github和Git的相关信息,配置完之后点击旁边的Test按键可以查看是否配置成功 配 ...
随机推荐
- OpenCV-Python:形态学操作
常用的形态学操作:腐蚀.膨胀.开运算和闭运算 一.什么叫形态学操作 形态学操作就是改变物体的形状,比如腐蚀就是"变瘦",膨胀就是"变胖" 形态学操作一般作用于二 ...
- python 2.7 数据结构: 基础面试总结
python中基础的数据类型包括: 1 Number(数字) 2 String(字符串) 3 List(列表) 4 Tuple(元组) 5 set(集合) 6 Pictionary(字典) 按照可变数 ...
- django---不使用view,直接从Url转到html
这个在使用公告页时,就很方便. 因为无需要经过数据库,视图. 直接使用文字. https://docs.djangoproject.com/en/2.1/topics/class-based-view ...
- 必须了解的Object知识
必须了解的Object知识 作为Java中所有类的根类,Object提供了很多基础的方法,我们经常会覆写它的方法,但很多时候因为不了解这些方法内在的含义以及与其他方法之间的关系而错误的覆写.下面介绍一 ...
- P1341 无序字母对 欧拉回路
题目描述 给定n个各不相同的无序字母对(区分大小写,无序即字母对中的两个字母可以位置颠倒).请构造一个有n+1个字母的字符串使得每个字母对都在这个字符串中出现. 输入输出格式 输入格式: 第一行输入一 ...
- debian安装redis
添加rc.local文件cat </etc/rc.local#!/bin/sh -eexit 0EOF cd /opt wget http://download.redis.io/release ...
- Typescript高级类型与泛型难点详解
最近做的TS分享,到了高级类型这一块.通过琢磨和实验还是挖掘出了一些深层的东西,在此处做一下记录,也分享给各位热爱前端的小伙伴. 其实在学习TS之前就要明确以下几点: 1. typescrip ...
- 自学华为IoT物联网_08 IoT连接管理平台介绍
点击返回自学华为IoT物流网 自学华为IoT物联网_08 IoT连接管理平台介绍 一.IoT连接管理平台的由来 1.1 物联网产业发展面临的挑战 新业务上线周期长,应用碎片化,开发周期长,场频上市慢 ...
- ef core的外键约束笔记
ef core设置可选外键,有如下几种方式:1.在依赖实体AAA中,并不显式设置外键属性XXXId 2.手动设置外键属性XXXId为可空类型(int?等类型) 3.在实体类与数据表进行映射时,配置狭隘 ...
- JavaScript(四)
条件语句 通过条件来控制程序的走向,就需要用到条件语句. 运算符 1.算术运算符: +(加). -(减). *(乘). /(除). %(求余)2.赋值运算符:=. +=. -=. *=. /=. %= ...