kylecorry31/ML4K-AI-Extension

Payload too large

kylecorry31 opened this issue · 3 comments

@dalelane Sometimes the ML4K web service returns "Payload too large" when passing a large image file (taken directly from phone's camera). Tested on the classify endpoint

We should add something to resize the image before submitting it. The absolute max upper limit is 3mb, but really there is no good (AI/ML) reason to submit an image larger than 250x250 pixels.

It might be possible to capture a smaller image in the first place.... I'm not sure how much of the Android API is available in App Inventor. https://developer.android.com/training/camera/photobasics

The nice thing is that we don't need to make it as complex as the sort of thing you see in https://coderwall.com/p/wzinww/resize-an-image-in-android-to-a-given-width as we don't need to maintain aspect ratio for classifying - resizing to a 224x224 pixel square image would actually be optimum for our purposes.