Deploy Tensorflow on PySpark

Slides:



Advertisements
Similar presentations
Ch. Eick: More on Machine Learning & Neural Networks Different Forms of Learning: –Learning agent receives feedback with respect to its actions (e.g. using.
Advertisements

ImageNet Classification with Deep Convolutional Neural Networks
Three kinds of learning
Artificial Neural Networks
Neural Networks Chapter 6 Joost N. Kok Universiteit Leiden.
Some working definitions…. ‘Data Mining’ and ‘Knowledge Discovery in Databases’ (KDD) are used interchangeably Data mining = –the discovery of interesting,
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Image Recognition COMP # 18.
Neural Networks The Elements of Statistical Learning, Chapter 12 Presented by Nick Rizzolo.
Indexing The World Wide Web: The Journey So Far Abhishek Das, Ankit Jain 2011 Paper Presentation : Abhishek Rangnekar 1.
Item Based Recommender System SUPERVISED BY: DR. MANISH KUMAR BAJPAI TARUN BHATIA ( ) VAIBHAV JAISWAL( )
A Hierarchical Deep Temporal Model for Group Activity Recognition
Bassem Makni SML 16 Click to add text 1 Deep Learning of RDF rules Semantic Machine Learning.
Combining Neural Networks and Context-Driven Search for On- Line, Printed Handwriting Recognition in the Newton Larry S. Yaeger, Brandn J. Web, and Richard.
S.Bengio, O.Vinyals, N.Jaitly, N.Shazeer
Connected Infrastructure
TensorFlow CS 5665 F16 practicum Karun Joseph, A Reference:
TensorFlow– A system for large-scale machine learning
Unsupervised Learning of Video Representations using LSTMs
Big Data is a Big Deal!.
Automatic Lung Cancer Diagnosis from CT Scans (Week 1)
RNNs: An example applied to the prediction task
Zheng ZHANG 1-st year PhD candidate Group ILES, LIMSI
Sushant Ahuja, Cassio Cristovao, Sameep Mohta
How Alluxio (formerly Tachyon) brings a 300x performance improvement to Qunar’s streaming processing Xueyan Li (Qunar) & Chunming Li (Garena)
CS 4501: Introduction to Computer Vision Computer Vision + Natural Language Connelly Barnes Some slides from Fei-Fei Li / Andrej Karpathy / Justin Johnson.
BigDL Deep Learning Library on HDInsight
Neural Networks for Quantum Simulation
Chilimbi, et al. (2014) Microsoft Research
Convolutional Neural Fabrics by Shreyas Saxena, Jakob Verbeek
Spark Presentation.
COMP24111: Machine Learning and Optimisation
Connected Infrastructure
Inception and Residual Architecture in Deep Convolutional Networks
Neural Networks CS 446 Machine Learning.
Intelligent Information System Lab
Neural networks (3) Regularization Autoencoder
Deep Belief Networks Psychology 209 February 22, 2013.
Unsupervised Learning and Autoencoders
with Daniel L. Silver, Ph.D. Christian Frey, BBA April 11-12, 2017
Prof. Carolina Ruiz Department of Computer Science
Bird-species Recognition Using Convolutional Neural Network
RNNs: Going Beyond the SRN in Language Prediction
Face Recognition with Deep Learning Method
Introduction to Tensorflow
Convolutional Neural Network
CS110: Discussion about Spark
Counting in Dense Crowds using Deep Learning
Recurrent Neural Networks
Construct a Convolutional Neural Network with Python
Face Recognition with Neural Networks
Chap. 7 Regularization for Deep Learning (7.8~7.12 )
MNIST Dataset Training with Tensorflow
Word Embedding Word2Vec.
Optimization for Fully Connected Neural Network for FPGA application
Neural Networks Geoff Hulten.
Lecture: Deep Convolutional Neural Networks
Papers 15/08.
实习生汇报 ——北邮 张安迪.
Neural networks (3) Regularization Autoencoder
5/7/2019 Map Reduce Map reduce.
Heterogeneous convolutional neural networks for visual recognition
TensorFlow: A System for Large-Scale Machine Learning
Attention for translation
Automatic Handwriting Generation
Deep Object Co-Segmentation
Object Detection Implementations
Example of training and deployment of deep convolutional neural networks. Example of training and deployment of deep convolutional neural networks. During.
Week 7 Presentation Ngoc Ta Aidean Sharghi
Prof. Carolina Ruiz Department of Computer Science
Overall Introduction for the Lecture
Presentation transcript:

Deploy Tensorflow on PySpark 2016 April AILab

1. Hyperparameter Tuning 2. Deploying models at scale

Hyperparameter Tuning Machine learning practitioners rerun the same model multiple times with different hyperparameters in order to find the best set. This is a classical technique called hyperparameter tuning.

Hyperparameter Tuning We can use Spark to broadcast the common elements such as data and model description, and then schedule the individual repetitive computations across a cluster of machines Fold 1 Fold 2 Fold 3 Distributing Cross Validation sets

Hyperparameter

Deploying Models at Scale Broadcasted Trained Model ImageNet data Model Batch 1 Batch1 Labels Predicting Model Batch2 Labels Batch 2 Predicting Model Batch 3 Batch3 Labels Predicting ImageNet is a large collection of images from the internet that is commonly used as a benchmark in image recognition tasks.

Deploying Models at Scale We are now going to take an existing neural network model that has already been trained on a large corpus (the Inception V3 model), and we are going to apply it to images downloaded from the internet. 0.808008: military uniform 0.022845: suit, suit of clothes 0.009539: academic gown, academic robe, judge's robe 0.009413: bearskin, busby, shako 0.007742: pickelhaube Inception-v3. image classifier is a CNN which is developed by GoogleInc

Deploying Models at Scale The model is first distributed to the workers of the clusters, using Spark’s built-in broadcasting mechanism: This model is loaded on each node and applied to images model sc.broadcast worker1 model model worker2 …

Read Test Data (ImageNet) image_batch_size=3 >>> batched_data = read_file_index() batch1 batch2

Distribute Input data >>> urls = sc.parallelize(batched_data) RDD (Batches) Tests images (id, url) Batches … model im [(id1, url1) (id2, url2) (id3, url3)] split into Batches batch1 sc.parallelize mapper1 [(id4, url4) (id5, url5) (id6, url6)] model [(id7, url7) (id8, url8) (id9, url9)] batch2 mapper2 …

Splitting Input data >>> labeled_images = urls.flatMap(apply_batch) Tensorflow graph Tensorflow graph Get model data (CNN graph) Get model data (CNN graph) Predict image based on trained model Broadcasted Decoding dictionary for labels Broadcasted Decoding dictionary for labels … model map(apply_batch) model Loads a human readable English name for each softmax node (1008 output nodes) We have too many nodes in the output layer. Each class is a node. It uses encoded output labels for memory efficiency batch1 batch1 mapper1 mapper1 model map(apply_batch) model batch2 batch2 mapper2 mapper2 … …

GraphDef The foundation of computation in TensorFlow is the Graph object. This holds a network of nodes, each representing one operation, connected to each other as inputs and outputs. After you've created a Graph object, you can save it out by calling as_graph_def(), which returns a GraphDef object.

Prediction Fetch an image from the web and uses the trained CNN to infer the topics of this image Download image from the internet Run CNN: Compute forward propagation based on image_data (input nodes/data) and trained weights Softmax_tensor is the output_layer tensor of the CNN Sort the probabilities Decode labels

Prediction output_layer tensor of the CNN (1008 output nodes) [ Remove one dimension (2 dimensions to 1 dimension) ] predictions =np.squeeze(predictions) top_k = predictions.argsort()[-5:][::-1] Indexes of top 5 labels sorted by their probabilities

Get Result … … … model model batch1 batch1 mapper1 mapper1 model model map(apply_batch) model collect batch1 batch1 mapper1 mapper1 labels model map(apply_batch) model batch2 batch2 mapper2 mapper2 … …