          Returns the targets as a list of 4-dimensional ``numpy.ndarray`` s of shape (`batchsize`,
          `height`, `width`, 3). If the :attr:`batch` is 4 channels, then the masks will be split
          from the batch, with the largest output masks being returned in their own item.
          """
          batch = [tgt.astype("float32") / 255.0 for tgt in batch]
          if all(tgt.shape[-1] == 4 for tgt in batch):
              logger.trace("Batch contains mask")
              sizes = [item.shape[1] for item in batch]
              mask_batch = np.expand_dims(batch[sizes.index(max(sizes))][..., -1], axis=-1)
              batch = [item[..., :3] for item in batch]
              logger.trace("batch shapes: %s, mask_batch shape: %s",
                           [tgt.shape for tgt in batch], mask_batch.shape)
              retval = dict(targets=batch, masks=mask_batch)
          else:
              logger.trace("Batch has no mask")
              retval = dict(targets=batch)
          return retval
  
 
</s> remove     def _separate_target_mask(batch):
 </s> add     def _separate_target_mask(size_list_of_batches): </s> remove             logger.trace("Batch has no mask")
            retval = dict(targets=batch)
 </s> add             masks = [np.ones((size_list_of_batches[-1].shape[:-1] + (1,)), dtype='float32')]
        retval = dict(targets=targets, masks=masks) </s> remove             the format (`batchsize`, `height`, `width`, `1`). **NB:** This item will only exist \
            in the ``dict`` if a batch of 4 channel images has been passed in :attr:`batch`
 </s> add             the format (`batchsize`, `height`, `width`, `1`). </s> remove                                   for image in batch])
 </s> add                                   for image in batch], dtype='float32') / 255. </s> remove         retval = [samples[0:num_images]] if samples is not None else [self.samples[0:num_images]]
        if self.use_mask:
            retval.extend(tgt[0:num_images] for tgt in images)
        else:
            retval.extend(images[0:num_images])
 </s> add         masks = masks if masks is not None else self.masks
        samples = samples if samples is not None else self.samples
        retval = [samples[0:num_images], images[0:num_images], masks[0:num_images]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
          Returns the targets as a list of 4-dimensional ``numpy.ndarray`` s of shape (`batchsize`,
          `height`, `width`, 3). If the :attr:`batch` is 4 channels, then the masks will be split
          from the batch, with the largest output masks being returned in their own item.
          """
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
        targets = [batch[..., :3] for batch in size_list_of_batches]
        if size_list_of_batches[-1].shape[-1] == 4:
            masks = [size_list_of_batches[-1][..., 3:]]
          else:
              logger.trace("Batch has no mask")
              retval = dict(targets=batch)
          return retval
  
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Smart Mask Exposure for Extraction & Training (#831)

Smart Masks - Initial Commit 
lib/training_data.py