Skip to content

Commit 10af8e8

Browse files
committed
Update oxfordflowers.py
1 parent e16dcfa commit 10af8e8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tllib/vision/datasets/oxfordflowers.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class OxfordFlowers102(ImageList):
2828
transformed version. E.g, :class:`torchvision.transforms.RandomCrop`.
2929
target_transform (callable, optional): A function/transform that takes in the target and transforms it.
3030
"""
31+
download_list = [
32+
("image_list", "image_list.zip", "https://cloud.tsinghua.edu.cn/f/161c7b222d6745408201/?dl=1"),
33+
("train", "train.tgz", "https://cloud.tsinghua.edu.cn/f/59b6a3fa3dac4404aa3b/?dl=1"),
34+
("test", "test.tgz", "https://cloud.tsinghua.edu.cn/f/ec77da479dfb471982fb/?dl=1")
35+
]
3136
CLASSES = ['pink primrose', 'hard-leaved pocket orchid', 'canterbury bells', 'sweet pea', 'english marigold',
3237
'tiger lily', 'moon orchid', 'bird of paradise', 'monkshood', 'globe thistle', 'snapdragon',
3338
"colt's foot", 'king protea', 'spear thistle', 'yellow iris', 'globe-flower', 'purple coneflower',
@@ -45,10 +50,11 @@ class OxfordFlowers102(ImageList):
4550
'hibiscus', 'columbine', 'desert-rose', 'tree mallow', 'magnolia', 'cyclamen', 'watercress',
4651
'canna lily', 'hippeastrum', 'bee balm', 'ball moss', 'foxglove', 'bougainvillea', 'camellia',
4752
'mallow', 'mexican petunia', 'bromelia', 'blanket flower', 'trumpet creeper', 'blackberry lily']
53+
4854
def __init__(self, root, split='train', download=False, **kwargs):
4955
if download:
50-
download_data(root, "oxford_flowers102", "oxford_flowers102.tgz", "https://cloud.tsinghua.edu.cn/f/61cb20241c1d43279d80/?dl=1")
56+
list(map(lambda args: download_data(root, *args), self.download_list))
5157
else:
52-
check_exits(root, "oxford_flowers102")
53-
root = os.path.join(root, "oxford_flowers102")
54-
super(OxfordFlowers102, self).__init__(root, OxfordFlowers102.CLASSES, os.path.join(root, 'imagelist', '{}.txt'.format(split)), **kwargs)
58+
list(map(lambda file_name, _: check_exits(root, file_name), self.download_list))
59+
super(OxfordFlowers102, self).__init__(root, OxfordFlowers102.CLASSES,
60+
os.path.join(root, 'image_list', '{}.txt'.format(split)), **kwargs)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy