ml5js / ml5-library

Friendly machine learning for the web! 🤖
https://ml5js.org
Other
6.48k stars 902 forks source link

Erratic classifier training on mobile #262

Open nathanvogel opened 5 years ago

nathanvogel commented 5 years ago

Hi! 👋

I'm using MobileNet to extract features and train a new classifier, but the training fails to produce a coherent model almost all the time on smartphones and tablets. Instead of going down to zero, the loss shows strange behaviors and the resulting model is unusable.

For example, here're 2 behaviors that I've observed:

  1. Looping values like [6.27, 3.20, 0.97, 1.21... 6.27, 3.20 ...] (most common)
  2. No loss is sent to the callback. (just a few times)

Sometimes the results look okay with very small datasets (like two pairs of images), but then the result quality is hard to judge anyway.

Tested devices: Pixel 3, iPad Pro, LG G6, iPhone X. On some older devices, the page crashes because of Tensorflow.js issues with WebGL, but here I don't get any error.

Are there optimizations that we can try to train on mobile devices?

gitalm commented 5 years ago

I have the same issues. I'm training the classifier with different local files (flowers) and on Firefox the results are different to Chromium. Chromium rapidly goes down with the loss and Firefox kind of oscillate. Data and Programme is totaly identically. For testing purposes i uploaded it to git under https://github.com/gitalm/EarlyFlowers/tree/master Anyway, the results are not good. I already use epochs . 50 option, are there any more hints?

Additionaly both browser give different solution for the same testing picture (one of the training pictures) and both are wrong.

arshve commented 5 years ago

Same here i use Feature Extractor and using costume model for image classification and it just show 1 item as a result in mobile device... but in computer work perfectly... any answer??