如何在进行分割增强的同时更改图像和地面实况图像的数据层?

时间:2018-05-08 00:59:09

标签: neural-network deep-learning caffe image-segmentation pycaffe

我正在进行扩充以使用caffe执行细分任务。我写的Python Layer引发了错误。图层定义如下:

layer {
    name: 'myaug'
    type: 'Python'
    bottom: 'data'
    bottom: 'label'
    top: 'data'
    top: 'label'
    python_param {
        module: 'augLayer'
        layer: 'CompactData'
    }
}

这是网络图: net drawing

该错误似乎与numpy

有关
File "/home/usersc/caffe/python/caffe/pycaffe.py", line 11, in <module>
    import numpy as np
File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import _internal  # for freeze programs
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/site-packages/numpy/core/_internal.py", line 14, in <module>
    import ctypes
  File "/home/usersc/anaconda2/envs/mycaffe/lib/python2.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /home/usersc/anaconda2/envs/mycaffe/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: _PySlice_Unpack

我不确定,我在考虑是否应该添加MemoryData图层以保留this link中的增强数据,因为数据和标签图像都应该同步发送。是否应该清除Data Layer内存?

1 个答案:

答案 0 :(得分:0)

导入numpy时出现问题:这与您的代码/图层无关,您的代码甚至还没有运行。
确保numpy已正确安装在您的计算机上,并且$PYTHONPATH环境指向正确的位置。

关于内存:您定义图层的方式,它会执行扩充"in-place",也就是说,它会更改datalabel blob,而不是复制增强的输入。确保你对这种行为没问题。此外,我认为您不需要"MemoryData"图层来执行扩充,"Python"图层就足够了。