open-mmlab / mmaction2

OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark
https://mmaction2.readthedocs.io
Apache License 2.0
4.14k stars 1.22k forks source link

How to solve this problem? #1689

Closed Strontia closed 2 years ago

Strontia commented 2 years ago

My config file:

import mmcv
from mmcv import Config
from mmcv.runner import set_random_seed
import os.path as osp
from mmaction.datasets import build_dataset
from mmaction.models import build_model
from mmaction.apis import train_model

'''
 code changed places:
 1. configs/__base__/models/r2plus1d_r34.py: 11 row
 2. tools/train.py : (add code) 23, 24 row
'''

cfg_file = '../configs/recognition/r2plus1d/r2plus1d_r34_video_8x8x1_180e_kinetics400_rgb.py'
cfg = Config.fromfile(cfg_file)
cfg.dataset_type = 'VideoDataset'
cfg.data_root = '../data/insect/videos'
cfg.data_root_val = '../data/insect/videos'
cfg.ann_file_train = '../data/insect/insect_train_split_1_videos.txt'
cfg.ann_file_val = '../data/insect/insect_val_split_1_videos.txt'
cfg.ann_file_test = '../data/insect/insect_val_split_1_videos.txt'

cfg.data.train.type = 'VideoDataset'
cfg.data.train.ann_file = '../data/insect/insect_train_split_1_videos.txt'
cfg.data.train.data_prefix = '../data/insect/videos'

cfg.data.val.type = 'VideoDataset'
cfg.data.val.ann_file = '../data/insect/insect_val_split_1_videos.txt'
cfg.data.val.data_prefix = '../data/insect/videos'

cfg.data.test.type = 'VideoDataset'
cfg.data.test.ann_file = '../data/insect/insect_val_split_1_videos.txt'
cfg.data.test.data_prefix = 'data/insect/videos'

cfg.data.workers_per_gpu = 0

cfg.model.cls_head.num_classes = 6
cfg.load_from = Nonekeep_ratio = False
cfg.work_dir = './runs_r2plus1_each_cls'
cfg.data.videos_per_gpu = cfg.data.videos_per_gpu // 2
cfg.optimizer.lr = cfg.optimizer.lr / 8 / 16
cfg.total_epochs = 100
cfg.checkpoint_config.interval = 10
cfg.log_config.interval = 10

cfg.setdefault('omnisource', False)
cfg.seed = 0
set_random_seed(0, deterministic=False)
cfg.gpu_ids = range(1)

datasets = [build_dataset(cfg.data.train)]
model = build_model(cfg.model, train_cfg=cfg.get('train_cfg'), test_cfg=cfg.get('test_cfg'))
mmcv.mkdir_or_exist(osp.abspath(cfg.work_dir))
train_model(model, datasets, cfg, distributed=False, validate=True)
# print(cfg.pretty_text)

error

decord._ffi.base.DECORDError: [22:14:39] /github/workspace/src/video/video_reader.cc:151: Check failed: st_nb >= 0 (-1381258232 vs. 0) ERROR cannot find video stream with wanted index: -1
hukkai commented 2 years ago

It is an error in decord when reading videos: https://github.com/dmlc/decord/issues/116

hukkai commented 2 years ago

@Strontia If you have any questions, feel free to re-open the issue. Thanks!