def METHOD_NAME(annotation):
    image = annotation.value
    if image.shape[-1] == 4:
        image = image[:, :, -1]
    elif image.shape[-1] == 3:
        image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
    return image.astype(np.float32) / 255