RCNN库加载训练数据集的速度有多快?

时间:2017-11-23 03:06:53

标签: deep-learning caffe pycaffe

我使用Faster RCNN library进行深度学习,这里有discussion如何训练自己的数据集。这比我领先一步。

对我来说,我想了解如何设置培训数据集以及如何加载培训?

当我查看代码时,我看到了这行代码

来自imdb = get_imdb(imdb_name)

train_faster_rcnn_alt_opt.py,它会调用factory.py inside datasets folder

factory.py有

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))

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()

我想知道如何为训练加载此imdb名称voc_2007_trainval的训练数据?

编辑: 当我打印__sets[name]() inside def get_imdb(name):时,我会看到以下内容。

p __sets[name]()
<datasets.pascal_voc.pascal_voc object at 0x7fc937383ed0>

这是什么意思?

1 个答案:

答案 0 :(得分:0)

现在我明白了。 lib / datasets / factory.py有

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]()

__设置[姓名]电话

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))

由于我们在training命令中设置了--imdb voc_2007_trainval,它的作用是程序可以加载data/VOCdevkit2007/VOC2007/ImageSets/Main/trainval.txt文件中trainval文件中声明的图像。

如果我们设置--imdb voc_2007_train,则会使用train.txt。所有图像都在JPEGImages文件夹中,注释位于Annotations文件夹中。