aws / aws/amazon-sagemaker-clarify
Error in using Clarify with AWS Jumpstart image classification models
- Dominant language
- Python
- Stars
- 75
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have fine-tuned an image classification model using SageMaker jump start.
I have also deployed my model. This is my code for deploying my model:
```python
sgmkr_clnt = boto3.client("sagemaker")
model_id = 'tensorflow-ic-imagenet-nasnet-mobile'
model_s3_key =
model_version = '2.0.2'
model_name =
response = sgmkr_clnt.create_model(
ModelName=model_name,
PrimaryContainer={"Image": deploy_image_uri, "ModelDataUrl": model_s3_key},
ExecutionRoleArn=SM_ROLE.ARN.value,
)
prefix =
s3_data_input_path =
analysis_result_path =
explainability_data_config = clarify.DataConfig(
s3_data_input_path=s3_data_input_path,
s3_output_path=analysis_result_path,
dataset_type="application/x-image",
)
model_config = clarify.ModelConfig(
model_name=model_name, instance_type="ml.m5.xlarge", instance_count=1, content_type="image/png"
)
predictions_config = clarify.ModelPredictedLabelConfig(label_headers=['NO', 'YES'])
image_config = clarify.ImageConfig(
model_type="IMAGE_CLASSIFICATION", num_segments=20, segment_compactness=5
)
shap_config = clarify.SHAPConfig(num_samples=500, image_config=image_config)
```
I have only one img.png as input.
When I run my code I get this error:
An error occurred (ModelError) when calling the InvokeEndpoint operation (reached max retries: 0): Received server error (500) from primary with message "{"error": "unsupported content type image/png"}"
I have been able to use this error for Batch Inference using png files, before, but it does not work with Clarify.
Contributor guide
Research direction
Start with the Clarify.DataConfig, ModelConfig, ImageConfig, and SHAPConfig setup shown in the issue, then trace the Clarify image-classification invocation that sends the input to the SageMaker endpoint. Reproduce the failure with the single PNG and content_type="image/png"; done means Clarify handles the deployed JumpStart model correctly or documents the supported content type and limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100