mathiaszinnen commited on
Commit
f0cb4ba
·
1 Parent(s): 3124a13

download annotation files

Browse files
Files changed (1) hide show
  1. odor.py +7 -1
odor.py CHANGED
@@ -32,6 +32,8 @@ _HOMEPAGE = "https://zenodo.org/record/10027116"
32
  _LICENSE = "CC BY 4.0"
33
 
34
  _META_URL = 'https://zenodo.org/records/10027116/files/meta.csv?download=1'
 
 
35
 
36
  _CATEGORIES = ['ant', 'camel', 'jewellery', 'frog', 'physalis', 'celery', 'cauliflower', 'pepper', 'ranunculus', 'chess flower', 'cigarette', 'matthiola', 'cabbage', 'earring', 'dandelion', 'neroli', 'dragonfly', 'hyacinth', 'reptile/amphibia', 'apricot', 'snake', 'lizard', 'asparagus', 'spring onion', 'snowflake', 'moth', 'poppy', 'columbine', 'rabbit', 'geranium', 'crab', 'radish', 'big cat', 'jan steen jug', 'monkey', 'snail', 'bellflower', 'lilac', 'pot', 'peony', 'coffeepot', 'hazelnut', 'censer', 'artichoke', 'dahlia', 'sniffing', 'fly', 'deer', 'caterpillar', 'garlic', 'blackberry', 'chalice', 'lobster', 'necklace', 'bug', 'insect', 'prawn', 'bracelet', 'carrot', 'cornflower', 'pumpkin', 'orange', 'walnut', 'cat', 'daisy', 'forget-me-not', 'carafe', 'match', 'beer stein', 'tobacco-box', 'violet', 'pomander', 'bottle', 'candle', 'heliotrope', 'wine bottle', 'strawberry', 'pomegranate', 'whale', 'lily of the valley', 'iris', 'tobacco', 'olive', 'tobacco-packaging', 'meat', 'daffodil', 'melon', 'fire', 'petunia', 'mushroom', 'teapot', 'ring', 'pig', 'ashtray', 'cheese', 'onion', 'cup', 'nut', 'fig', 'drinking vessel', 'donkey', 'holding the nose', 'lily', 'smoke', 'bread', 'currant', 'glass without stem', 'anemone', 'mammal', 'chimney', 'smoking equipment', 'bivalve', 'butterfly', 'gloves', 'lemon', 'horse', 'plum', 'jasmine', 'pear', 'glass with stem', 'vegetable', 'carnation', 'jug', 'goat', 'fish', 'apple', 'tulip', 'cherry', 'cow', 'animal corpse', 'dog', 'fruit', 'bird', 'rose', 'peach', 'sheep', 'pipe', 'grapes', 'flower']
37
 
@@ -77,7 +79,7 @@ class ODOR(datasets.GeneratorBasedBuilder):
77
  for i in range(retries):
78
  try:
79
  r = requests.get(uri, stream=True, timeout=50)
80
- except (MissingSchema, Timeout, ConnectionError, InvalidSchema):
81
  time.sleep(i)
82
  continue
83
  if r.status_code == 200:
@@ -106,6 +108,10 @@ class ODOR(datasets.GeneratorBasedBuilder):
106
 
107
  imgs_dir = f'{self.cache_dir}/images'
108
  _download_file(_META_URL, '.', 'meta.csv', 3)
 
 
 
 
109
  csv_pth = f'./meta.csv'
110
  if not os.path.isdir(imgs_dir):
111
  os.makedirs(imgs_dir)
 
32
  _LICENSE = "CC BY 4.0"
33
 
34
  _META_URL = 'https://zenodo.org/records/10027116/files/meta.csv?download=1'
35
+ _TRAIN_JSON_URL = 'https://zenodo.org/records/10027116/files/instances_train.json?download=1'
36
+ _TEST_JSON_URL = 'https://zenodo.org/records/10027116/files/instances_test.json?download=1'
37
 
38
  _CATEGORIES = ['ant', 'camel', 'jewellery', 'frog', 'physalis', 'celery', 'cauliflower', 'pepper', 'ranunculus', 'chess flower', 'cigarette', 'matthiola', 'cabbage', 'earring', 'dandelion', 'neroli', 'dragonfly', 'hyacinth', 'reptile/amphibia', 'apricot', 'snake', 'lizard', 'asparagus', 'spring onion', 'snowflake', 'moth', 'poppy', 'columbine', 'rabbit', 'geranium', 'crab', 'radish', 'big cat', 'jan steen jug', 'monkey', 'snail', 'bellflower', 'lilac', 'pot', 'peony', 'coffeepot', 'hazelnut', 'censer', 'artichoke', 'dahlia', 'sniffing', 'fly', 'deer', 'caterpillar', 'garlic', 'blackberry', 'chalice', 'lobster', 'necklace', 'bug', 'insect', 'prawn', 'bracelet', 'carrot', 'cornflower', 'pumpkin', 'orange', 'walnut', 'cat', 'daisy', 'forget-me-not', 'carafe', 'match', 'beer stein', 'tobacco-box', 'violet', 'pomander', 'bottle', 'candle', 'heliotrope', 'wine bottle', 'strawberry', 'pomegranate', 'whale', 'lily of the valley', 'iris', 'tobacco', 'olive', 'tobacco-packaging', 'meat', 'daffodil', 'melon', 'fire', 'petunia', 'mushroom', 'teapot', 'ring', 'pig', 'ashtray', 'cheese', 'onion', 'cup', 'nut', 'fig', 'drinking vessel', 'donkey', 'holding the nose', 'lily', 'smoke', 'bread', 'currant', 'glass without stem', 'anemone', 'mammal', 'chimney', 'smoking equipment', 'bivalve', 'butterfly', 'gloves', 'lemon', 'horse', 'plum', 'jasmine', 'pear', 'glass with stem', 'vegetable', 'carnation', 'jug', 'goat', 'fish', 'apple', 'tulip', 'cherry', 'cow', 'animal corpse', 'dog', 'fruit', 'bird', 'rose', 'peach', 'sheep', 'pipe', 'grapes', 'flower']
39
 
 
79
  for i in range(retries):
80
  try:
81
  r = requests.get(uri, stream=True, timeout=50)
82
+ except (MissingSchema, Timeout, ConnectionError):
83
  time.sleep(i)
84
  continue
85
  if r.status_code == 200:
 
108
 
109
  imgs_dir = f'{self.cache_dir}/images'
110
  _download_file(_META_URL, '.', 'meta.csv', 3)
111
+ if not os.path.isdir('./annotations'):
112
+ os.path.makedirs('./annotations')
113
+ _download_file(_TRAIN_JSON_URL, './annotations', 'train.json')
114
+ _download_file(_TEST_JSON_URL, './annotations', 'test.json')
115
  csv_pth = f'./meta.csv'
116
  if not os.path.isdir(imgs_dir):
117
  os.makedirs(imgs_dir)