def METHOD_NAME(self, filename, img):
    img = img.clip(0, 1).cpu().numpy()
    img = (img * 255.).astype(np.uint8)
    img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
    save_dir = os.path.dirname(filename)
    os.makedirs(save_dir, exist_ok=True)
    cv2.imwrite(filename, img)