zoukankan      html  css  js  c++  java
  • 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-05 20: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.m for the json file. 

    2. wget http://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. wget http://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 just want the dataset, well, I have downloaded all the videos and uploaded them into the Baiduyun drive. You can take it away, 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:       链接:https://pan.baidu.com/s/1z9HBPNprbt2gb2RGzRJkwA  提取码:7yq5

    vot 2019 rgb-thermal:   链接: https://pan.baidu.com/s/1oT8qFmKBpYa3VlXP1ZwfCA 提取码: mn1b

     

    Reference: 

    1. csdn blog

     

  • 相关阅读:
    阿里云的一道面试题:写一个爬取文档树和通过输入关键字检索爬取的内容的demo
    linux配置SVN,添加用户,配置用户组的各个权限教程
    logback的使用和配置|logback比log4j的优点|logback是一个更好的log4j
    [已解决]mysql查询一周内的数据,解决一周的起始日期是从星期日(星期天|周日|周天)开始的问题
    MySql-----InnoDB记录存储结构-----1
    Mysql----字符集和比较规则
    Mysql-----启动和配置文件-----2(未完,待续)
    MySql----前言有点用----1
    Java高并发--------并行模式和算法(需要看更多的东西,才能总结)---------5
    Java高并发------锁优化及注意事项--------4
  • 原文地址:https://www.cnblogs.com/wangxiaocvpr/p/13442597.html
Copyright © 2011-2022 走看看