From 82dac3c534912df6fbd97bcdd2ffe530cbc8439e Mon Sep 17 00:00:00 2001 From: Yuanhao Zhai Date: Thu, 25 May 2023 13:46:47 -0400 Subject: [PATCH] replace mmcv with mmengine --- tools/data/gym/download.py | 6 +++--- tools/data/gym/download_videos.sh | 2 +- tools/data/gym/trim_event.py | 8 ++++---- tools/data/gym/trim_subaction.py | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/data/gym/download.py b/tools/data/gym/download.py index cfcb954c35..ec49a8a5b1 100644 --- a/tools/data/gym/download.py +++ b/tools/data/gym/download.py @@ -7,7 +7,7 @@ import ssl import subprocess -import mmcv +import mmengine from joblib import Parallel, delayed ssl._create_default_https_context = ssl._create_unverified_context @@ -72,7 +72,7 @@ def download_wrapper(youtube_id, output_dir): def main(input, output_dir, num_jobs=24): # Reading and parsing ActivityNet. - youtube_ids = mmcv.load(input).keys() + youtube_ids = mmengine.load(input).keys() # Creates folders where videos will be saved later. if not os.path.exists(output_dir): os.makedirs(output_dir) @@ -87,7 +87,7 @@ def main(input, output_dir, num_jobs=24): for index in youtube_ids) # Save download report. - mmcv.dump(status_list, 'download_report.json') + mmengine.dump(status_list, 'download_report.json') if __name__ == '__main__': diff --git a/tools/data/gym/download_videos.sh b/tools/data/gym/download_videos.sh index eb62de339b..b52a2750dc 100644 --- a/tools/data/gym/download_videos.sh +++ b/tools/data/gym/download_videos.sh @@ -3,7 +3,7 @@ # set up environment conda env create -f environment.yml source activate gym -pip install "mmcv<2.0.0" +pip install mmengine pip install --upgrade youtube-dl DATA_DIR="../../../data/gym" diff --git a/tools/data/gym/trim_event.py b/tools/data/gym/trim_event.py index bf1fc97ade..11e28835a4 100644 --- a/tools/data/gym/trim_event.py +++ b/tools/data/gym/trim_event.py @@ -3,7 +3,7 @@ import os.path as osp import subprocess -import mmcv +import mmengine data_root = '../../../data/gym' video_root = f'{data_root}/videos' @@ -15,10 +15,10 @@ videos = os.listdir(video_root) videos = set(videos) -annotation = mmcv.load(anno_file) +annotation = mmengine.load(anno_file) event_annotation = {} -mmcv.mkdir_or_exist(event_root) +mmengine.mkdir_or_exist(event_root) for k, v in annotation.items(): if k + '.mp4' not in videos: @@ -55,4 +55,4 @@ if segments is not None: event_annotation[event_name] = segments -mmcv.dump(event_annotation, event_anno_file) +mmengine.dump(event_annotation, event_anno_file) diff --git a/tools/data/gym/trim_subaction.py b/tools/data/gym/trim_subaction.py index bbff90a839..7cf1baa1cc 100644 --- a/tools/data/gym/trim_subaction.py +++ b/tools/data/gym/trim_subaction.py @@ -3,7 +3,7 @@ import os.path as osp import subprocess -import mmcv +import mmengine data_root = '../../../data/gym' anno_root = f'{data_root}/annotations' @@ -14,9 +14,9 @@ events = os.listdir(event_root) events = set(events) -annotation = mmcv.load(event_anno_file) +annotation = mmengine.load(event_anno_file) -mmcv.mkdir_or_exist(subaction_root) +mmengine.mkdir_or_exist(subaction_root) for k, v in annotation.items(): if k + '.mp4' not in events: