mmaction2 指南
Outline
1. 配置文件
https://github.com/open-mmlab/mmaction2/blob/master/docs/tutorials/1_config.md
配置文件命名规则
{model}_[model setting]_{backbone}_[misc]_{data setting}_[gpu x batch_per_gpu]_{schedule}_{dataset}_{modality}
模型名称_模型specific配置_bakcbone_【e.g. dense, 320p, video, etc】_【帧采样设置({clip_len}x{frame_interval}x{num_clips}】_[gpu x batch_per_gpu]_【epoch,e.g. 20e】_【数据集名称】_【模态】
配置文件structure
Action localizartion 配置
- BMN例子
# model settings 模型配置
model = dict( # Config of the model
type='BMN', # Type of the localizer
temporal_dim=100, # Total frames selected for each video
boundary_ratio=0.5, # Ratio for determining video boundaries
num_samples=32, # Number of samples for each proposal
num_samples_per_bin=3, # Number of bin samples for each sample
feat_dim=400, # Dimension of feature
soft_nms_alpha=0.4, # Soft NMS alpha
soft_nms_low_threshold=0.5, # Soft NMS low threshold
soft_nms_high_threshold=0.9, # Soft NMS high threshold
post_process_top_k=100) # Top k proposals in post process
# model training and testing settings
train_cfg = None # Config of training hyperparameters for BMN
test_cfg = dict(average_clips='score') # Config for testing hyperparameters for BMN
# dataset settings 数据集配置(预处理管道,gpu分布配置)
dataset_type = 'ActivityNetDataset' # Type of dataset for training, valiation and testing
data_root = 'data/activitynet_feature_cuhk/csv_mean_100/' # Root path to data for training
data_root_val = 'data/activitynet_feature_cuhk/csv_mean_100/' # Root path to data for validation and testing
ann_file_train = 'data/ActivityNet/anet_anno_train.json' # Path to the annotation file for training
ann_file_val = 'data/ActivityNet/anet_anno_val.json' # Path to the annotation file for validation
ann_file_test = 'data/ActivityNet/anet_anno_test.json' # Path to the annotation file for testing
train_pipeline = [ # List of training pipeline steps 流程
dict(type='LoadLocalizationFeature'), # Load localization feature pipeline
dict(type='GenerateLocalizationLabels'), # Generate localization labels pipeline
dict( # Config of Collect
type='Collect', # Collect pipeline that decides which keys in the data should be passed to the localizer
keys=['raw_feature', 'gt_bbox'], # Keys of input
meta_name='video_meta', # Meta name
meta_keys=['video_name']), # Meta keys of input
dict( # Config of ToTensor
type='ToTensor', # Convert other types to tensor type pipeline
keys=['raw_feature']), # Keys to be converted from image to tensor
dict( # Config of ToDataContainer
type='ToDataContainer', # Pipeline to convert the data to DataContainer
fields=[dict(key='gt_bbox', stack=False, cpu_only=True)]) # Required fields to be converted with keys and attributes
]
val_pipeline = [ # List of validation pipeline steps
dict(type='LoadLocalizationFeature'), # Load localization feature pipeline
dict(type='GenerateLocalizationLabels'), # Generate localization labels pipeline
dict( # Config of Collect
type='Collect', # Collect pipeline that decides which keys in the data should be passed to the localizer
keys=['raw_feature', 'gt_bbox'], # Keys of input
meta_name='video_meta', # Meta name
meta_keys=[
'video_name', 'duration_second', 'duration_frame', 'annotations',
'feature_frame'
]), # Meta keys of input
dict( # Config of ToTensor
type='ToTensor', # Convert other types to tensor type pipeline
keys=['raw_feature']), # Keys to be converted from image to tensor
dict( # Config of ToDataContainer
type='ToDataContainer', # Pipeline to convert the data to DataContainer
fields=[dict(key='gt_bbox', stack=False, cpu_only=True)]) # Required fields to be converted with keys and attributes
]
test_pipeline = [ # List of testing pipeline steps
dict(type='LoadLocalizationFeature'), # Load localization feature pipeline