mmaction2 資料相關原始碼概覽

2021-10-08 06:30:49 字數 3965 閱讀 6077

data =

dict

( videos_per_gpu=8,

workers_per_gpu=4,

train=

dict

(type

=dataset_type,

ann_file=ann_file_train,

data_prefix=data_root,

pipeline=train_pipeline)

, val=

dict

(type

=dataset_type,

ann_file=ann_file_val,

data_prefix=data_root_val,

pipeline=val_pipeline)

, test=

dict

(type

=dataset_type,

ann_file=ann_file_val,

data_prefix=data_root_val,

pipeline=test_pipeline)

)

pipeline的構建過程:將配置檔案中定義的內容轉換為乙個list,並將該list傳入mmaction.datasets.pipelines.compose.compose中。

pipeline 配置檔案概述:

train_pipeline =

[dict

(type

='sampleframes'

, clip_len=

32, frame_interval=

2, num_clips=1)

,dict

(type

='frameselector'

, decoding_backend=

'turbojpeg'),

dict

(type

='resize'

, scale=(-

1,256)

, lazy=

true),

dict

(type

='multiscalecrop'

, input_size=

224,

scales=(1

,0.8),

random_crop=

false

, max_wh_scale_gap=0,

lazy=

true),

dict

(type

='resize'

, scale=

(224

,224

), keep_ratio=

false

, lazy=

true),

dict

(type

='flip'

, flip_ratio=

0.5, lazy=

true),

dict

(type

='fuse'),

dict

(type

='normalize'

,**img_norm_cfg)

,dict

(type

='formatshape'

, input_format=

'ncthw'),

dict

(type

='collect'

, keys=

['imgs'

,'label'

], meta_keys=

),dict

(type

='totensor'

, keys=

['imgs'

,'label'])

]val_pipeline =

[dict

(type

='sampleframes'

, clip_len=32,

frame_interval=2,

num_clips=1,

test_mode=

true),

dict

(type

='frameselector'

, decoding_backend=

'turbojpeg'),

dict

(type

='resize'

, scale=(-

1,256)

, lazy=

true),

dict

(type

='centercrop'

, crop_size=

224, lazy=

true),

dict

(type

='flip'

, flip_ratio=

0, lazy=

true),

dict

(type

='fuse'),

dict

(type

='normalize'

,**img_norm_cfg)

,dict

(type

='formatshape'

, input_format=

'ncthw'),

dict

(type

='collect'

, keys=

['imgs'

,'label'

], meta_keys=

),dict

(type

='totensor'

, keys=

['imgs'])

]test_pipeline =

[dict

(type

='sampleframes'

, clip_len=32,

frame_interval=2,

num_clips=10,

test_mode=

true),

dict

(type

='frameselector'

, decoding_backend=

'turbojpeg'),

dict

(type

='resize'

, scale=(-

1,256)),

dict

(type

='threecrop'

, crop_size=

256)

,dict

(type

='flip'

, flip_ratio=0)

,dict

(type

='normalize'

,**img_norm_cfg)

,dict

(type

='formatshape'

, input_format=

'ncthw'),

dict

(type

='collect'

, keys=

['imgs'

,'label'

], meta_keys=

),dict

(type

='totensor'

, keys=

['imgs'])

]

呼叫compose類實現的功能就是將資料依次通過所有元件,得到結果。

pipeline的分類

資料增強

資料型別/格式轉換

上面介紹過的compose

普通形式:在連續的幀中,間隔x幀提取幀,一共獲取y幀。

densesampleframes

mmaction2 指南 5 自定義新模組

新的head 新增新的學習策略 learning rate scheduler updater 參考 copyofsgd 例子 mmaction core optimizer my optimizer.py from registry import optimizers from torch.opt...

mysql資料庫編譯 Mysql資料庫原始碼編譯安裝

yum y install gcc gcc c make ncurses ncurses devel bison cmake 二 編譯及安裝 1 建立執行使用者 useradd s sbin nologin mysql 手動建乙個賬號 2 解包 把壓縮包傳進linux裡面 tar xf mysql ...

Linux驅動學習 I2C裝置驅動框架原始碼解析

一 引言 二 原始碼分析 i2c核心介紹 i2c driver的註冊 i2c client的註冊 probe i2c裝置構造的四種方法 i2c與cpu通訊方式之前和大家分析了linux中的i2c框架,本章來結合原始碼分析乙個具體的i2c裝置 i2c核心介紹 i2c 核心提供了 i2c匯流排驅動 和 ...