issues with branch folder
blue-butterfly opened this issue · 4 comments
hi,thanks for sharing,but I do not get the results with the code in branch folder,it get an error at the extract_feature function in test code。
I get the results,thanks!!!
@blue-butterfly
Hello, I do not get the results with the code in branch folder,it get an error at the extract_feature function in test code,could you please tell me how to fix it? Thank you so much!
File "test.py", line 116, in
test_feature = extract_feature(model, test_loader, context)
File "test.py", line 60, in extract_feature
f = nd.concat(model(img.as_in_context(ctx)[0]), axis=1).as_in_context(mx.cpu()).asnumpy()
File "/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 542, in call/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 919, in forward
out = self.forward(*args)
File "
return self.hybrid_forward(ndarray, x, *args, **params)
File "/person_reid/gluon-reid/branch/networks/resnet.py", line 123, in hybrid_forward/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 542, in call
x = self.base(x)
File "
out = self.forward(*args)
File "/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 919, in forward/person_reid/lib/python3.6/site-packages/mxnet/gluon/nn/basic_layers.py", line 117, in hybrid_forward
return self.hybrid_forward(ndarray, x, *args, **params)
File "
x = block(x)
File "/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 542, in call/person_reid/lib/python3.6/site-packages/mxnet/gluon/block.py", line 919, in forward
out = self.forward(*args)
File "
return self.hybrid_forward(ndarray, x, *args, **params)
File "/person_reid/lib/python3.6/site-packages/mxnet/gluon/nn/conv_layers.py", line 133, in hybrid_forward/person_reid/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke
act = getattr(F, self._op_name)(x, weight, name='fwd', **self._kwargs)
File "", line 167, in Convolution
File "
ctypes.byref(out_stypes)))
File "~/person_reid/lib/python3.6/site-packages/mxnet/base.py", line 251, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [10:42:11] src/operator/nn/convolution.cc:145: Check failed: dshp.ndim() == 4U (3 vs. 4) Input data should be 4D in batch-num_filter-y-x
@WangweiDamon hi, you can try : f = nd.concatenate(model(img.as_in_context(ctx)[0]), axis=1).as_in_context(mx.cpu()).asnumpy() -----> f = nd.concatenate(model(img.as_in_context(ctx))[0], axis=1).as_in_context(mx.cpu()).asnumpy() ,That's ok.
@blue-butterfly
Thank you so much for your help, the problem is solved.