ValueError: too many values to unpack (expected 2) from output

I’m using VOCSegmentation() from here to get the object and pass this instance into 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,

  def train(self):
       cur_iters = 0
       start_time = time.time()
       for epoch in range(self.args.start_epoch, self.args.epochs):

           **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 =
               targets =

               outputs = self.model(images)

When you write for i, (images, targets) in enumerate(self.train_loader), you expect the train_loader to return 2 elements at every iteration. It looks like it returns more in your case.
You can for for i, loader_data in enumerate(self.train_loader) to get the loader datas and inspect them to see why there isn’t the number you expect.