From b6a66aca46b2c09034090a72b9a48db0f9445d53 Mon Sep 17 00:00:00 2001 From: hmph Date: Mon, 15 Jul 2019 21:27:25 +0100 Subject: [PATCH] update readme --- README.md | 8 +-- third_party/activity_net/download.py | 88 ---------------------------- 2 files changed, 4 insertions(+), 92 deletions(-) delete mode 100644 third_party/activity_net/download.py diff --git a/README.md b/README.md index 4932fca..6550a43 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ Exploiting temporal context for 3D human pose estimation in the wild == - [Exploiting temporal context for 3D human pose estimation in the wild](http://arxiv.org/abs/1905.04266) uses temporal information from videos to correct errors in single-image 3D pose estimation. In this repository, we provide results from applying this algorithm on the [Kinetics-400](https://deepmind.com/research/open-source/open-source-datasets/kinetics/) dataset. Note that this is not an exhaustive labeling: at most one person is labeled per frame, and frames which the algorithm has identified as outliers are not labeled. @@ -27,18 +26,19 @@ This [Tensorflow checkpoint](https://storage.cloud.google.com/temporal-3d-pose-k - You need to install [`youtube-dl`](https://github.com/ytdl-org/youtube-dl) and [`ffmpeg`](http://ffmpeg.org) to download the Kinetics videos to visualise. - Download the faces of the SMPL mesh for visualisation: `wget https://github.com/akanazawa/hmr/raw/master/src/tf_smpl/smpl_faces.npy` -- The python packages needed are in `requirements.txt`. We recommend create a new virtual environment, and running `pip install -r requirements.txt`. +- Download the Kinetics download script from [ActivityNet](https://github.com/activitynet/ActivityNet/blob/master/Crawler/Kinetics/download.py) and place it in `third_party/activity_net`. This can be done with: `wget https://raw.githubusercontent.com/activitynet/ActivityNet/master/Crawler/Kinetics/download.py -P third_party/activity_net`. We tested with commit 530ac3a of the download script. +- The python packages needed are in `requirements.txt`. We recommend creating a new virtual environment, and running `pip install -r requirements.txt`. To run the demo: `python run_visualise --filename ` ## Credits -- The Kinetics download scripts are from [ActivityNet](https://github.com/activitynet/ActivityNet/tree/master/Crawler/Kinetics) - The renderer to visualise the SMPL model is from [HMR]( https://github.com/akanazawa/hmr) +- The Kinetics download script is from [ActivityNet](https://github.com/activitynet/ActivityNet/tree/master/Crawler/Kinetics) -## Reference +## Reference If you use this data, please cite ```tex diff --git a/third_party/activity_net/download.py b/third_party/activity_net/download.py deleted file mode 100644 index be50615..0000000 --- a/third_party/activity_net/download.py +++ /dev/null @@ -1,88 +0,0 @@ -""" -https://github.com/activitynet/ActivityNet/blob/master/Crawler/Kinetics/download.py -""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import glob -import os -import subprocess -import uuid - - -def download_clip(video_identifier, - output_filename, - start_time, - end_time, - tmp_dir='/tmp/kinetics', - num_attempts=5, - url_base='https://www.youtube.com/watch?v='): - """Download a video from youtube if exists and is not blocked. - - - Args: - video_identifier: str. Unique YouTube video identifier (11 characters) - output_filename: str File path where the video will be stored. - start_time: float Indicates the beginning time in seconds from where the - video will be trimmed. - end_time: float Indicates the ending time in seconds of the trimmed - video. - - Returns: - status: boolean. Whether the downloaded succeeded - message: str. Error message if download did not succeed - - """ - # Defensive argument checking. - assert isinstance(video_identifier, str), 'video_identifier must be string' - assert isinstance(output_filename, str), 'output_filename must be string' - assert len(video_identifier) == 11, 'video_identifier must have length 11' - - if os.path.exists(output_filename): - return True, 'Downloaded' - - status = False - # Construct command line for getting the direct video link. - tmp_filename = os.path.join(tmp_dir, '%s.%%(ext)s' % uuid.uuid4()) - command = [ - 'youtube-dl', '--quiet', '--no-warnings', '-f', 'mp4', '-o', - '"%s"' % tmp_filename, - '"%s"' % (url_base + video_identifier) - ] - command = ' '.join(command) - attempts = 0 - while True: - try: - _ = subprocess.check_output( - command, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as err: - attempts += 1 - if attempts == num_attempts: - return status, err.output - else: - break - - tmp_filename = glob.glob('%s*' % tmp_filename.split('.')[0])[0] - # Construct command to trim the videos (ffmpeg required). - command = [ - 'ffmpeg', '-i', - '"%s"' % tmp_filename, '-ss', - str(start_time), '-t', - str(end_time - start_time), '-c:v', 'libx264', '-c:a', 'copy', '-threads', - '1', '-loglevel', 'panic', - '"%s"' % output_filename - ] - command = ' '.join(command) - try: - output = subprocess.check_output( - command, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as err: - return status, err.output - - # Check if the video was successfully saved. - status = os.path.exists(output_filename) - os.remove(tmp_filename) - return status, 'Downloaded' -