          dims = (round((frame.shape[1] / 2 * self.scale) * 2),
                  round((frame.shape[0] / 2 * self.scale) * 2))
          frame = cv2.resize(frame, dims, interpolation=interp)  # pylint: disable=no-member
          logger.trace("resized frame: %s", frame.shape)
          return np.clip(frame, 0.0, 1.0)
 
</s> remove             mask = np.repeat(new_image[:, :, -1][:, :, np.newaxis], 3, axis=-1)
            foreground = new_image[:, :, :3]
            background = (predicted["image"][:, :, :3] / 255.0) * (1.0 - mask)

 </s> add             foreground, mask = np.split(new_image, (3, ), axis=-1) </s> remove             frame = foreground + background

 </s> add             background *= (1.0 - mask)
            background += foreground
            frame = background </s> remove             placeholder = np.clip(placeholder, 0.0, 1.0)
 </s> add         np.clip(placeholder, 0.0, 1.0, out=placeholder) </s> remove             placeholder = cv2.warpAffine(  # pylint: disable=no-member
 </s> add             cv2.warpAffine(  # pylint: disable=no-member </s> remove         patched_face = np.rint(patched_face * 255.0).astype("uint8")
 </s> add         patched_face *= 255.0
        patched_face = np.rint(
            patched_face,
            out=np.empty(patched_face.shape, dtype="uint8"),
            casting='unsafe'
        )
        np.clip(frame, 0.0, 1.0, out=frame)
        return frame
          dims = (round((frame.shape[1] / 2 * self.scale) * 2),
                  round((frame.shape[0] / 2 * self.scale) * 2))
          frame = cv2.resize(frame, dims, interpolation=interp)  # pylint: disable=no-member
          logger.trace("resized frame: %s", frame.shape)
        np.clip(frame, 0.0, 1.0, out=frame)
        return frame
keep keep keep keep replace
 Optimized numpy functions in Converter (#838) 
lib/convert.py