          masks3 = np.tile(1 - np.rint(masks), 3)
          for mask in masks3:
              mask[np.where((mask == [1., 1., 1.]).all(axis=2))] = [0., 0., 1.]
          for previews in faces:
              images = np.array([cv2.addWeighted(img, 1.0,  # pylint: disable=no-member
                                                 masks3[idx], 0.3,
                                                 0)
                                 for idx, img in enumerate(previews)])
              retval.append(images)
          logger.debug("masked shapes: %s", [faces.shape for faces in retval])
          return retval
  
 
</s> remove                 offset:offset + foregrounds[idx].shape[1]] = foregrounds[idx]
 </s> add                 offset:offset + foregrounds[idx].shape[1], :3] = foregrounds[idx] </s> remove             aligned_landmarks = face.aligned_landmarks
 </s> add             aligned_landmarks = face.feed_landmarks </s> remove         blob = cv2.dnn.blobFromImage(face,  # pylint: disable=no-member
 </s> add         blob = cv2.dnn.blobFromImage(face[..., :3],  # pylint: disable=no-member </s> remove                      [tgt.shape for tgt_images in target_batch for tgt in tgt_images])
 </s> add                      [tgt_images.shape[1:] for tgt_images in target_batch]) </s> remove                 cv2.circle(  # pylint: disable=no-member
                    face.aligned_face,
                    (pos_x, pos_y), 2, (0, 0, 255), -1)
 </s> add                 cv2.circle(face.feed_face,  # pylint: disable=no-member
                           (pos_x, pos_y), 2, (0, 0, 255, 255), -1)
            images = np.array([cv2.addWeighted(img,  # pylint: disable=no-member
                                               1.0, masks3[idx], 0.3, 0)
          masks3 = np.tile(1 - np.rint(masks), 3)
          for mask in masks3:
              mask[np.where((mask == [1., 1., 1.]).all(axis=2))] = [0., 0., 1.]
          for previews in faces:
            images = np.array([cv2.addWeighted(img,  # pylint: disable=no-member
                                               1.0, masks3[idx], 0.3, 0)
            images = np.array([cv2.addWeighted(img,  # pylint: disable=no-member
                                               1.0, masks3[idx], 0.3, 0)
            images = np.array([cv2.addWeighted(img,  # pylint: disable=no-member
                                               1.0, masks3[idx], 0.3, 0)
                                 for idx, img in enumerate(previews)])
              retval.append(images)
          logger.debug("masked shapes: %s", [faces.shape for faces in retval])
          return retval
  
keep keep keep keep replace replace replace keep keep keep keep keep
 Smart Mask Exposure for Extraction & Training (#831)

Smart Masks - Initial Commit 
plugins/train/trainer/_base.py