forked from rbgirshick/py-faster-rcnn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory.py
56 lines (44 loc) · 1.78 KB
/
factory.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
__sets = {}
from datasets.pascal_voc import pascal_voc
from datasets.coco import coco
from datasets.skive import skive
from datasets.ism_hero import ism_hero
import numpy as np
# Set up voc_<year>_<split> using selective search "fast" mode
# for year in ['2007', '2012']:
# for split in ['train', 'val', 'trainval', 'test']:
# name = 'voc_{}_{}'.format(year, split)
# __sets[name] = (lambda split=split, year=year: pascal_voc(split, year))
# Set up coco_2014_<split>
# for year in ['2014']:
# for split in ['train', 'val', 'minival', 'valminusminival']:
# name = 'coco_{}_{}'.format(year, split)
# __sets[name] = (lambda split=split, year=year: coco(split, year))
# Set up coco_2015_<split>
# for year in ['2015']:
# for split in ['test', 'test-dev']:
# name = 'coco_{}_{}'.format(year, split)
# __sets[name] = (lambda split=split, year=year: coco(split, year))
# Set up skive_<split>
for split in ["train", "val", "trainval"]:
name = "skive_{}".format(split)
__sets[name] = (lambda split=split: skive(split))
# Set up ism_hero_<split>
for split in ["train", "val", "trainval"]:
name = "ism_hero_{}".format(split)
__sets[name] = (lambda split=split: ism_hero(split))
def get_imdb(name):
"""Get an imdb (image database) by name."""
if not __sets.has_key(name):
raise KeyError('Unknown dataset: {}'.format(name))
return __sets[name]()
def list_imdbs():
"""List all registered imdbs."""
return __sets.keys()