# --------------------------------------------------------
# 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."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

__sets = {}
from datasets.imagenet import imagenet
from datasets.snubh_bus import snubh_bus
from datasets.stanford_dog import stanford_dog

import numpy as np
                
# set up image net.
for split in ['train', 'val', 'val1', 'val2', 'test']:
    name = 'imagenet_{}'.format(split)
    devkit_path = 'data/imagenet/ILSVRC/devkit'
    data_path = 'data/imagenet/ILSVRC'
    __sets[name] = (lambda split=split, devkit_path=devkit_path, data_path=data_path: imagenet(split,devkit_path,data_path))

for split in ['s_train','test','test_normal','ws_train','ws_test','al_train', 'al_malign_train', 'al_benign_train']:
    name = 'SNUBH_BUS_{}'.format(split)
    data_path = 'data/SNUBH_BUS'
    __sets[name] = (lambda split = split, data_path = data_path: snubh_bus(split, data_path))

for split in ['s_train', 'ws_train', 'test', 'ws_test', 'al_train', 'al_malign_train', 'al_benign_train']:
    name = 'Stanford_Dog_{}'.format(split)
    data_path = 'data/Stanford_Dog/'
    __sets[name] = (lambda split=split, data_path = data_path: stanford_dog(split, data_path))

def get_imdb(name):
    """Get an imdb (image database) by name."""
    if name not in __sets:
        raise KeyError('Unknown dataset: {}'.format(name))
    return __sets[name]()


def list_imdbs():
    """List all registered imdbs."""
    return list(__sets.keys())
