Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error?? #17

Open
jiagh2010 opened this issue Aug 23, 2019 · 6 comments
Open

error?? #17

jiagh2010 opened this issue Aug 23, 2019 · 6 comments

Comments

@jiagh2010
Copy link

how to use cv2 ?read image as the input of function

@becauseofAI
Copy link
Owner

becauseofAI commented Aug 29, 2019

@jiagh2010
Which task do you want to run?
Maybe you can reference the example of mobileface_allinone.py

@smilence86
Copy link

smilence86 commented Sep 6, 2019

I'm try to run it on raspberry pi 4b, The way to install mxnet is pip install from official whl (mxnet-1.5.0-py2.py3-none-any.whl), maybe it's not use opencv when it's compile.

So I get this error when run "python get_face_boxes_gluoncv.py":
mxnet.base.MXNetError: [10:31:27] /work/mxnet/src/io/image_io.cc:249: Build with USE_OPENCV=1 for image io.

Therefore, I'm try to use cv2.imread instead of presets.yolo.load_test, but failed, I'm new to mxnet, I don't know how to pass paramters to it.

mobileface_allinone.py is also use presets.yolo.load_test to parse image.

@becauseofAI
Copy link
Owner

@smilence86
You can use this code to transform the image format from opencv Mat to mxnet NDArray.

@smilence86
Copy link

@becauseofAI I'm also get same error by these codes:

#python3 get_face_boxes_gluoncv.py

#x, img = presets.yolo.load_test(image, short=img_short)
frame = cv2.imread(image)
img_nd = nd.array(frame)
x, img = data_trans(img_nd, short=img_short)
x = x.as_in_context(ctx[0])
result = net(x)

Traceback (most recent call last):
File "get_face_boxes_gluoncv.py", line 55, in
x, img = data_trans(img_nd, short=img_short)
File "/opt/projects/MobileFace/example/../MobileFace_Detection/utils/data_presets.py", line 91, in data_trans
return transform_test(imgs, short, max_size, stride, mean, std)
File "/opt/projects/MobileFace/example/../MobileFace_Detection/utils/data_presets.py", line 48, in transform_test
orig_img = img.asnumpy().astype('uint8')
File "/opt/projects/MobileFace/.venv/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 1987, in asnumpy
ctypes.c_size_t(data.size)))
File "/opt/projects/MobileFace/.venv/lib/python3.7/site-packages/mxnet/base.py", line 252, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [11:06:51] /work/mxnet/src/io/image_io.cc:299: Build with USE_OPENCV=1 for image io.

@becauseofAI
Copy link
Owner

@smilence86
Have you build the MXNet with USE_OPENCV=1? Maybe you can use anaconda3 to install mxnet and opencv-python to test the code firstly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants