I’m using VOCSegmentation() from here https://pytorch.org/docs/stable/_modules/torchvision/datasets/voc.html to get the object and pass this instance into torch.utils.data.DataLoader. After loading i get following error while enumerating the " self.train_loader ". I’m loading VOC2012 from pascal_voc dataset. Please can you correct me if doing anything wrong , Here is the code snippet. I appreciate any help on this.
def __init__()
train_dataset = get_segmentation_dataset(args.dataset, split=args.train_split, mode='train', **data_kwargs) # this get_segementation_dataset() will call VOCSegmentation()
self.train_loader = data.DataLoader(dataset=train_dataset,
batch_size=args.batch_size,
shuffle=True,
drop_last=True)
def train(self):
cur_iters = 0
start_time = time.time()
for epoch in range(self.args.start_epoch, self.args.epochs):
self.model.train()
**for i, (images, targets) in enumerate(self.train_loader):**
cur_lr = self.lr_scheduler(cur_iters)
for param_group in self.optimizer.param_groups:
param_group['lr'] = cur_lr
images = images.to(self.args.device)
targets = targets.to(self.args.device)
outputs = self.model(images)