Invoking endpoint outputs empty prediction data

0

Hello,

I am able to invoke my endpoint using the following command template:

aws --profile ‘insert_profile_name’ sagemaker-runtime invoke-endpoint --endpoint-name 'insert_endpoint_name' --body fileb://'insert_image_file_path' --region ‘insert_region’ --content-type application/x-image output.txt

However, this produces an output text file that contains the following:

{prediction": []}

Also, this appears in the terminal after running the command:

{ "ContentType": "application/json", "InvokedProductionVariant": "variant-name-1" }

The image I used to invoke my endpoint was also used for training the model.

Here is my training job configuration (values that I've modified or added):

Job Settings:

Algorithm - Object Detection | Input Mode - Pipe

Hyperparameters:

num_classes - 1 | mini_batch_size - 1 | num_training_samples - 1

Input data configuration:

First channel:

Name - validation | Input Mode - Pipe | Content Type - application/x-recordio | Record Wrapper - RecordIO | S3 Data Type - AugmentedManifestFile | Attribute Names - source-ref, bounding-box

Second channel:

Name - train | Input Mode - Pipe | Content Type - application/x-recordio | Record Wrapper - RecordIO | S3 Data Type - AugmentedManifestFile | Attribute Names - source-ref, bounding-box

Any help would be appreciated. I can provide more information if needed. Thanks!

1 Answer
0

Hello

Thank you for contacting us.

I understand that you are using the SageMaker Object Detection Algorithm for training and hosting your model and having issues while Invoking endpoint outputs empty prediction data, Please correct me If I am missing anything here.

From the Invocation script I see that you are using content-type as application/x-image, from the documentation I see that the you can Query a trained model by using the model's endpoint and The endpoint takes .jpg and .png image formats with image/jpeg and image/png as content-types.[1]

I would request you to test it out with the ContentType="image/jpeg" and let us know if you are still facing the issue. As an alternative you can test using the sagemaker runtime API call to invoke the endpoint.[2]

endpoint_response = runtime.invoke_endpoint(EndpointName=ep, ContentType="image/jpeg", Body=b)

For more details please refer to our GitHub example[2]

If you still have difficulties, I recommend to cut a support case and provide more detail about your account information and script/config. Due to security reason, we cannot discuss account specific issue in the public posts.

Thank you

References: [1] https://docs.aws.amazon.com/sagemaker/latest/dg/object-detection-in-formats.html

[2] https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/object_detection_birds/object_detection_birds.ipynb

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions