              if plugin_required <= vram_free:
                  logger.debug("Plugin requirements within threshold: (plugin_required: %sMB, "
                               "vram_free: %sMB)", plugin_required, vram_free)
                  return
              # Hacky split across 2 plugins
              available_vram = (vram_free - vram_required) // 2
              for plugin in (self._aligner, self._detector):
                  self._set_plugin_batchsize(plugin, available_vram)
          else:
              for plugin in (self._aligner, self._detector):
                  vram_required = plugin.vram + self._vram_buffer
                  batch_required = plugin.vram_per_batch * plugin.batchsize
 
</s> remove             for plugin in (self._aligner, self._detector):
 </s> add             for plugin in (self._detector, self._aligner, self._masker): </s> remove             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))
 </s> add             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)) </s> remove                 offset:offset + foregrounds[idx].shape[1]] = foregrounds[idx]
 </s> add                 offset:offset + foregrounds[idx].shape[1], :3] = foregrounds[idx] </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             image = cv2.copyMakeBorder(  # pylint:disable=no-member
                image,
                pad_t,
                pad_b,
                pad_l,
                pad_r,
                cv2.BORDER_CONSTANT)  # pylint:disable=no-member
 </s> add             image = cv2.copyMakeBorder(image,  # pylint:disable=no-member
                                       pad_t,
                                       pad_b,
                                       pad_l,
                                       pad_r,
                                       cv2.BORDER_CONSTANT)  # pylint:disable=no-member
            # Hacky split across 3 plugins
            available_vram = (vram_free - vram_required) // 3
            for plugin in (self._detector, self._aligner, self._masker):
              if plugin_required <= vram_free:
                  logger.debug("Plugin requirements within threshold: (plugin_required: %sMB, "
                               "vram_free: %sMB)", plugin_required, vram_free)
                  return
            # Hacky split across 3 plugins
            available_vram = (vram_free - vram_required) // 3
            for plugin in (self._detector, self._aligner, self._masker):
            # Hacky split across 3 plugins
            available_vram = (vram_free - vram_required) // 3
            for plugin in (self._detector, self._aligner, self._masker):
            # Hacky split across 3 plugins
            available_vram = (vram_free - vram_required) // 3
            for plugin in (self._detector, self._aligner, self._masker):
                  self._set_plugin_batchsize(plugin, available_vram)
          else:
              for plugin in (self._aligner, self._detector):
                  vram_required = plugin.vram + self._vram_buffer
                  batch_required = plugin.vram_per_batch * plugin.batchsize
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