MCPcopy Create free account
hub / github.com/MorvanZhou/Tensorflow-Tutorial / download

Function download

tutorial-contents/407_transfer_learning.py:25–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def download(): # download tiger and kittycat image
26 categories = ['tiger', 'kittycat']
27 for category in categories:
28 os.makedirs('./for_transfer_learning/data/%s' % category, exist_ok=True)
29 with open('./for_transfer_learning/imagenet_%s.txt' % category, 'r') as file:
30 urls = file.readlines()
31 n_urls = len(urls)
32 for i, url in enumerate(urls):
33 try:
34 urlretrieve(url.strip(), './for_transfer_learning/data/%s/%s' % (category, url.strip().split('/')[-1]))
35 print('%s %i/%i' % (category, i, n_urls))
36 except:
37 print('%s %i/%i' % (category, i, n_urls), 'no image')
38
39
40def load_img(path):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected