We list some common issues faced by many users and their corresponding solutions here.
Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them. If the contents here do not cover your issue, please create an issue using the provided templates and make sure you fill in all required information in the template.
“No module named ‘mmcv.ops’”; “No module named ‘mmcv._ext’”
Uninstall existing mmcv in the environment using
pip uninstall mmcv
Install mmcv-full following the installation instruction
“OSError: MoviePy Error: creation of None failed because of the following error”
Refer to install.md
For Windows users, ImageMagick will not be automatically detected by MoviePy, there is a need to modify
moviepy/config_defaults.pyfile by providing the path to the ImageMagick binary called
IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\magick.exe"
For Linux users, there is a need to modify the
/etc/ImageMagick-6/policy.xmlfile by commenting out
<policy domain="path" rights="none" pattern="@*" />to
<!-- <policy domain="path" rights="none" pattern="@*" /> -->, if ImageMagick is not detected by moviepy.
“Why I got the error message ‘Please install XXCODEBASE to use XXX’ even if I have already installed XXCODEBASE?”
You got that error message because our project failed to import a function or a class from XXCODEBASE. You can try to run the corresponding line to see what happens. One possible reason is, for some codebases in OpenMMLAB, you need to install mmcv-full before you install them.
No such file or directory: xxx/xxx/img_00300.jpg
In our repo, we set
start_index=1as default value for rawframe dataset, and
start_index=0as default value for video dataset. If users encounter FileNotFound error for the first or last frame of the data, there is a need to check the files begin with offset 0 or 1, that is
xxx_00001.jpg, and then change the
start_indexvalue of data pipeline in configs.
How should we preprocess the videos in the dataset? Resizing them to a fix size(all videos with the same height-width ratio) like
340x256(1) or resizing them so that the short edges of all videos are of the same length (256px or 320px)
We have tried both preprocessing approaches and found (2) is a better solution in general, so we use (2) with short edge length 256px as the default preprocessing setting. We benchmarked these preprocessing approaches and you may find the results in TSN Data Benchmark and SlowOnly Data Benchmark.
Mismatched data pipeline items lead to errors like
We have both pipeline for processing videos and frames.
For videos, We should decode them on the fly in the pipeline, so pairs like
DecordInit & DecordDecode,
OpenCVInit & OpenCVDecode,
PyAVInit & PyAVDecodeshould be used for this case like this example.
For Frames, the image has been decoded offline, so pipeline item
RawFrameDecodeshould be used for this case like this example.
KeyError: 'total_frames'is caused by incorrectly using
RawFrameDecodestep for videos, since when the input is a video, it can not get the
How to just use trained recognizer models for backbone pre-training?
Refer to Use Pre-Trained Model, in order to use the pre-trained model for the whole network, the new config adds the link of pre-trained models in the
And to use backbone for pre-training, you can change
pretrainedvalue in the backbone dict of config files to the checkpoint path / url. When training, the unexpected keys will be ignored.
How to visualize the training accuracy/loss curves in real-time?
In batchnorm.py: Expected more than 1 value per channel when training
To use batchnorm, the batch_size should be larger than 1. If
drop_lastis set as False when building dataloaders, sometimes the last batch of an epoch will have
batch_size==1(what a coincidence …) and training will throw out this error. You can set
drop_lastas True to avoid this error:
How to fix stages of backbone when finetuning a model?
Actually, users can set
frozen_stagesto freeze stages in backbones except C3D model, since all backbones inheriting from
ResNet3Dsupport the inner function
How to set memcached setting in config files?
In MMAction2, you can pass memcached kwargs to
class DecordInitfor video dataset or
RawFrameDecodefor rawframes dataset. For more details, you can refer to
class FileClientin MMCV for more details.
Here is an example to use memcached for rawframes dataset:
mc_cfg = dict(server_list_cfg='server_list_cfg', client_cfg='client_cfg', sys_path='sys_path') train_pipeline = [ ... dict(type='RawFrameDecode', io_backend='memcached', **mc_cfg), ... ]
How to set
load_fromvalue in config files to finetune models?
In MMAction2, We set
load_from=Noneas default in
configs/_base_/default_runtime.pyand owing to inheritance design, users can directly change it by setting
load_fromin their configs.
How to make predicted score normalized by softmax within [0, 1]?
change this in the config, make
model['test_cfg'] = dict(average_clips='prob').
What if the model is too large and the GPU memory can not fit even only one testing sample?
By default, the 3d models are tested with 10clips x 3crops, which are 30 views in total. For extremely large models, the GPU memory can not fit even only one testing sample (cuz there are 30 views). To handle this, you can set
model['test_cfg']of the config file. If so, n views will be used as a batch during forwarding to save GPU memory used.
How to show test results?
During testing, we can use the command
--out xxx.json/pkl/yamlto output result files for checking. The testing output has exactly the same order as the test dataset. Besides, we provide an analysis tool for evaluating a model using the output result files in
Why is the onnx model converted by mmaction2 throwing error when converting to other frameworks such as TensorRT?
For now, we can only make sure that models in mmaction2 are onnx-compatible. However, some operations in onnx may be unsupported by your target framework for deployment, e.g. TensorRT in this issue. When such situation occurs, we suggest you raise an issue and ask the community to help as long as
pytorch2onnx.pyworks well and is verified numerically.