MobileFace icon indicating copy to clipboard operation
MobileFace copied to clipboard

error??

Open jiagh2010 opened this issue 6 years ago • 6 comments

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

jiagh2010 avatar Aug 23 '19 10:08 jiagh2010

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

becauseofAI avatar Aug 29 '19 10:08 becauseofAI

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.

smilence86 avatar Sep 06 '19 03:09 smilence86

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

becauseofAI avatar Oct 09 '19 12:10 becauseofAI

@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.

smilence86 avatar Oct 11 '19 03:10 smilence86

@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.

becauseofAI avatar Oct 11 '19 05:10 becauseofAI

@becauseofAI https://mxnet-public.s3.amazonaws.com/install/raspbian/mxnet-1.5.0-py2.py3-none-any.whl

smilence86 avatar Oct 11 '19 07:10 smilence86