Inference on your own videos using pre-trained models - various errors

Hi there, trying to run the inference.py script from this tutorial. .

I tried on both my PC and a server, but I’m getting errors on both.

On my PC, I tried to run (I don’t have a GPU)

python inference.py --data-list videos_path.txt --model i3d_resnet50_v1_kinetics400 --gpu-id -1

and I got the error:

TypeError: __init__() got an unexpected keyword argument 'lazy_init'

As for the GluonCV version, I re-installed it today by using the command:

pip install --upgrade mxnet gluoncv

On the server, the error seems to be related to decord…I run

python inference.py --data-list videos_path.txt --model i3d_resnet50_v1_kinetics400

and got the error:

ImportError: cannot import name 'try_import_decord'

I tried to use the option “–use-decord=False”, but the result didn’t change. On this server, I installed everything by running:

pip install --upgrade mxnet-cu90mkl gluoncv
conda install -c anaconda cudatoolkit==9.0

Any idea?

Please use the master branch, which is the up-to-date version. The lazy_init argument was recently introduced.

It seems odd to me why the code cannot import try_import_decord. Can you install decord?

If you can install decord successfully, you can comment this import line and also line 85, https://github.com/dmlc/gluon-cv/blob/master/scripts/action-recognition/inference.py#L85.
Just import decord, and use it will be fine.

Thanks for the reply!

I didn’t understand what you meant about the lazy_init part, isn’t it included in the master branch?
Anyway, I was able to get around the problem by commenting the “lazy_init=True” line…don’t know if it affects anything else, but at least the script works now.



On the server, I installed decord without problems and did what you suggested, but now I get another error:

 ImportError: cannot import name 'SomethingSomethingV2Attr'

and the same goes for “HMDB51Attr”, “VideoClsCustom”, so basically I can only use:

 from gluoncv.data import Kinetics400Attr, UCF101Attr

but, after leaving only these two, I still get another error:

module 'gluoncv.data.transforms.video' has no attribute 'VideoGroupValTransform'

so, at this point I guess there’s some sort of version problem?
Again, I installed gluon by running

pip install --upgrade mxnet-cu90mkl gluoncv
conda install -c anaconda cudatoolkit==9.0

Hi, I don’t know which version of GluonCV you are using. But as you can see in the master branch of GluonCV, all these functions you mentioned are there.

SomethingSomethingV2Attr
Kinetics400Attr
UCF101Attr
VideoGroupValTransform

All these functions are available in gluoncv 0.6. Please check the installation, thank you.

OK, after updating to gluoncv 0.6 it works both on my PC and the server :slight_smile:, thank you!

I still get the error about the lazy_init argument though, I went around it by commenting it.

Glad to know it works.

You will get the error about lazy_init argument because that argument is introduced after gluoncv 0.6 release. So if you install the master branch or install recent nightly version of gluoncv, there will be no errors.