GluonCV — 计算机视觉的深度学习工具包

使用最新的mxnet版本后,下面这个问题已经解决了:

train_imagenet在使用–mode hybrid时崩溃:

python train_imagenet.py --data-dir '/media/bst/Workspace/ilsvrc_cls_workspace/data_images/ILSVRC2015/Data/CLS-LOC'  --model resnet18_v1 --num-gpus 2 -j 8 --batch-size 128 --mode hybrid
INFO:root:Namespace(batch_norm=False, batch_size=128, data_dir='/media/bst/Workspace/ilsvrc_cls_workspace/data_images/ILSVRC2015/Data/CLS-LOC', log_interval=50, logging_dir='logs', lr=0.1, lr_decay=0.1, lr_decay_epoch='40,60', lr_decay_period=0, mode='hybrid', model='resnet18_v1', momentum=0.9, num_epochs=3, num_gpus=2, num_workers=8, save_dir='params', save_frequency=10, save_plot_dir='.', use_pretrained=False, use_thumbnail=False, wd=0.0001)
Traceback (most recent call last):
  File "train_imagenet.py", line 227, in <module>
    main()
  File "train_imagenet.py", line 224, in main
    train(opt.num_epochs, context)
  File "train_imagenet.py", line 179, in train
    outputs = [net(X) for X in data]
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/gluon/block.py", line 413, in __call__
    return self.forward(*args)
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/gluon/block.py", line 619, in forward
    return self._call_cached_op(x, *args)
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/gluon/block.py", line 524, in _call_cached_op
    self._build_cache(*args)
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/gluon/block.py", line 512, in _build_cache
    self._cached_op = ndarray.CachedOp(out, self._flags, input_names, param_dict)
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 130, in __init__
    ctypes.byref(self.handle)))
  File "/home/bst/Documents/incubator-mxnet/python/mxnet/base.py", line 149, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [12:12:18] src/imperative/cached_op.cc:91: Check failed: arg_name_to_id.size() == arg_names.size() (52 vs. 1) Expecting 52inputs, given 1

Stack trace returned 10 entries:
[bt] (0) /home/bst/Documents/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::StackTrace[abi:cxx11]()+0x5b) [0x7ff0e36c0bdb]
[bt] (1) /home/bst/Documents/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28) [0x7ff0e36c1748]
[bt] (2) /home/bst/Documents/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Imperative::CachedOp::CachedOp(nnvm::Symbol const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> > > > > const&)+0x216c) [0x7ff0e5c530fc]
[bt] (3) /home/bst/Documents/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXCreateCachedOpEx+0x150b) [0x7ff0e610c65b]
[bt] (4) /home/bst/anaconda2/envs/mxnet/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7ff0f450fec0]
[bt] (5) /home/bst/anaconda2/envs/mxnet/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7ff0f450f87d]
[bt] (6) /home/bst/anaconda2/envs/mxnet/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4d6) [0x7ff0f4725776]
[bt] (7) /home/bst/anaconda2/envs/mxnet/lib/python2.7/lib-dynload/_ctypes.so(+0x8aa1) [0x7ff0f471baa1]
[bt] (8) /home/bst/anaconda2/envs/mxnet/bin/../lib/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7ff13f3297a3]
[bt] (9) /home/bst/anaconda2/envs/mxnet/bin/../lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x190b) [0x7ff13f3bd56b]

赞一个!

建议后续实现MSRA 的可变形卷积 rfcn rcnn 等

