class_docstr: This class helps dealing with the invalid images in the dataset by using
  two queue. One queue is used to enqueue seen and valid images from previous
  batches. The other queue is used to dequeue. The class is implemented such
  that the same batch will never have duplicate images. If we can't dequeue a
  valid image, we return None for that instance.
  
  Args:
      queue_size: size the the queue (ideally set it to batch_size). Both queues
                  will be of the same size
class_docstr_tok: ["This","class","helps","dealing","with","the","invalid","images","in","the","dataset","by","using","two","queue",".","One","queue","is","used","to","enqueue","seen","and","valid","images","from","previous","batches",".","The","other","queue","is","used","to","dequeue",".","The","class","is","implemented","such","that","the","same","batch","will","never","have","duplicate","images",".","If","we","ca","n't","dequeue","a","valid","image",",","we","return","None","for","that","instance",".","Args",":","queue_size",":","size","the","the","queue","(","ideally","set","it","to","batch_size",")",".","Both","queues","will","be","of","the","same","size"]
code: def __init__(self, queue_size):
      self.queue_size = queue_size
      # we create a CPU queue to buffer the valid seen images. We use these
      # images to replace the invalid images in the minibatch
      # 2 queues (FIFO) per gpu of size = batch size per gpu (64 img):
      #   a) 1st queue is used only to dequeue seen images. We get images from
      #      this queue only to backfill.
      #   b) 2nd queue is used only to add the new incoming valid seen images
      self.queue_init = False
      self.dequeue_images_queue = None
      self.enqueue_images_queue = None
  
imports: import contextlib
  import logging
  import queue
  from typing import Dict, List
  import numpy
  import torch
  from PIL import Image
  from torch.utils.data import Dataset
  from torch.utils.data.distributed import DistributedSampler
label_desc: Use image node_id 1 to create a new QueueDataset object from inherited base classes: Dataset with example: obj = QueueDataset(queue_size)