VGG Download: Use all images, timeout URL requests.
This commit is contained in:
parent
f9b8a28f8c
commit
1b4057da55
|
@ -64,8 +64,8 @@ for person in os.listdir(args.txt):
|
||||||
for line in contents:
|
for line in contents:
|
||||||
id, uid, url, l, t, r, b, pose, detection, curation = line.split()
|
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]]
|
l, t, r, b = [int(float(x)) for x in [l, t, r, b]]
|
||||||
if int(curation) == 1:
|
# if int(curation) == 1:
|
||||||
jobs.append((person[:-4], url, (l, t, r, b)))
|
jobs.append((person[:-4], url, (l, t, r, b)))
|
||||||
|
|
||||||
|
|
||||||
def download(person, url, bb):
|
def download(person, url, bb):
|
||||||
|
@ -80,7 +80,7 @@ def download(person, url, bb):
|
||||||
mkdirP(alignedPersonPath)
|
mkdirP(alignedPersonPath)
|
||||||
|
|
||||||
if not os.path.isfile(rawImgPath):
|
if not os.path.isfile(rawImgPath):
|
||||||
urlF = urllib2.urlopen(url)
|
urlF = urllib2.urlopen(url, timeout=5)
|
||||||
with open(rawImgPath, 'wb') as f:
|
with open(rawImgPath, 'wb') as f:
|
||||||
f.write(urlF.read())
|
f.write(urlF.read())
|
||||||
|
|
||||||
|
@ -104,7 +104,8 @@ def download(person, url, bb):
|
||||||
def download_packed(args):
|
def download_packed(args):
|
||||||
try:
|
try:
|
||||||
download(*args)
|
download(*args)
|
||||||
except:
|
except Exception as e:
|
||||||
|
print("\n".join((str(args), str(e))))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
pool = Pool(16)
|
pool = Pool(16)
|
||||||
|
|
Loading…
Reference in New Issue