Exemple #1
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print('Appending horizontally-flipped training examples...')
        imdb.append_flipped_images()
        print('done')

    print('Preparing training data...')
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print('done')

    return imdb.roidb
Exemple #2
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    """if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        imdb.append_flipped_images()
        print 'done'"""   # think about including this flipping operation again....

    print 'Preparing training data...'
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb
Exemple #3
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        imdb.append_flipped_images()
        print 'done'

    print 'Preparing training data...'
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb
Exemple #4
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        #parse xml annotation
        #box = imdb.roidb[i]实现了解析,因为imdb.roidb = imdb._roidb_handler = pascal_voc.gt_roidb
        imdb.append_flipped_images()
        print 'done'

    print 'Preparing training data...'
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb
Exemple #5
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        # 在训练期间使用水平翻转图像
        # 不光把数据加载进来,还要把翻转之后的数据加载进来,可以数量量加倍
        imdb.append_flipped_images()
        print 'done'

    print 'Preparing training data...'
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            # 准备数据 对roidb做处理 (把之前结果命名更规范一些)
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        imdb.append_flipped_images()
        print 'done'

    print 'Preparing training data...'
    # 训练时是否使用RPN
    if cfg.TRAIN.HAS_RPN:
        # 是否多尺度
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    # 返回imdb中最关键的属性roidb,此时roidb的每个元素包含更多的信息,视gdl或rdl而定
    return imdb.roidb
Exemple #7
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    # cfg.TRAIN.USE_FLIPPED已经定义为TRUE,表示使用水平反转图像(数据增强),防止过拟合
    if cfg.TRAIN.USE_FLIPPED:
        print('Appending horizontally-flipped training examples...'
              )  # clw modify: for py3
        imdb.append_flipped_images()
        print('done')  # clw modify: for py3

    print('Preparing training data...')  # clw modify: for py3
    if cfg.TRAIN.HAS_RPN:  #False
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        # 就是对roidb进行进一步的操作,添加了image.weight.height.max_classes.max_overlaps
        rdl_roidb.prepare_roidb(imdb)
    print('done')  # clw modify: for py3

    return imdb.roidb
Exemple #8
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    if cfg.TRAIN.USE_FLIPPED:
        print('Appending horizontally-flipped training examples...')
        imdb.append_flipped_images()
        print('done')

    print('Preparing training data...')
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            # TODO: fix multiscale training (single scale is already a good trade-off)
            print('#### warning: multi-scale has not been tested.')
            print(
                '#### warning: using single scale by setting IS_MULTISCALE: False.'
            )
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        rdl_roidb.prepare_roidb(imdb)
    print('done')

    return imdb.roidb
Exemple #9
0
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    """if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        imdb.append_flipped_images()
        print 'done'"""                                     # think about including this flipping operation again....

    print 'Preparing training data...'
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
            """print('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
            print(imdb.image_index)
            print(len(imdb.image_index))        # is twice as long as it should be!! <- due to flipping!
            print('&&&&&&&&&&&&&&&&&&&&&&&')"""

    else:
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb
def get_training_roidb(imdb):
    """Returns a roidb (Region of Interest database) for use in training."""
    #cfg.TRAIN.USE_FLIPPED已经定义为TRUE,表示使用水平反转图像(数据增强),防止过拟合
    if cfg.TRAIN.USE_FLIPPED:
        print 'Appending horizontally-flipped training examples...'
        # append_flipped_images:将图片水平对称变换,增加样本数量
        # roidb是imdb的一个成员变量,roidb是一个list(每个元素对应一张图片),list中的元素是一个字典,字典中存放了5个key,分别是boxes信息,每个box的class信息,是否是flipped的标志位,重叠信息gt_overlaps,以及seg_areas;分析该函数可知,将box的值按照水平对称,原先roidb中只有5011个元素,经过水平对称后通过append增加到5011*2=10022个
        imdb.append_flipped_images()
        print('done')

    print('Preparing training data...')
    #cfg.TRAIN.HAS_RPN为false
    if cfg.TRAIN.HAS_RPN:
        if cfg.IS_MULTISCALE:
            gdl_roidb.prepare_roidb(imdb)
        else:
            rdl_roidb.prepare_roidb(imdb)
    else:
        #就是对roidb进行进一步的操作,添加了image.weight.height.max_classes.max_overlaps
        rdl_roidb.prepare_roidb(imdb)
    print 'done'

    return imdb.roidb