Skip to content

Commit

Permalink
replace mmcv with mmengine
Browse files Browse the repository at this point in the history
  • Loading branch information
yhZhai committed May 25, 2023
1 parent 12a453d commit 82dac3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tools/data/gym/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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__':
Expand Down
2 changes: 1 addition & 1 deletion tools/data/gym/download_videos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions tools/data/gym/trim_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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)
6 changes: 3 additions & 3 deletions tools/data/gym/trim_subaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down

0 comments on commit 82dac3c

Please sign in to comment.