Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few small fixes #77

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion modules/csv_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def TTV(csv_dir, name_file, args_y):
'''
CSV = os.path.join(csv_dir, name_file)
error_csv(name_file, csv_dir, args_y)

# Let the user know what's going on. Some of these files have over a GB and it takes a while to load them.
print("Loading CSV file...")
df_val = pd.read_csv(CSV)
return df_val

Expand All @@ -37,7 +40,7 @@ def error_csv(file, csv_dir, args_y):
else:
ans = input(bc.OKBLUE + "Do you want to download the missing file? [Y/n] " + bc.ENDC)

if ans.lower() == 'y':
if ans.lower() == 'y' or ans == '':
folder = str(os.path.basename(file)).split('-')[0]
if folder != 'class':
FILE_URL = str(OID_URL + folder + '/' + file)
Expand Down
3 changes: 2 additions & 1 deletion modules/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from modules.utils import images_options
from modules.utils import bcolors as bc
from multiprocessing.dummy import Pool as ThreadPool
import subprocess

def download(args, df_val, folder, dataset_dir, class_name, class_code, class_list=None, threads = 20):
'''
Expand Down Expand Up @@ -77,7 +78,7 @@ def download_img(folder, dataset_dir, class_name, images_list, threads):
command = 'aws s3 --no-sign-request --only-show-errors cp s3://open-images-dataset/' + path
commands.append(command)

list(tqdm(pool.imap(os.system, commands), total = len(commands) ))
list(tqdm(pool.imap(lambda c: subprocess.call(c, shell=True), commands), total = len(commands) ))

print(bc.INFO + 'Done!' + bc.ENDC)
pool.close()
Expand Down