예제 #1
0
def get_dataset(dataset, args):
    if dataset.lower() == 'voc':
        train_dataset = gdata.VOCDetection(
            splits=[(2007, 'trainval'), (2012, 'trainval')])
        val_dataset = gdata.VOCDetection(
            splits=[(2007, 'test')])
        #print(val_dataset.classes)
        #('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor')

        val_metric = VOC07MApMetric(iou_thresh=0.5, class_names=val_dataset.classes)
    elif dataset.lower() == 'coco':
        train_dataset = gdata.COCODetection(splits='instances_train2017', use_crowd=False)
        val_dataset = gdata.COCODetection(splits='instances_val2017', skip_empty=False)
        val_metric = COCODetectionMetric(val_dataset, args.save_prefix + '_eval', cleanup=True)
    elif dataset.lower() == 'pedestrian':
        lst_dataset = LstDetection('train_val.lst',root=os.path.expanduser('.'))
        print(len(lst_dataset))
        first_img = lst_dataset[0][0]

        print(first_img.shape)
        print(lst_dataset[0][1])
        
        train_dataset = LstDetection('train.lst',root=os.path.expanduser('.'))
        val_dataset = LstDetection('val.lst',root=os.path.expanduser('.'))
        classs = ('pedestrian',)
        val_metric = VOC07MApMetric(iou_thresh=0.5,class_names=classs)
        
    else:
        raise NotImplementedError('Dataset: {} not implemented.'.format(dataset))
    if args.mixup:
        from gluoncv.data.mixup import MixupDetection
        train_dataset = MixupDetection(train_dataset)
    return train_dataset, val_dataset, val_metric
예제 #2
0
def get_dataset(dataset, args):
    if dataset.lower() == 'voc':
        if 0:
            train_dataset = gdata.VOCDetection(root='E:/dataset/VOCdevkit',
                                               splits=[(2007, 'trainval'),
                                                       (2012, 'trainval')])
            val_dataset = gdata.VOCDetection(root='E:/dataset/VOCdevkit',
                                             splits=[(2007, 'test')])
            val_metric = VOC07MApMetric(iou_thresh=0.5,
                                        class_names=val_dataset.classes)
        else:
            voc_root = 'G:/MSDataset/'  #layout same with VOC07
            train_dataset = gdata.MSDetection(root=voc_root,
                                              splits=[(2007, 'trainval')])
            val_dataset = gdata.MSDetection(root=voc_root,
                                            splits=[(2007, 'test')])
            val_metric = VOC07MApMetric(iou_thresh=0.5,
                                        class_names=val_dataset.classes)
    elif dataset.lower() == 'coco':
        train_dataset = gdata.COCODetection(splits='instances_train2017',
                                            use_crowd=False)
        val_dataset = gdata.COCODetection(splits='instances_val2017',
                                          skip_empty=False)
        val_metric = COCODetectionMetric(val_dataset,
                                         args.save_prefix + '_eval',
                                         cleanup=True)
    else:
        raise NotImplementedError(
            'Dataset: {} not implemented.'.format(dataset))
    if args.mixup:
        from gluoncv.data.mixup import MixupDetection
        train_dataset = MixupDetection(train_dataset)
    return train_dataset, val_dataset, val_metric
예제 #3
0
def get_dataset(dataset, args):
    if dataset.lower() == 'voc':
        train_dataset = gdata.VOCDetection(
            splits=[(2007, 'trainval'), (2012, 'trainval')])
        val_dataset = gdata.VOCDetection(splits=[(2007, 'test')])
        val_metric = VOC07MApMetric(iou_thresh=0.5,
                                    class_names=val_dataset.classes)
    elif dataset.lower() == 'coco':
        train_dataset = gdata.COCODetection(splits='instances_train2017',
                                            use_crowd=False)
        val_dataset = gdata.COCODetection(splits='instances_val2017',
                                          skip_empty=False)
        val_metric = COCODetectionMetric(val_dataset,
                                         os.path.join(args.logdir, 'eval'),
                                         cleanup=True)
    else:
        raise NotImplementedError(
            'Dataset: {} not implemented.'.format(dataset))
    if cfg.TRAIN.MODE_MIXUP:
        from gluoncv.data.mixup import MixupDetection
        train_dataset = MixupDetection(train_dataset)
    return train_dataset, val_dataset, val_metric
예제 #4
0
def get_dataset(dataset, args):
    if dataset.lower() == 'voc':
        train_dataset = gdata.VOCDetection(root=args.data_path,
            splits=[(2007, 'trainval'), (2012, 'trainval')])
        val_dataset = gdata.VOCDetection(root=args.data_path,
            splits=[(2007, 'test')])
        val_metric = VOC07MApMetric(iou_thresh=0.5, class_names=val_dataset.classes)
    elif dataset.lower() == 'coco':
        #train_dataset = gdata.COCODetection(splits='instances_train2014', use_crowd=False)
        train_dataset = gdata.COCODetection(root=args.data_path, splits='instances_train2017')
        val_dataset = gdata.COCODetection(root=args.data_path, splits='instances_val2017', skip_empty=False)
        val_metric = COCODetectionMetric(val_dataset, args.save_prefix + '_eval', cleanup=True)
    elif dataset.lower() == 'rec':
        train_dataset = gdata.RecordFileDetection(os.path.join(args.data_path, 'pikachu_train.rec'))
        val_dataset = gdata.RecordFileDetection(os.path.join(args.data_path, 'pikachu_train.rec'))
        val_metric = VOC07MApMetric(iou_thresh=0.5, class_names=rec_classes)
    else:
        raise NotImplementedError('Dataset: {} not implemented.'.format(dataset))
    if args.mixup:
        from gluoncv.data.mixup import MixupDetection
        train_dataset = MixupDetection(train_dataset)
    return train_dataset, val_dataset, val_metric