Insightface: RetinaFace cpu test

Created on 10 May 2019  路  10Comments  路  Source: deepinsight/insightface

Hi,

How can I test RetinaFace with cpu ?

Best

Most helpful comment

found:

gpuid=-1 . solves.

All 10 comments

found:

gpuid=-1 . solves.

How did you get rcnn cython to work without gpu or nvidia drivers?

Same question as @paruliansaragi

@edumucelli I've managed to get this to work. What is it your stuck on?

@paruliansaragi facing this error when running python test.py, basically Compile with USE_CUDA=1 to enable GPU usage:

[16:48:58] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.3.0. Attempting to upgrade...
[16:48:58] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
means [0. 0. 0.]
use_landmarks True
sym size: 9
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/mxnet/symbol/symbol.py", line 1623, in simple_bind
    ctypes.byref(exe_handle)))
  File "/usr/local/lib/python3.5/dist-packages/mxnet/base.py", line 253, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [16:48:58] src/storage/storage.cc:119: Compile with USE_CUDA=1 to enable GPU usage
Stack trace:
  [bt] (0) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2795cb) [0x7fe1c1df35cb]
  [bt] (1) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b5d7a5) [0x7fe1c46d77a5]
  [bt] (2) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b617fd) [0x7fe1c46db7fd]
  [bt] (3) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b63f12) [0x7fe1c46ddf12]
  [bt] (4) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::NDArray::NDArray(mxnet::TShape const&, mxnet::Context, bool, int)+0x5d0) [0x7fe1c3e622c0]
  [bt] (5) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::common::InitZeros(mxnet::NDArrayStorageType, mxnet::TShape const&, mxnet::Context const&, int)+0x5c) [0x7fe1c3f074ac]
  [bt] (6) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::common::ReshapeOrCreate(std::string const&, mxnet::TShape const&, int, mxnet::NDArrayStorageType, mxnet::Context const&, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, bool)+0x3a1) [0x7fe1c3f1a9e1]
  [bt] (7) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::exec::GraphExecutor::InitArguments(nnvm::IndexedGraph const&, std::vector<mxnet::TShape, std::allocator<mxnet::TShape> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType> > const&, std::unordered_set<std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> > const&, mxnet::Executor const*, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*)+0xb10) [0x7fe1c3f229b0]
  [bt] (8) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::exec::GraphExecutor::Init(nnvm::Symbol, mxnet::Context const&, std::map<std::string, mxnet::Context, std::less<std::string>, std::allocator<std::pair<std::string const, mxnet::Context> > > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::unordered_map<std::string, mxnet::TShape, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::TShape> > > const&, std::unordered_map<std::string, int, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, int> > > const&, std::unordered_map<std::string, int, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, int> > > const&, std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType> > const&, std::unordered_set<std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, mxnet::Executor*, std::unordered_map<nnvm::NodeEntry, mxnet::NDArray, nnvm::NodeEntryHash, nnvm::NodeEntryEqual, std::allocator<std::pair<nnvm::NodeEntry const, mxnet::NDArray> > > const&)+0x6a9) [0x7fe1c3f30d69]



During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 15, in <module>
    detector = RetinaFace('./model/R50', 0, gpuid, 'net3')
  File "/media/eduardo/toshiba2t/data/detection-bounding-box/insightface/RetinaFace/retinaface.py", line 138, in __init__
    self.model.bind(data_shapes=[('data', (1, 3, image_size[0], image_size[1]))], for_training=False)
  File "/usr/local/lib/python3.5/dist-packages/mxnet/module/module.py", line 429, in bind
    state_names=self._state_names)
  File "/usr/local/lib/python3.5/dist-packages/mxnet/module/executor_group.py", line 279, in __init__
    self.bind_exec(data_shapes, label_shapes, shared_group)
  File "/usr/local/lib/python3.5/dist-packages/mxnet/module/executor_group.py", line 375, in bind_exec
    shared_group))
  File "/usr/local/lib/python3.5/dist-packages/mxnet/module/executor_group.py", line 662, in _bind_ith_exec
    shared_buffer=shared_data_arrays, **input_shapes)
  File "/usr/local/lib/python3.5/dist-packages/mxnet/symbol/symbol.py", line 1629, in simple_bind
    raise RuntimeError(error_msg)
RuntimeError: simple_bind error. Arguments:
data: (1, 3, 640, 640)
[16:48:58] src/storage/storage.cc:119: Compile with USE_CUDA=1 to enable GPU usage
Stack trace:
  [bt] (0) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2795cb) [0x7fe1c1df35cb]
  [bt] (1) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b5d7a5) [0x7fe1c46d77a5]
  [bt] (2) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b617fd) [0x7fe1c46db7fd]
  [bt] (3) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(+0x2b63f12) [0x7fe1c46ddf12]
  [bt] (4) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::NDArray::NDArray(mxnet::TShape const&, mxnet::Context, bool, int)+0x5d0) [0x7fe1c3e622c0]
  [bt] (5) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::common::InitZeros(mxnet::NDArrayStorageType, mxnet::TShape const&, mxnet::Context const&, int)+0x5c) [0x7fe1c3f074ac]
  [bt] (6) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::common::ReshapeOrCreate(std::string const&, mxnet::TShape const&, int, mxnet::NDArrayStorageType, mxnet::Context const&, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, bool)+0x3a1) [0x7fe1c3f1a9e1]
  [bt] (7) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::exec::GraphExecutor::InitArguments(nnvm::IndexedGraph const&, std::vector<mxnet::TShape, std::allocator<mxnet::TShape> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType> > const&, std::unordered_set<std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> > const&, mxnet::Executor const*, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*)+0xb10) [0x7fe1c3f229b0]
  [bt] (8) /usr/local/lib/python3.5/dist-packages/mxnet/libmxnet.so(mxnet::exec::GraphExecutor::Init(nnvm::Symbol, mxnet::Context const&, std::map<std::string, mxnet::Context, std::less<std::string>, std::allocator<std::pair<std::string const, mxnet::Context> > > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::vector<mxnet::Context, std::allocator<mxnet::Context> > const&, std::unordered_map<std::string, mxnet::TShape, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::TShape> > > const&, std::unordered_map<std::string, int, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, int> > > const&, std::unordered_map<std::string, int, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, int> > > const&, std::vector<mxnet::OpReqType, std::allocator<mxnet::OpReqType> > const&, std::unordered_set<std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::string> > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::unordered_map<std::string, mxnet::NDArray, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::NDArray> > >*, mxnet::Executor*, std::unordered_map<nnvm::NodeEntry, mxnet::NDArray, nnvm::NodeEntryHash, nnvm::NodeEntryEqual, std::allocator<std::pair<nnvm::NodeEntry const, mxnet::NDArray> > > const&)+0x6a9) [0x7fe1c3f30d69]

And setting the gpuid=-1 still produces the same error? If so try pip install mxnet and pip uninstall the version of mxnet you have with cuda enabled.

@paruliansaragi indeed, that works! Thanks!

Should I download the mxnet for cpu if I want to do RetinaFace cpu test?

You can try pip install mxnet-mkl

You can try pip install mxnet-mkl

it gets error message:
cd rcnn/cython/; python setup.py build_ext --inplace; rm -rf build; cd ../../ Skipping GPU_NMS running build_ext skipping 'bbox.c' Cython extension (up-to-date) skipping 'anchors.c' Cython extension (up-to-date) skipping 'cpu_nms.c' Cython extension (up-to-date) cd rcnn/pycocotools/; python setup.py build_ext --inplace; rm -rf build; cd ../../ running build_ext

Was this page helpful?
0 / 5 - 0 ratings