Currently I have deployed a Semantic Segmentation model and an endpoint with which I am able to invoke and get inferences. Now, I am getting inferences for each image at a time.
Now I want to try batch of images at a time using Batch Transform job. It worked perfectly fine but the images that is created is an .out file and I'm not able to open that file using any of the viz library like matplotlib imread, PIL Image and openCV imread. It all says not an image.
Just wanted to understand what is the .out file ? and if it is an segmented mask image which is typically the output of a semantic segmentation model then how can I read that file.
My code for Batch Transformation:
from sagemaker.predictor import RealTimePredictor, csv_serializer, csv_deserializer
class Predictor(RealTimePredictor):
def __init__(self, endpoint_name, sagemaker_session=None):
super(Predictor, self).__init__(
endpoint_name, sagemaker_session, csv_serializer, csv_deserializer
)
ss_model = sagemaker.model.Model(role =role, image=training_image, model_data = model, predictor_cls=Predictor, sagemaker_session=sess)
transformer = ss_model.transformer(instance_count=1, instance_type='ml.c4.xlarge', output_path=batch_output_data)
transformer.transform(data=batch_input_data, data_type='S3Prefix', content_type='image/png', split_type='None')
transformer.wait()