网站大量收购独家精品文档,联系QQ:2885784924

ActivityNet数据集下载过程.pdf

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ActivityNet数据集下载过程 准备⼯作 : 安装anaconda pip install youtube-dl sudo apt install ffmpeg pip install pafy 1.⾸先利⽤如下命令,将该 ithub项 ⽬下载下来。或者直接去 ithub上进⾏下载 git clone /activitynet/ActivityNet.git 2.进⼊到Crawler⽂件夹下 4.利⽤下⾯命令创建⼀个存放将要下载的数据集的⽂件夹 mkdir dataset 5.随便建⼀个⼯程,新建⼀个python file⽂档,,将下⾯的代码拷贝进去 6.在ActivityNet官⽹上下载j son⽂件 : 另保存⽂件 :activity_net.v 1-3.min.j son 将其复制到Crawler⽂件夹下 7. 将下⾯代码的 directory = dataset/按照你 ⾃⼰的重新要求命名,注意后⾯的 ‘/’不能少。 8. cd 到download.py所在的⽬录,执⾏python 就可以下载啦 import os import j son import uuid import lob import subprocess from j oblib import delayed from j oblib import Parallel # specify download directory directory = dataset/ videoCounter = 0 num_j obs = 24 # open j son file with open(activity_net.v 1-3.min.j son) as data_file: data = j son.load(data_file) # take only video informations from database obj ect videos = data[database] total = len(videos) # iterate throu h dictionary of videos def download_clip(videos, i, key, directory, total): video = videos[key] # find video subset subset = video[subset] # find video label annotations = video[annotations] label = if len(annotations) != 0: label = annotations[0] [label] label = / + label.replace( , _) # create folder named as label if does not exist label_dir = directory + subset + label if not os.path.exists(label_dir): os.makedirs(label_dir) # take url of video url = video[url] tmp_dir = tmp url_base = /watch?v= video_identifier = key tmp_filename = os.path.j oin(tmp_dir, %s.%%(ext)s % uuid.uuid4 ()) command = [youtube-dl, --quiet, --no-warnin s, -f, mp4, -o, %s % tmp_filename, %s % (url_base + video_identifier)] command = .j oin(command) attempts = 0 num_attempts = 5

文档评论(0)

181****7662 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档