Share
Embed
AI for Art and Design-DSC at UW
AI for Art and Design talk - DSC at UW
Margaret Maynard-Reid
January 31, 2021
Transcript
43 slides
-
AI for Art & Design with TensorFlow Lite Margaret Maynard-Reid,
Jan 31, 2021 @margaretmz -
@margaretmz | #AIArt | #TensorFlow | #TFLite ML Engineer &
Artist 2 https://margaretmz.art/ -
@margaretmz | #AIArt | #TensorFlow | #TFLite Topics • Computer
vision tasks • Generative art & design • Datasets & resources AI for Art & Design TensorFlow Lite Android Samples & tutorials • Sample apps • Awesome TFLite • E2E TFLite Tutorials • What is TFLite? • TFLite on Android • Tools & resources 3 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Art & Design
• Photography • Sculpture • Drawing • Painting • Fashion design • Product design • UI/UX design • ... 4 -
Computer Vision Tasks Complexity Image classification (single-label) Classify an image
to a class Examples Painting style or artist Van Gogh Image classification (multi-label) Classify an image to multiple classes Examples Movie poster genre action, sci-fi Feature extraction Extracting latent features of an image with CNN models Examples Visual search find similar fashion Object detection Identify one or multiple objects within an image and their locations with bounding boxes. detect UI elements Segmentation Classify whether each pixel of the image belongs to a certain class segment UI elements Generative models (GANs) Two or more models trained simultaneously Examples - Generate new images - Super resolution - Image-to-image 5 -
Use CNN neural networks Content image + style image =
styled image Content Style Generated Neural Style Transfer: 50 Shades of Miaw (link) A few more samples of generated images… Style Transfer 2015 8 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Generative Adversarial Networks
2014 What are GANs? Generative Adversarial Networks (GANs) have at least two network models which compete against each other ... 9 -
@margaretmz | #AIArt | #TensorFlow | #TFLite GANs variations GANs
are fun but difficult to train! • 2014 Ian Goodfellow’s original GAN’s paper • 2015 DCGAN (Deep Convolutional GAN) (paper) • 2014 cGAN (Conditional GAN) - Generate images conditioned on a class (paper) • 2016 Pix2Pix – paired image to image translation (paper) • 2017 CycleGAN – unpaired Image to image translation • 2018 StyleGAN – Generate images with some control on image characteristics (paper) • Many other GAN variations… 10 -
@margaretmz | #AIArt | #TensorFlow | #TFLite • Training datasets
must be paired • A type of conditional GAN Link to TensorFlow tutorial Pix2Pix 2016 11 -
@margaretmz | #AIArt | #TensorFlow | #TFLite CycleGAN 2017 •
Training datasets are unpaired • Horses <--> zebras • Summer <--> winter • Photos to paintings (Monet, Van Gogh etc.) Link to TensorFlow tutorial 12 -
@margaretmz | #AIArt | #TensorFlow | #TFLite BigGAN 2018 Large
scale GAN that generates high fidelity class-conditional images. Link to paper | TF Hub biggan512, biggan-256, biggan-128 13 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Control the styles
of the generated images • Pose • Face shape • Age • Gender • Hair color 4x4 --> 1024x1024 8GPUs trained for 1 week Current examples: faces, bedrooms and cats Link to video StyleGAN 2018 14 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Sketch2Code Microsoft: Turn
your whiteboard sketches to working code in seconds with Sketch2Code 15 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Fashion++ Facebook AI:
“Fashion++: Minimal Edits for Outfit Improvement” (news | paper) 16 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Datasets Art •
The Art Institute of Chicago - 5000 high res images • Best Artworks of All Time • Art Images: Drawing/Painting/Sculptures/Engravings • Overwatch Heroes Recognition • Chinese Fine Art • Museum of Modern Art Collection UI/UX Design • Rico mobile app datasets • Kaggle ◦ Common Mobile/Web App Icons ◦ Icons-50 17 https://github.com/margaretmz/awesome-ai-art-design -
@margaretmz | #AIArt | #TensorFlow | #TFLite Magenta https://magenta.tensorflow.org/ |
https://github.com/magenta 18 -
@margaretmz | #AIArt | #TensorFlow | #TFLite AI & the
Future of UX https://uxdesign.cc/ai/home 20 -
@margaretmz | #AIArt | #TensorFlow | #TFLite AI for Art
& Design AI will assist and inspire artists and designers Everyone can now make art and design! 21 -
@margaretmz | #AIArt | #TensorFlow | #TFLite What is an
ML model? • A complex mathematical function • A representation of learnings from training data 23 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Model training, conversion
& inference 24 Model • tf.Keras (TensorFlow) • Python libraries: Numpy, Matplotlib etc SavedModel or Keras model Serving • Cloud • Web • Mobile • IoT • Micro controllers • Edge TPU Training Inference Data -
@margaretmz | #AIArt | #TensorFlow | #TFLite Why on device?
It’s all about that camera! 25 -
@margaretmz | #AIArt | #TensorFlow | #TFLite What is TensorFlow
Lite? A framework with a set of tools for deploying ML models to mobile & embedded: • A converter • An interpreter • Ops / kernels • Interface to hardware accelerations: ◦ NN API ◦ Edge TPU • A bunch of other tools: quantization, pruning, benchmarking... 26 -
@margaretmz | #AIArt | #TensorFlow | #TFLite TensorFlow Lite Support
0.1.0 • Task API • Support Library • Metadata Library • Codegen • Custom Ops • Model Maker • ML Model Binding 28 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Android app with
TensorFlow Lite • ML model: ◦ Train / find a model ◦ Convert to .tflite format ◦ Run inference in Python ◦ Benchmark (optional) ◦ Add model metadata • Build Android app ◦ UI navigation ◦ Input image: canvas, gallery or camera ◦ Load model & run inference ◦ Display results in UI 30 -
@margaretmz | #AIArt | #TensorFlow | #TFLite TensorFlow Lite tools
1. Train a model • Teacheable machine • Model Maker ( w/ transfer learning) • ML Kit AutoML Vision • TensorFlow Hub 31 2. Convert • Converter • Optimization toolkit • Benchmarking tool 3. Deploy • ML Model Binding • Task API -
@margaretmz | #AIArt | #TensorFlow | #TFLite ML Kit Digital
Ink Recognition Recognize handwritten text and drawings • Text models: 300+ languages • Non-text models ◦ Autodraw ◦ Emoji ◦ Shapes Blog: Digital Ink Recognition in ML Kit Sample app: Overview | GitHub 34 Example: Draw & recognize emojis -
@margaretmz | #AIArt | #TensorFlow | #TFLite ESRGAN on Android
with TFLite • Enhanced Super Resolution GAN • Pre-trained ESRGAN model from TF Hub • Convert to TFLite model ◦ Dynamic range quantization ◦ Input image 50x50 • TensorFLow C API, GPU library • Android NDK 35 https://blog.tensorflow.org/2020/12/how-to-generate-super -resolution-images-using-tensorflow-lite-on-android.html -
@margaretmz | #AIArt | #TensorFlow | #TFLite Part 2: ML
Model Binding from Android Studio TensorFlow Lite Model Maker Part 1: TensorFlow Lite Model Maker • Image/Text classification 36 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Style transfer Google
Arts & Culture app: https://play.google.com/store/apps/details?id=com.google.android.apps.cultural Blog post: 4/2/2020 - Transform your photo in the style of an iconic artist 37 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Selfie2Anime • U-GAT-IT
paper • Image to image translation • Written in TF1 code • Unpaired selfie and anime images • 50 & 100 epochs checkpoints • Collaboration with Sayak & Khanh • Links: project repo | blog 38 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Cartoonizer • Model:
Whitebox CartoonGAN ◦ Faster & smaller ◦ Not just for selfies • Link to project repo • Link to TF Hub models • Collaboration with Sayak & Khanh • Links: project repo | blog 39 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Segmentation + Style
Transfer Demo by Khanh LeViet TFLite inference in Python, Already implemented in Android (and iOS)... (project repo) 40 -
@margaretmz | #AIArt | #TensorFlow | #TFLite 2020 E2E TFLite
Tutorials GitHub repo 41 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Awesome TensorFlow Lite
A curated list of models, apps, tutorials and learning resources… Thanks to the ML GDE and Android community! Support of TensorFlow Lite team https://github.com/margaretmz/awesome-tflite 42 -
@margaretmz | #AIArt | #TensorFlow | #TFLite Follow me on
Twitter, Medium or GitHub to learn more about deep learning, TensorFlow and on-device ML. @margaretmz @margaretmz margaretmz Thank you! 43