def apply_mask(image, mask, nomask, color, alpha=0.5):
    """Apply the given mask to the image.
    """
    mask[nomask != 0] = 0
    for c in range(3):
        image[:, :, c] = np.where(mask == 1,
                                  image[:, :, c] *
                                  (1 - alpha) + alpha * color[c] * 255,
                                  image[:, :, c])
    return image
Apply the given mask to the image.
    
lib/model/utils/net_utils.py