Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions research/delf/delf/python/datasets/sfm120k/dataset_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Structure-from-Motion dataset (Sfm120k) download function."""

import os
import subprocess

import tensorflow as tf

Expand Down Expand Up @@ -49,18 +50,18 @@ def download_train(data_dir):
print('>> Image directory does not exist. Creating: {}'.format(dst_dir))
tf.io.gfile.makedirs(dst_dir)
print('>> Downloading ims.tar.gz...')
os.system('wget {} -O {}'.format(src_file, dst_file))
subprocess.run(['wget', src_file, '-O', dst_file], check=True)
print('>> Extracting {}...'.format(dst_file))
os.system('tar -zxf {} -C {}'.format(dst_file, dst_dir))
subprocess.run(['tar', '-zxf', dst_file, '-C', dst_dir], check=True)
print('>> Extracted, deleting {}...'.format(dst_file))
os.system('rm {}'.format(dst_file))
subprocess.run(['rm', dst_file], check=True)

# Create symlink for train/retrieval-SfM-30k/.
dst_dir_old = os.path.join(datasets_dir, 'retrieval-SfM-120k', 'ims')
dst_dir = os.path.join(datasets_dir, 'retrieval-SfM-30k', 'ims')
if not (tf.io.gfile.exists(dst_dir) or os.path.islink(dst_dir)):
tf.io.gfile.makedirs(os.path.join(datasets_dir, 'retrieval-SfM-30k'))
os.system('ln -s {} {}'.format(dst_dir_old, dst_dir))
subprocess.run(['ln', '-s', dst_dir_old, dst_dir], check=True)
print(
'>> Created symbolic link from retrieval-SfM-120k/ims to '
'retrieval-SfM-30k/ims')
Expand Down Expand Up @@ -89,7 +90,7 @@ def download_train(data_dir):
if not os.path.isfile(dst_file):
print('>> DB file {} does not exist. Downloading...'.format(
download_files[i]))
os.system('wget {} -O {}'.format(src_file, dst_file))
subprocess.run(['wget', src_file, '-O', dst_file], check=True)

if download_eccv2020:
eccv2020_dst_file = os.path.join(dst_dir, download_eccv2020)
Expand All @@ -99,5 +100,5 @@ def download_train(data_dir):
eccv2020_dst_file = os.path.join(dst_dir, download_eccv2020)
eccv2020_src_file = os.path.join(eccv2020_src_dir,
download_eccv2020)
os.system('wget {} -O {}'.format(eccv2020_src_file,
eccv2020_dst_file))
subprocess.run(['wget', eccv2020_src_file, '-O', eccv2020_dst_file],
check=True)