Skip to content

Instantly share code, notes, and snippets.

@tkshnkmr
Last active November 5, 2019 12:50
Show Gist options
  • Save tkshnkmr/0cb67b01b308f1634633bd6a46daa990 to your computer and use it in GitHub Desktop.
Save tkshnkmr/0cb67b01b308f1634633bd6a46daa990 to your computer and use it in GitHub Desktop.
# path to your own data and coco file
train_data_dir = 'my_data/train'
train_coco = 'my_data/my_train_coco.json'
# create own Dataset
my_dataset = myOwnDataset(root=train_data_dir,
annotation=train_coco,
transforms=get_transform()
)
# collate_fn needs for batch
def collate_fn(batch):
return tuple(zip(*batch))
# Batch size
train_batch_size = 1
# own DataLoader
data_loader = torch.utils.data.DataLoader(my_dataset,
batch_size=train_batch_size,
shuffle=True,
num_workers=4,
collate_fn=collate_fn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment