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

Default image classfier model handler fails on black & white JPG #65

Closed
fbbradheintz opened this issue Feb 21, 2020 · 9 comments
Closed
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation triaged_wait Waiting for the Reporter's resp

Comments

@fbbradheintz
Copy link
Contributor

Repro: In the quick start, replace kitten.jpg with the attached file. There's a crash in image_classifier.py when it attempts to convert the image to a tensor, because it assumes 3 color channels.

@fbbradheintz fbbradheintz added the bug Something isn't working label Feb 21, 2020
@fbbradheintz
Copy link
Contributor Author

billmurray1

Sample input to induce failure

@harshbafna
Copy link
Contributor

@fbbradheintz @mycpuorg : The pre-processing and post-processing for the default image classification handler is implemented for torchvision's imagenet based models like densenet, resnet etc. Thus we use the standard normalization for imagenet models which is based on RGB images.

We expect the user to implement a custom handler for other image-classification models, for e.g. MNIST digit classifier or other models which are not trained using imagenet dataset, which uses different normalization parameters. We will add a documentation describing the expected input and output of all default handlers.

E.g :

  • default image_classifer expects a RGB image file as input and returns the probability of top 5 results
  • default text_classifier expects a text file as input and returns the classification of the text.

@mycpuorg
Copy link
Collaborator

mycpuorg commented Mar 9, 2020

@harshbafna
We can explicitly say that image_classifier handles only RGB images and so on for other default handlers. That is reasonable, however, it is not OK for the classifier handler to crash. We must handle it as an exception and return an error code at a minimum.

@fbbradheintz
Copy link
Contributor Author

If you can put up the doc change, I'll close this.

@harshbafna
Copy link
Contributor

Added documentation in stage_release branch.

commit : 4ab6f7c

@harshbafna harshbafna added staged_release merged to stage_release triaged_wait Waiting for the Reporter's resp labels Mar 13, 2020
@fbbradheintz fbbradheintz added close_after_merge and removed triaged_wait Waiting for the Reporter's resp labels Mar 16, 2020
@fbbradheintz
Copy link
Contributor Author

Looks good. Please close after merge.

@harshbafna harshbafna self-assigned this Mar 17, 2020
@fbbradheintz fbbradheintz removed close_after_merge staged_release merged to stage_release labels Apr 11, 2020
@fbbradheintz
Copy link
Contributor Author

Regression in the 4/10 build.

@fbbradheintz fbbradheintz reopened this Apr 11, 2020
@harshbafna
Copy link
Contributor

@fbbradheintz : We agreed to document this and the documentation is available in master branch :
https://github.com/pytorch/serve/blob/master/docs/default_handlers.md

@harshbafna harshbafna added triaged_wait Waiting for the Reporter's resp documentation Improvements or additions to documentation labels Apr 12, 2020
@fbbradheintz
Copy link
Contributor Author

Sounds good. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation triaged_wait Waiting for the Reporter's resp
Projects
None yet
Development

No branches or pull requests

3 participants