From 1b4057da55d32f6cea055038cd1c20b0765ac300 Mon Sep 17 00:00:00 2001 From: Brandon Amos Date: Wed, 2 Mar 2016 10:40:43 -0500 Subject: [PATCH] VGG Download: Use all images, timeout URL requests. --- data/vgg/download-and-align.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data/vgg/download-and-align.py b/data/vgg/download-and-align.py index bfdd583..c1e9c47 100755 --- a/data/vgg/download-and-align.py +++ b/data/vgg/download-and-align.py @@ -64,8 +64,8 @@ for person in os.listdir(args.txt): for line in contents: id, uid, url, l, t, r, b, pose, detection, curation = line.split() l, t, r, b = [int(float(x)) for x in [l, t, r, b]] - if int(curation) == 1: - jobs.append((person[:-4], url, (l, t, r, b))) + # if int(curation) == 1: + jobs.append((person[:-4], url, (l, t, r, b))) def download(person, url, bb): @@ -80,7 +80,7 @@ def download(person, url, bb): mkdirP(alignedPersonPath) if not os.path.isfile(rawImgPath): - urlF = urllib2.urlopen(url) + urlF = urllib2.urlopen(url, timeout=5) with open(rawImgPath, 'wb') as f: f.write(urlF.read()) @@ -104,7 +104,8 @@ def download(person, url, bb): def download_packed(args): try: download(*args) - except: + except Exception as e: + print("\n".join((str(args), str(e)))) pass pool = Pool(16)