1. 程式人生 > 實用技巧 >Python script to download the vot tracking datasets (tested on vot 2019 main, rgb-thermal dataset)

Python script to download the vot tracking datasets (tested on vot 2019 main, rgb-thermal dataset)

Python script to download the vot tracking datasets (tested on vot 2019 main, rgb-thermal dataset)

2020-08-0520:33:19

Content:

  • Approach to download vot-2019 dataset;
  • Approach to download vot-2019-rgbt dataset;
  • for the rgb-depth videos, or long-term videos, you can modify the code yourself to download them all.
  • Baiduyun links for vot-2019, vot-2019lt, vot-rgb-thermal dataset.

Approach to download vot-2019 dataset;

1. open this page:https://github.com/votchallenge/vot-toolkit/blob/master/stacks/stack_vot2019.mfor the json file.

2. wgethttp://data.votchallenge.net/vot2019/main/description.json

3. execute the following python script.

import json
import os
import wget,tarfile,zipfile
 
vot_2019_path = '/home/wangxiao/Documents/dataset/vot2019/'      # object file
json_path = '/home/wangxiao/Downloads/description.json'  # vot 2019 json file
anno_vot = 'vot2019'                           # vot2019 or vot2018 or vot2017
 
 
with open(json_path,'r'
) as fd: vot_2019 = json.load(fd) home_page = vot_2019['homepage'] for i,sequence in enumerate(vot_2019['sequences']): print('download the {} sequences'.format(i+1)) # annotations = sequence['annotations']['url'] data_url = sequence['channels']['color']['url'].split('../../')[-1] name = annotations.split('.')[0] file_name = annotations.split('.')[0] + '.zip' down_annotations = os.path.join(home_page,anno_vot,'main',annotations) down_data_url = os.path.join(home_page,data_url) image_output_name = os.path.join(vot_2019_path,name,'color',file_name) anno_output_name = os.path.join(vot_2019_path,name,file_name) out_dir = os.path.dirname(anno_output_name) if os.path.exists(out_dir) == False: os.mkdir(out_dir) # annotations download and unzip and remove it wget.download(down_annotations, anno_output_name) print('loading {} annotation'.format(name)) # unzip file_zip = zipfile.ZipFile(anno_output_name,'r') for file in file_zip.namelist(): file_zip.extract(file, out_dir) print('extract annotation {}/{}'.format(name,file)) file_zip.close() os.remove(anno_output_name) print('remove annotation {}.zip'.format(name)) # image download and unzip ad remove it out_dir = os.path.dirname(image_output_name) if os.path.exists(out_dir) == False: os.mkdir(out_dir) wget.download(down_data_url,image_output_name) print('loading {} sequence'.format(name)) file_zip = zipfile.ZipFile(image_output_name,'r') for file in file_zip.namelist(): file_zip.extract(file,out_dir) print('extract image {}'.format(file)) file_zip.close() os.remove(image_output_name) print('remove image file {}.zip'.format(name)) print('sequence {} Completed!'.format(i+1))

Approach to download vot-2019-rgb-thermal dataset;

1. open this page:https://github.com/votchallenge/vot-toolkit/blob/master/stacks/stack_vot2019_rgbtir.m, and copy the link for the json file.

2. wgethttp://data.votchallenge.net/vot2019/rgbtir/meta/description.json

3. python download_vot2019_rgbt_dataet_script.py

##################################################################################################
####            Download the VOT2019-rgbt-thermal dataset
##################################################################################################


import
json import os import wget,tarfile,zipfile import pdb vot_2019_path = '/home/wangxiao/Documents/dataset/vot2019_rgbt_dataset/' # object file json_path = '/home/wangxiao/Downloads/description_rgbt.json' # vot 2019 json file anno_vot = 'vot2019' # vot2019 or vot2018 or vot2017 with open(json_path,'r') as fd: vot_2019 = json.load(fd) home_page = vot_2019['homepage'] for i,sequence in enumerate(vot_2019['sequences']): print('download the {} sequences'.format(i+1)) # annotations = sequence['annotations']['url'] rgb_data_url = sequence['channels']['color']['url'].split('../')[-1] ir_data_url = sequence['channels']['ir']['url'].split('../')[-1] name = annotations.split('.')[0] file_name = annotations.split('.')[0] + '.zip' down_annotations = os.path.join(home_page, anno_vot,'rgbtir/meta', annotations) down_rgb_data_url = os.path.join(home_page, anno_vot, 'rgbtir', rgb_data_url) down_ir_data_url = os.path.join(home_page, anno_vot, 'rgbtir', ir_data_url) rgb_image_output_name = os.path.join(vot_2019_path, name, 'color', file_name) ir_image_output_name = os.path.join(vot_2019_path, name, 'ir', file_name) anno_output_name = os.path.join(vot_2019_path, name, file_name) out_dir = os.path.dirname(anno_output_name) if os.path.exists(out_dir) == False: os.mkdir(out_dir) # pdb.set_trace() ########################################################################### #### Download Annotation files ########################################################################### # annotations download and unzip and remove it wget.download(down_annotations, anno_output_name) print('loading {} annotation'.format(name)) # unzip file_zip = zipfile.ZipFile(anno_output_name,'r') for file in file_zip.namelist(): file_zip.extract(file, out_dir) print('extract annotation {}/{}'.format(name,file)) file_zip.close() os.remove(anno_output_name) print('remove annotation {}.zip'.format(name)) ########################################################################### #### Download Color images ########################################################################### # image download and unzip ad remove it out_dir = os.path.dirname(rgb_image_output_name) if os.path.exists(out_dir) == False: os.mkdir(out_dir) # pdb.set_trace() wget.download(down_rgb_data_url, rgb_image_output_name) print('loading {} sequence --- rgb files ...'.format(name)) file_zip = zipfile.ZipFile(rgb_image_output_name,'r') for file in file_zip.namelist(): file_zip.extract(file,out_dir) print('extract image {}'.format(file)) file_zip.close() os.remove(rgb_image_output_name) print('remove image file {}.zip'.format(name)) print('sequence {} Completed!'.format(i+1)) ########################################################################### #### Download Infrared images ########################################################################### # image download and unzip ad remove it out_dir = os.path.dirname(ir_image_output_name) if os.path.exists(out_dir) == False: os.mkdir(out_dir) # pdb.set_trace() wget.download(down_ir_data_url, ir_image_output_name) print('loading {} sequence --- infrared files ...'.format(name)) file_zip = zipfile.ZipFile(ir_image_output_name, 'r') for file in file_zip.namelist(): file_zip.extract(file,out_dir) print('extract image {}'.format(file)) file_zip.close() os.remove(ir_image_output_name) print('remove image file {}.zip'.format(name)) print('sequence {} Completed!'.format(i+1)) print("=====================================================================") print(" Great!!! All videos have been dowloaded ......") print("=====================================================================")

4. Then, you can download videos automatically.

====>> If you are lazy, well, I have downloaded all the videos and uploaded them into the Baiduyun disk. You can take it alway, and No Thanks!

Baiduyun disk:

vot 2018 and vot 2019:https://pan.baidu.com/s/1q6lv3cUhezBb5pmdj3BRGw 提取碼: d7r3

vot 2018 lt:連結: https://pan.baidu.com/s/16Q4_sxhBjmddIHU8b7XK3w 提取碼: 67xf

vot 2019 lt:

vot 2019 rgb-thermal:

Reference:

1. csdn blog