def METHOD_NAME(fg, alpha, img, bg, trans_info, writer, fg_estimate):
    """
    Postprocess for prediction results.
    Args:
        fg (Tensor): The foreground, value should be in [0, 1].
        alpha (Tensor): The alpha, value should be in [0, 1].
        img (Tensor): The original image, value should be in [0, 1].
        trans_info (list): A list of the shape transformations.
        writers (dict): A dict of VideoWriter instance.
        fg_estimate (bool): Whether to estimate foreground. It is invalid when fg is not None.
    """
    alpha = reverse_transform(alpha, trans_info)
    bg = F.interpolate(bg, size=alpha.shape[-2:], mode='bilinear')
    if fg is None:
        if fg_estimate:
            img = img.transpose((0, 2, 3, 1)).squeeze().numpy()
            alpha = alpha.squeeze().numpy()
            fg = estimate_foreground_ml(img, alpha)
            bg = bg.transpose((0, 2, 3, 1)).squeeze().numpy()
        else:
            fg = img
    else:
        fg = reverse_transform(fg, trans_info)
    if len(alpha.shape) == 2:
        alpha = alpha[:, :, None]
    new_img = alpha * fg + (1 - alpha) * bg
    writer.write(new_img)