MXNetError: ImageRec need opencv to process

I’m trying to train the MXNet resnet-50 model from the finetune notebook (Fine-tune with Pretrained Models — mxnet documentation)

and I keep encountering the following error on my Jetson Xavier NX:

MXNetError: Traceback (most recent call last):
File “/home/nvidia/mxnet/mxnet/src/io/”, line 260
MXNetError: ImageRec need opencv to process

It seems to not have access to opencv even though I have Opencv4.5 installed. I’ve tried re-installing mxnet 1.7 several times (following the instructions from Jetson zoo) with no luck getting this to work.

I even tried modifying the file prior to install by changing the line
"sudo make -j$(nproc) install && "
"sudo make -j$(nproc) USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 install && "

That didn’t seem to work. Any ideas what is wrong?


The package doesn’t build with OpenCV support.
Could you turn it on and build it from source?


I built mxnet from source using the above script but its giving me an error when I try to use it on the command prompt:

Any ideas?


Which branch do you build from.
It seems that ndarray class occurs from branch 1.6.x.


From JEP/ at master · AastaNV/JEP · GitHub
script, I built using
git clone --branch v1.7.x --recursive mxnet

So its mxnet v1.7.x. Are you saying that v1.7.x won’t work for the install? I ask because it seemed to work fine with the install.


The class exists in branch 1.6.x or newer.
So it should be included in v1.7.x also.

We are going to check this issue internally.
Will update more information later.


Ok I’ll try again with v1.7x. Should I use the script? Please let me know. I really trying to get this working. Thanks.