              return
          stats = GPUStats().get_card_most_free()
          vram_free = int(stats["free"])
          if self._is_parallel:
              vram_required = self._detector.vram + self._aligner.vram + self._vram_buffer
              batch_required = ((self._aligner.vram_per_batch * self._aligner.batchsize) +
                                (self._detector.vram_per_batch * self._detector.batchsize))
              plugin_required = vram_required + batch_required
              if plugin_required <= vram_free:
                  logger.debug("Plugin requirements within threshold: (plugin_required: %sMB, "
                               "vram_free: %sMB)", plugin_required, vram_free)
                  return
 
</s> remove             for plugin in (self._aligner, self._detector):
 </s> add             for plugin in (self._detector, self._aligner, self._masker): </s> remove             # Hacky split across 2 plugins
            available_vram = (vram_free - vram_required) // 2
            for plugin in (self._aligner, self._detector):
 </s> add             # Hacky split across 3 plugins
            available_vram = (vram_free - vram_required) // 3
            for plugin in (self._detector, self._aligner, self._masker): </s> remove         vram_required = self._detector.vram + self._aligner.vram + self._vram_buffer
 </s> add         vram_required = (self._detector.vram +
                         self._aligner.vram +
                         self._masker.vram +
                         self._vram_buffer) </s> remove         """ Sets the batchsize of the requested plugins based on their vram and
            vram_per_batch_requirements if the the configured batchsize requires more
            vram than is available. Nvidia only. """
        if (self._detector.vram == 0 and self._aligner.vram == 0) or get_backend() != "nvidia":
 </s> add         """ 
        Sets the batchsize of the requested plugins based on their vram and
        vram_per_batch_requirements if the the configured batchsize requires more
        vram than is available. Nvidia only.
        """
        if (self._detector.vram == 0 and self._aligner.vram == 0 and self._masker.vram == 0
            or get_backend() != "nvidia"): </s> remove         figure = np.vstack((header, figure))
 </s> add         figure = np.concatenate((header, figure), axis=0)
            vram_required = (self._detector.vram + self._aligner.vram + self._masker.vram +
                             self._vram_buffer)
            batch_required = ((self._detector.vram_per_batch * self._detector.batchsize) +
                              (self._aligner.vram_per_batch * self._aligner.batchsize) +
                              (self._masker.vram_per_batch * self._masker.batchsize))
              return
          stats = GPUStats().get_card_most_free()
          vram_free = int(stats["free"])
          if self._is_parallel:
            vram_required = (self._detector.vram + self._aligner.vram + self._masker.vram +
                             self._vram_buffer)
            batch_required = ((self._detector.vram_per_batch * self._detector.batchsize) +
                              (self._aligner.vram_per_batch * self._aligner.batchsize) +
                              (self._masker.vram_per_batch * self._masker.batchsize))
            vram_required = (self._detector.vram + self._aligner.vram + self._masker.vram +
                             self._vram_buffer)
            batch_required = ((self._detector.vram_per_batch * self._detector.batchsize) +
                              (self._aligner.vram_per_batch * self._aligner.batchsize) +
                              (self._masker.vram_per_batch * self._masker.batchsize))
            vram_required = (self._detector.vram + self._aligner.vram + self._masker.vram +
                             self._vram_buffer)
            batch_required = ((self._detector.vram_per_batch * self._detector.batchsize) +
                              (self._aligner.vram_per_batch * self._aligner.batchsize) +
                              (self._masker.vram_per_batch * self._masker.batchsize))
              plugin_required = vram_required + batch_required
              if plugin_required <= vram_free:
                  logger.debug("Plugin requirements within threshold: (plugin_required: %sMB, "
                               "vram_free: %sMB)", plugin_required, vram_free)
                  return
keep keep keep keep replace replace replace keep keep keep keep keep
 Smart Mask Exposure for Extraction & Training (#831)

Smart Masks - Initial Commit 
plugins/extract/pipeline.py