Example #1
0
def get_val_dataset(args):
    dboxes = dboxes300_coco()
    val_trans = SSDTransformer(dboxes, (300, 300), val=True)

    val_annotate = os.path.join(args.data, "annotations/instances_val2017.json")
    val_coco_root = os.path.join(args.data, "val2017")

    val_coco = COCODetection(val_coco_root, val_annotate, val_trans)
    return val_coco
Example #2
0
def get_train_pytorch_loader(args, num_workers, default_boxes):
    dataset = COCODetection(
        args.train_coco_root, args.train_annotate,
        SSDTransformer(default_boxes, args, (300, 300), val=False))

    if args.distributed:
        train_sampler = torch.utils.data.distributed.DistributedSampler(
            dataset)
    else:
        train_sampler = None

    train_dataloader = DataLoader(dataset,
                                  batch_size=args.batch_size,
                                  shuffle=(train_sampler is None),
                                  sampler=train_sampler,
                                  drop_last=True,
                                  num_workers=num_workers)

    return train_dataloader
Example #3
0
def get_train_dataset(args, transform):
    train_coco = COCODetection(args.train_coco_root, args.train_annotate,
                               transform)

    return train_coco