WhoBuilt

Taming the Machine (feat. Nicolas Cage)

Sep 14, 2018· 20 min· 514 views·Watch on YouTube

Speaker

Gant Laborde, a teacher and writer at Infinite Red, explains machine learning for React Native developers at React Native EU.

Why machine learning fits mobile development

Laborde connects machine learning to React Native’s “learn once, write anywhere” approach. He uses spell-checking as an example: one model can work across languages when trained on different datasets, instead of building a separate solution for each language. He focuses on supervised learning and emphasizes that its underlying math is approachable.

Running image recognition in React Native

Laborde describes an image as a set of numerical inputs, such as the 784 grayscale values in a 28-by-28 image. He shows how iOS Vision can identify faces and landmarks, and introduces React Native Vision as a way to use these capabilities from React Native. In a live demo, a downloaded food model classifies hot dogs, fries, pancakes, and hamburgers.

Switching models to detect faces

Laborde changes the demo from food classification to face detection by swapping the model and provider. The updated app draws a detector over faces and checks whether someone resembles the person associated with the Declaration of Independence gag. The person flagged in the demo is Matt Hargett, not Nicolas Cage.

Building and refining a Nicolas Cage model

Laborde explains that he gathered Nicolas Cage photos, collected other celebrities as examples, removed faces from images, and checked the data for errors. Early training did not work: accuracy and loss failed to diverge, so he combined his facial data with a researcher’s model trained on 500,000 images. He then quantized the large model and demonstrated it identifying Cage, including a poor-quality photo at 70% confidence while identifying his friend Frank as not Cage at 99%.

Takeaways

  • Treat machine learning as a reusable approach: train a model on new data rather than rewriting the whole solution for each category or language.
  • A small image classifier can power a practical React Native demo when paired with a camera view and a model provider.
  • Plan to iterate on training data and model architecture; an initial model may not work, even after hours of training.
  • Check training results and test on varied images before trusting a classifier’s output.
  • Quantization can help reduce a model’s size for a mobile app.

Mentioned in this talk

Search inside this talk

What was claimed 8

Related talks