The Pontifexhttps://www.damienpontifex.com/
Recent content on The PontifexHugo -- gohugo.ioen-auSat, 11 Aug 2018 20:39:58 +0800Speakinghttps://www.damienpontifex.com/speaking/
Sat, 11 Aug 2018 20:39:58 +0800https://www.damienpontifex.com/speaking/Past Events I love learning new things and following that up with teaching others. This normally comes over coffee or meetups, but if it&rsquo;s speaking then I&rsquo;m always willing to give it a go.
Rise of the Bots Skills of the Modern Age (SOMA) held a community lunch in Perth to explore the rising proliferation of bots, as they redefine how customers and businesses interact. Speaking alongside university students demonstrating as well as Busybot, I presented how Machine Learning is used (and also equally not required) when developing bots.TensorFlow Serving with a variable batch sizehttps://www.damienpontifex.com/2018/05/10/tensorflow-serving-with-a-variable-batch-size/
Thu, 10 May 2018 03:44:40 +0000https://www.damienpontifex.com/2018/05/10/tensorflow-serving-with-a-variable-batch-size/TensorFlow serving can handle a variable batch size when doing predictions. I never understood how to configure this and also the shape of the results returned. Finally figuring this out, here&rsquo;s the changes to our previous serving setup to accept a variable number of images to classify for our model.
Serving input function First thing is to update our serving input receiver function placeholder. In the past we had set the placeholder to have a shape of [1], for variable batch size, this is as easy as setting it to [None].Saving money on GPUs in Azurehttps://www.damienpontifex.com/2018/05/06/saving-money-on-gpus-in-azure/
Sun, 06 May 2018 07:19:44 +0000https://www.damienpontifex.com/2018/05/06/saving-money-on-gpus-in-azure/Azure provides low priority VMs that we can use to save some money when utilising GPUs for machine learning. All the major cloud providers offer spare compute for a discount: Google cloud has Preemptible VMs, AWS has spot instances and Azure has low priority VMs. On Azure these low priority VMs can only be provisioned in Azure Batch or virtual machine scale sets and we can use the latter for hosting a jupyter environment.TensorFlow Serving our retrained image classifierhttps://www.damienpontifex.com/2018/05/06/tensorflow-serving-our-retrained-image-classifier/
Sun, 06 May 2018 03:01:50 +0000https://www.damienpontifex.com/2018/05/06/tensorflow-serving-our-retrained-image-classifier/Here we&rsquo;ll look at exporting our previously trained dog and cat classifier and call that with local or remote files to test it out. To do this, I&rsquo;ll use TensorFlow Serving in a docker container and use a python client to call to the remote host.
_Update 12th June, 2018: I used the gRPC interface here, but TensorFlow serving now has a REST API that could be beneficial or of more interest_Image classification using TensorFlow estimators and TensorFlow Hub for transfer learninghttps://www.damienpontifex.com/2018/04/21/image-classification-using-tensorflow-estimators-and-tensorflow-hub-for-transfer-learning/
Sat, 21 Apr 2018 11:58:56 +0000https://www.damienpontifex.com/2018/04/21/image-classification-using-tensorflow-estimators-and-tensorflow-hub-for-transfer-learning/This notebook is available as a codelab
TensorFlow Hub was announced at TensorFlow Dev Summit 2018 and promises to reduce the effort required to use existing machine learning models and weights in your own custom model. From the overview page
TensorFlow Hub is a library to foster the publication, discovery, and consumption of reusable parts of machine learning models. A module is a self-contained piece of a TensorFlow graph, along with its weights and assets, that can be reused across different tasks in a process known as transfer learning.My first Azure Batch AI Jobhttps://www.damienpontifex.com/2018/01/15/my-first-azure-batch-ai-job/
Mon, 15 Jan 2018 10:53:56 +0000https://www.damienpontifex.com/2018/01/15/my-first-azure-batch-ai-job/Azure Batch AI provides us the PaaS opportunity to use GPU resources in the cloud. The basis is to use virtual machines in a managed cluster (i.e. you don&rsquo;t have to maintain them) and run jobs as you see fit. For my use case, the opportunity of low-priority VMs to reduce the cost of using GPU machines is also particularly promising. What I&rsquo;ll run through is running our first job on Azure Batch AI.Getting started with PowerShell and Azure on macOShttps://www.damienpontifex.com/2018/01/13/getting-started-with-powershell-and-azure-on-macos/
Sat, 13 Jan 2018 02:45:56 +0000https://www.damienpontifex.com/2018/01/13/getting-started-with-powershell-and-azure-on-macos/PowerShell 6.0 has now become generally available and with it the ability to use PowerShell cross platform. With all of its goodness, I was most excited about Azure powershell cross platform capabilities that this brings about. Firstly, the azure-cli is also a great cross platform tool, but sometimes the powershell capabilities seem to outshine this CLI.
Installing PowerShell on macOS The installation instructions on the repo are pretty straight forward, but for summary:Using TensorFlow Feature Columns in your Custom Estimator Modelhttps://www.damienpontifex.com/2018/01/02/using-tensorflow-feature-columns-in-your-custom-estimator-model/
Tue, 02 Jan 2018 10:25:34 +0000https://www.damienpontifex.com/2018/01/02/using-tensorflow-feature-columns-in-your-custom-estimator-model/The TensorFlow canned estimators got promoted to core in version 1.3 to make training and evaluation of machine learning models very easy. This API allows you to describe your input data (categorical, numeric, embedding etc) through the use of feature columns. The estimator API also allows you to write a custom model for your unique job, and the feature columns capabilities can be utilised here as well to simplify or enhance things.Understanding TensorFlow's rnn inputs, outputs and shapeshttps://www.damienpontifex.com/2017/12/06/understanding-tensorflows-rnn-inputs-outputs-and-shapes/
Wed, 06 Dec 2017 10:03:52 +0000https://www.damienpontifex.com/2017/12/06/understanding-tensorflows-rnn-inputs-outputs-and-shapes/Understanding the shape of your model is sometimes non-trivial when it comes to machine learning. Look at convolutional neural nets with the number of filters, padding, kernel sizes etc and it&rsquo;s quickly evident why understanding what shapes your inputs and outputs are will keep you sane and reduce the time spent digging into strange errors. TensorFlow&rsquo;s RNN API exposed me to similar frustrations and misunderstandings about what I was expected to give it and what I was getting in return.Inspecting TFRecord files and debugging TensorFlow data inputhttps://www.damienpontifex.com/2017/12/02/inspecting-tfrecord-files-and-debugging-tensorflow-data-input/
Sat, 02 Dec 2017 12:01:26 +0000https://www.damienpontifex.com/2017/12/02/inspecting-tfrecord-files-and-debugging-tensorflow-data-input/TFrecord files are TensorFlow&rsquo;s suggested data format, although they are very difficult to inspect given their binary nature. Inspecting the contents of existing record files and ensuring the data in your input pipeline is as you expect is a good technique to have.
Inspecting TFRecord values The first trick is reading in the tfrecord files and inspecting their values in python. As you&rsquo;d expect, the TensorFlow API allows this (although a little hidden down).Azure GPUs, Jupyter and Machine Learninghttps://www.damienpontifex.com/2017/11/30/azure-gpus-jupyter-and-machine-learning/
Thu, 30 Nov 2017 08:32:02 +0000https://www.damienpontifex.com/2017/11/30/azure-gpus-jupyter-and-machine-learning/I&rsquo;m a big advocate of the cloud and it&rsquo;s ability to provide just enough resources ad hoc. You can use whatever you want, and pay for it just when using it. In machine learning there are services such as Google&rsquo;s ML Engine or Azure&rsquo;s upcoming Batch AI but during development, data preprocessing etc sometimes you want immediate iterative processes. In these cases, you can&rsquo;t go past a Jupyter notebook and in this case, running that on a VM.Speeding up TensorFlow development and debug in terminalhttps://www.damienpontifex.com/2017/11/29/speeding-up-tensorflow-development-and-debug-in-terminal/
Wed, 29 Nov 2017 03:46:37 +0000https://www.damienpontifex.com/2017/11/29/speeding-up-tensorflow-development-and-debug-in-terminal/For most of my development, I use Jupyter notebooks which are fantastic for iterative development, but running in managed environments such as Google&rsquo;s ML Engine require python scripts. You can obviously run these locally with python in the terminal or your IDE, but the loop from debug, terminate, change and re-run is rather slow (from what I can tell due to import speed of tensorflow and other imported packages). I wanted to be able to keep these imports in memory (like Jupyter) and just re-run a single function during development.Getting started with TensorFlow in Google ML Enginehttps://www.damienpontifex.com/2017/11/28/getting-started-with-tensorflow-in-google-ml-engine/
Tue, 28 Nov 2017 08:47:22 +0000https://www.damienpontifex.com/2017/11/28/getting-started-with-tensorflow-in-google-ml-engine/In 2017, there seems no doubt that if you aren&rsquo;t running your ML training on a GPU you just aren&rsquo;t doing things right ?. At home, my only computer is my MacBook Pro which is great to develop on, but would take an extremely long time to train something such as an image classification task. Saying this, I&rsquo;d love to have a GPU machine at home, but I also love the opportunity to use this hardware in the cloud without having to power it, upgrade it and generally take care of something you actually own.TensorFlow serving with canned Estimatorhttps://www.damienpontifex.com/2017/10/31/tensorflow-serving-with-canned-estimator/
Tue, 31 Oct 2017 07:07:52 +0000https://www.damienpontifex.com/2017/10/31/tensorflow-serving-with-canned-estimator/I&rsquo;ve had a few attempts at getting TensorFlow estimators into a serving host and a client I can use to query them. Finally getting it working, I thought I&rsquo;d write up the steps for reproduction.
Assumptions and Prerequisites The first assumption is that you have already trained your estimator (say the tf.estimator.DNNRegressor) and this is now in the variable estimator. You also have a list of feature columns as is standard in a variable feature_columns.Using pre-trained Glove embeddings in TensorFlowhttps://www.damienpontifex.com/2017/10/27/using-pre-trained-glove-embeddings-in-tensorflow/
Fri, 27 Oct 2017 07:07:33 +0000https://www.damienpontifex.com/2017/10/27/using-pre-trained-glove-embeddings-in-tensorflow/Embeddings can be used in machine learning to represent data and take advantage of reducing the dimensionality of the dataset and learning some latent factors between data points. Commonly this is used with words to say, reduce a 400,000 word vector to a 50 dimensional vector, but could equally be used to map post codes or other token encoded data. Another use case might be in recommender systems GloVe (Global Vectors for Word Representation) was developed at Stanford and more information can be found here.MNIST with Tensorflow Experiments and Estimatorshttps://www.damienpontifex.com/2017/09/19/mnist-with-tensorflow-experiments-and-estimators/
Tue, 19 Sep 2017 07:07:16 +0000https://www.damienpontifex.com/2017/09/19/mnist-with-tensorflow-experiments-and-estimators/An MNIST classifier is the go-to introduction for machine learning. Tensorflow is no different, and evolves to the Deep MNIST for Experts to include convolution, max pooling, dense layers and dropout: a good overview of ML layers for image problems. The downside of this is it doesn&rsquo;t make use of Tensorflow&rsquo;s new tf.estimator high level APIs. These provide all sorts of benefits for free than the usual sess.run TensorFlow tutorials you see online.Images with directories as labels for Tensorflow datahttps://www.damienpontifex.com/2017/09/19/images-with-directories-as-labels-for-tensorflow-data/
Tue, 19 Sep 2017 07:07:01 +0000https://www.damienpontifex.com/2017/09/19/images-with-directories-as-labels-for-tensorflow-data/A common format for storing images and labels is a tree directory structure with the data directory containing a set of directories named by their label and each containing samples for said label. Often transfer learning that is used for image classification may provide data in this structure.
Update May 2018: If you would like an approach that doesn&rsquo;t prepare into TFRecords, utilising tf.data and reading directly from disk, I have done this in when making the input function for my Dogs vs Cats transfer learning classifier.Convert and using the MNIST dataset as TFRecordshttps://www.damienpontifex.com/2017/09/18/convert-and-using-the-mnist-dataset-as-tfrecords/
Mon, 18 Sep 2017 07:06:45 +0000https://www.damienpontifex.com/2017/09/18/convert-and-using-the-mnist-dataset-as-tfrecords/TFRecords are TensorFlow&rsquo;s native binary data format and is the recommended way to store your data for streaming data. Using the TFRecordReader is also a very convenient way to subsequently get these records into your model.
The data We will use the well known MNIST dataset for handwritten digit recognition as a sample. This is easily retrieved from tensorflow via:
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets( &#34;/tmp/tensorflow/mnist/input_data&#34;, reshape=False ) We then have mnist.Azure functions as static site hosthttps://www.damienpontifex.com/2017/09/05/azure-functions-as-static-site-host/
Tue, 05 Sep 2017 07:06:04 +0000https://www.damienpontifex.com/2017/09/05/azure-functions-as-static-site-host/Azure functions can be very cheap and very easy to manage. Hosting a single page app (SPA) that does very few requests to the host and is basically just a few files to be delivered to the client seems perfect for using the consumption pricing of azure functions. Basically only pay for a request vs a monthly fee.
Azure Resources We&rsquo;ll need a few resources in Azure, they are:Ghost from an NPM module and hosted in Azurehttps://www.damienpontifex.com/2017/08/02/ghost-from-an-npm-module-and-hosted-in-azure/
Wed, 02 Aug 2017 07:05:00 +0000https://www.damienpontifex.com/2017/08/02/ghost-from-an-npm-module-and-hosted-in-azure/It was great to see you can now use Ghost as an NPM module. The upgrade process used to be a pain prior to the 1.0 release. Saying this, I ran into a few bumps trying to host this on Azure.
Follow the docs on Ghost as an NPM module to get started Set server port at runtime Node runs behind IIS and is reverse proxied so the port we are assigned is not static.Xcode auto-increment build on archivehttps://www.damienpontifex.com/2014/11/11/xcode-auto-increment-build-on-archive/
Tue, 11 Nov 2014 07:03:52 +0000https://www.damienpontifex.com/2014/11/11/xcode-auto-increment-build-on-archive/Simple script to bump the build number of my Xcode project on each Archive. The version number I am leaving as a manual change for the moment, but each time I release a build to testers, I want the build to change and a commit message for the change. In Xcode from the menu go to Product -&gt; Scheme -&gt; Edit Scheme On the side, expand the Arhive build and select Pre-actions.Machine Learning in Azure - Linear Regressionhttps://www.damienpontifex.com/2014/10/31/machine-learning-in-azure-linear-regression/
Fri, 31 Oct 2014 07:00:33 +0000https://www.damienpontifex.com/2014/10/31/machine-learning-in-azure-linear-regression/I recently completed Stanford Machine Learning on Coursera taught by Andrew Ng. It is a fantastic course for anyone interested, plus it&rsquo;s free! The course uses MATLAB or Octave for the programming assignments. With the release of Azure Machine Learning, this seemed like a good exercise to reimplement these assignments on Azure ML to learn the tool.
Creating an Azure ML Workspace To get started, you will need an Azure subscription.Self-sizing UITableViewCell with UITextView in iOS8https://www.damienpontifex.com/2014/10/01/self-sizing-uitableviewcell-with-uitextview-in-ios8/
Wed, 01 Oct 2014 04:55:53 +0000https://www.damienpontifex.com/2014/10/01/self-sizing-uitableviewcell-with-uitextview-in-ios8/Ever since watching the session &lsquo;What&rsquo;s New in Table and Collection Views&rsquo; from WWDC 2014, I have tried to create all of my tables and collections use self-sizing and update for dynamic typing. Straight from the presentation, this sums up a pretty good motivation:
This strategy is really going to improve the way that we architect our table views, number 1, because you can encapsulate logic right in the cells, and 2, the fact that you can do that will make it so much easier to have cells that are not a hard coded compile time known height which means you can easily adopt the dynamic font changes.