希望能复现一个 google 官方的 Deeplab V3+ (https://github.com/tensorflow/models/tree/master/research/deeplab),Gluon 现在有 synch BN,说不定效果比官方放出来的还要好。

脐带!!:bowing_man:

2赞

好棒!从知乎专栏过来的 !
急需FSRCNN,一直很喜欢Mxnet,可是用它做超分辨率的人超级少,希望官方能复现一下,自己做了有一段时间了,还没成功。希望能加入你们的计划。

1赞

遇到了同样的问题,请问该怎么设置voc目录?

ImageNet的nasnet模型什么时候有?

解决了。按给的提示创建文件夹和文件就好了。。。~/.mxnet/datasets/voc/VOC2012/ImageSets/Segmentation/trainval.txt

FSRCNN +1 @stoner

faster rcnn是急需,因为这个太基础了,检测算法都源于这个,而老版本的可读性、可扩展性和可维护性都很差。可以考虑搞个gluon detectron。
其实代码倒不难,关键是rcnn训练慢,要在COCO这样的大型数据集上验证精度,一般人没有大量的显卡很难做到,只能靠官方了。

1赞

pip install gluoncv时报错,没查到该怎么解决,求帮助,错误显示结果如下:

Collecting gluoncv
  Using cached https://files.pythonhosted.org/packages/a4/42/37f1e147034da2c856739fb41df08623fec157306afb8e5aa20882f60d0a/gluoncv-0.1.0-py2.py3-none-any.whl
Requirement already satisfied: requests in d:\programdata\anaconda3\lib\site-packages (from gluoncv) (2.14.2)
Requirement already satisfied: numpy in d:\programdata\anaconda3\lib\site-packages (from gluoncv) (1.14.0)
Requirement already satisfied: Pillow in c:\users\zhan\appdata\roaming\python\python36\site-packages (from gluoncv) (5.1.0)
Requirement already satisfied: matplotlib in d:\programdata\anaconda3\lib\site-packages (from gluoncv) (2.1.0)
Exception:
Traceback (most recent call last):
  File "d:\programdata\anaconda3\lib\site-packages\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "d:\programdata\anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "d:\programdata\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "d:\programdata\anaconda3\lib\site-packages\pip\_internal\resolve.py", line 262, in _resolve_one
    check_dist_requires_python(dist)
  File "d:\programdata\anaconda3\lib\site-packages\pip\_internal\utils\packaging.py", line 46, in check_dist_requires_python
    feed_parser.feed(metadata)
  File "d:\programdata\anaconda3\lib\email\feedparser.py", line 175, in feed
    self._input.push(data)
  File "d:\programdata\anaconda3\lib\email\feedparser.py", line 103, in push
    self._partial.write(data)
TypeError: string argument expected, got 'NoneType'

之前以为是pip的问题,从9.1更新到10.0后还是这样~

用的是anaconda的pip吗,感觉还是坏的

多谢关注,这里显示的用的是anaconda的pip,而且装别的包也没有问题,就是gluoncv会报那个错~

试一试手动安装? 我刚试的 pip install gluoncv 虽然不会报错,但是安装的是 0.1.0 版本,跟 GluonCV 上 0.2.0 对应的文档还是有蛮多出入的,运行 demo 就会报错,手动安装的是最新的 0.2.0 版本,就没事

git clone https://github.com/dmlc/gluon-cv
cd gluon-cv && python setup.py install --user

太棒啦,可以直接手动安装,十分感谢!

这周又把object detection过了一遍,纠正了对anchor的理解,果然目标检测还是比较复杂的。开始入手gluoncv,想把这个优秀又灵活的工具用好。

你们这个工具怎么下载呀?下载链接点击没反应呀。

dll load failed,无法运行,求解
pip和手动安装后都报这个错误

C:\ProgramData\Anaconda3\lib\site-packages\gluoncv-0.3.0-py3.6.egg\gluoncv\__init__.py:17: UserWarning: Legacy mxnet==1.1.0 detected, some new modules may not work properly. mxnet>=1.3.0 is recommended. You can use pip to upgrade mxnet `pip install mxnet --pre --upgrade`
Traceback (most recent call last):
  File "D:/Code/MyCode/RSSeg_deeplab/RSseg_deeplab.py", line 9, in <module>
    from gluoncv import model_zoo
  File "C:\ProgramData\Anaconda3\lib\site-packages\gluoncv-0.3.0-py3.6.egg\gluoncv\__init__.py", line 26, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\gluoncv-0.3.0-py3.6.egg\gluoncv\data\__init__.py", line 12, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\gluoncv-0.3.0-py3.6.egg\gluoncv\data\pascal_aug\segmentation.py", line 3, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\__init__.py", line 97, in <module>
    from .matlab import loadmat, savemat, whosmat, byteordercodes
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\__init__.py", line 13, in <module>
    from .mio import loadmat, savemat, whosmat
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\mio.py", line 12, in <module>
    from .miobase import get_matfile_version, docfiller
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\io\matlab\miobase.py", line 22, in <module>
    from scipy.misc import doccer
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\misc\__init__.py", line 68, in <module>
    from scipy.interpolate._pade import pade as _pade
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\interpolate\__init__.py", line 175, in <module>
    from .interpolate import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\interpolate\interpolate.py", line 21, in <module>
    import scipy.special as spec
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: 找不到指定的模块。

Process finished with exit code 1

看起来是scipy安装有问题,而且mxnet版本还是1.1,gluoncv现在需要1.3以上mxnet

请问,为什么语义分割的输出总是有两层c3和c4?loss似乎是pred1和pred2一起取的,但是预测的时候是怎么用呢?

又看了一下源码,似乎output[0]是输出,output[1]是一个辅助loss计算的,不知道这么理解对不对