Skip to content

Commit

Permalink
batch
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoki-Wake committed Jul 12, 2022
1 parent d49f901 commit f9105ee
Show file tree
Hide file tree
Showing 4 changed files with 436 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ wheels/
*.egg
MANIFEST

# tmp folder
tmp/

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down
41 changes: 41 additions & 0 deletions batch_utils/run_breakfast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from mmcv import Config, DictAction
from mmaction.apis import inference_recognizer, init_recognizer
import os.path as osp
import os
import time
from glob import glob


if __name__ == '__main__':
# ----settings-----
fp_config = 'mmaction2/configs/recognition/arr_tsm2022/tsm_r50_1x1x8_50e_breakfast_rgb.py'
fp_config_out = 'mmaction2/tmp/config.py'
cfg = Config.fromfile(fp_config)
cfg_options = {'work_dir': dir_workdir_next,
'data.train.ann_file': train_data_next_mixed,
'data.val.ann_file': val_data,
'data.test.ann_file': test_data,
'data.train.data_prefix': dir_videos_root,
'data.val.data_prefix': dir_videos_root,
'data.test.data_prefix': dir_videos_root,
'load_from': fp_checkpoint_current,
'data_root': dir_videos_root,
'data_root_val': dir_videos_root,
'ann_file_train': train_data_next_mixed,
'ann_file_val': val_data,
'ann_file_test': test_data, }
cfg.merge_from_dict(cfg_options)
cfg.dump(fp_config_next)

train_command = mmaction_root + "/tools/dist_train_onlyheader.sh " + \
fp_config_next + " 1 --validate --seed 0 --deterministic --gpu-ids 0"
import subprocess
print(train_command)
#subprocess.run([train_command], shell=True)
#
#test_command = mmaction_root + "/tools/test_several.py " + fp_config_next + " " + osp.join(
# dir_workdir_next,
# 'epoch_50.pth') + " --eval top_k_accuracy mean_class_accuracy --out " + osp.join(
# dir_workdir_next,
# 'test_result.json')
#print(test_command)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'../../_base_/default_runtime.py'
]
# model settings
model = dict(cls_head=dict(num_classes=26))#26
model = dict(cls_head=dict(num_classes=11))#26
load_from = '/mmaction2/pretrained_models/tsm_r50_256h_1x1x8_50e_sthv2_rgb_20210816-032aa4da.pth'
# dataset settings
#dataset_type = 'VideoDataset'
Expand Down
Loading

0 comments on commit f9105ee

Please sign in to comment.