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

Image classification fails calling .ClassifyImage #20

Closed
gsebastia opened this issue Jan 12, 2019 · 3 comments
Closed

Image classification fails calling .ClassifyImage #20

gsebastia opened this issue Jan 12, 2019 · 3 comments

Comments

@gsebastia
Copy link

Hello. I am trying with my first app with MI4K but I've never got a version that gives me back an image classification. I have tried different ways to send the image, but now the application fails. I don't know if the problem is the key, the way i send the image...

To simplify my tests, I leaved my project and I took the example CirclesAndRectangles, I created a project in machine learning for kids, I generated the model, and I copied the key from the url:

https://machinelearningforkids.co.uk/api/appinventor/b27f9f70-1694-11e9-b8e9-6f11f826e259e313c6de-ffb5-492e-8340-2390b8ae4ee4/extension

but when executing it on my phone it fails (see error message below) just like my project ... what am I doing wrong?

Thank you very much!

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/gson/JsonParser;
at com.kylecorry.ml4k.ML4K$Classification.fromJson(ML4K.java:426)
at com.kylecorry.ml4k.ML4K$Classification.access$400(ML4K.java:414)
at com.kylecorry.ml4k.ML4K$1.run(ML4K.java:118)
at java.lang.Thread.run(Thread.java:760)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.gson.JsonParser" on path: DexPathList[[zip file "/data/app/appinventor.ai_gsebastia.eFAP_1_c-2/base.apk"],nativeLibraryDirectories=[/data/app/appinventor.ai_gsebastia.eFAP_1_c-2/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:74)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 4 more

many thanks

@gsebastia gsebastia changed the title Image classification allways returns Error 404 Image classification fails calling .ClassifyImage Jan 12, 2019
@kylecorry31
Copy link
Owner

Hello, so this looks like an issue where AppInventor is not sending over the required libraries. I don't know how many other people this is affecting, so I have removed the need for that library. The latest version should work now.

dalelane added a commit to IBM/taxinomitis that referenced this issue Jan 13, 2019
Contributes to: kylecorry31/ML4K-AI-Extension#20

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
@gsebastia
Copy link
Author

Hello Kyle, now it works!

I'm not sure if solution was new version, or problem was that I made so many tests and so many apps with different mi4k projects that my phone (two phones, actually) had charged in memory an incorrect version of extension. In case it is usefull, I tell you about the process

I have tested an app make by Dale Lane with my key, and at first It didn't work in my phones. I have installed this app in a third phone (with no other app with MI4K installed) ... and it worked!

I had to uninstall from my phones all different apps and versions I generated with app inventor and ML4K extension, I've reboot my phone and installed only one version (new extension?)....and it runned!

This is a project of my son and some friends, and I was helping them to solve the problem.

Thank you very much!

@bh26
Copy link

bh26 commented Aug 9, 2019

I am trying to solve a similar issue but I cannot get it to work.
I am trying the example CirclesAndRectangles.aia
Actually I did everything that was needed on ML4K site, and got the URL for the extension. I understand from another issue that the API Key was included in the extension.
Anyway I added the API key in the Screen.Initialize block
But whatever I do I get "Bad response by server:404"
I did it on 2 different phones once with the companion and once with .apk, all with the same result.
What could I have done wrong?
Thanks

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

No branches or pull requests

3 participants