Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytorch inference fixes #661

Merged
merged 6 commits into from Nov 19, 2019
Merged

Pytorch inference fixes #661

merged 6 commits into from Nov 19, 2019

Conversation

beniz
Copy link
Collaborator

@beniz beniz commented Oct 28, 2019

Small fixes and improvements to torch model inference:

  • return all classes with "best":-1
  • cleaner error message when model location is wrong
  • allowing std as a vector of float
  • introducing scale as an option to scale the image values

The torch image classification model service creation and prediction become:

  • service creation
curl -X PUT "http://localhost:8080/services/torch_resnet" -d '{
    "description": "image classification service",
    "mllib": "torch",
    "model": {
        "repository": "/path/to/resnet50_torch/"
    },                   
    "parameters": {
        "input": {                                                            
            "connector": "image"
        },"mllib":{}
    },              
    "type": "supervised"
}     
'
  • prediction
curl -X POST "http://localhost:8080/predict" -d '{
    "service": "torch_resnet",
    "parameters": {
        "input": {
            "width":224,
            "height":224,
            "rgb":true,
            "scale":0.004,"mean":[0.485,0.456,0.406],"std":[0.229,0.224,0.225]
        },"mllib":{"gpu":true,"gpuid":0},
        "output": {
            "best":3
        }
    },
    "data":["/path/to/cat.jpg"]
}
'

This is using the mean and std values from https://pytorch.org/docs/stable/torchvision/models.html


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant