RETURN TO BLOGS

FileMaker 19: Machine Learning

by Valerie Muradian - Application Developer

Machine Learning CoreML support is probably one of the most exciting new features in FileMaker 19. The CoreML framework enables developers to leverage the power of machine learning in FileMaker without any additional plugins or integrations. Even if you have never worked with machine learning before, Claris significantly simplifies the whole process by facilitating the integration with the new Configure Machine Learning Model script step and ComputeModel function.

That said, don’t let the simplicity of the process fool you: machine learning is an extremely powerful tool that can enhance any FileMaker application. In this blog post, we’ll review the basic concepts of Machine Learning, how to use pre-trained models, and even train your own CoreML model that can be easily integrated in FileMaker 19 applications! For everyone who is as excited about CoreML support as we are, we included a sample file that shows how to create and integrate an image recognition CoreML model in FileMaker 19.

Machine Learning in a Nutshell

Arthur Samuel introduced the phrase “Machine Learning” in 1959, defining it as “the ability to learn without being explicitly programmed.” Unlike the typical program that needs explicit instructions in order to do anything, Machine Learning Models need lots of data and time to train in order to start making predictions. The more data you give your model, the more accurate results you’ll get. This is how an iOS app can tell you what plant is on the photo or websites like Zillow predict the prices of the houses.

Image Recognition is a great example of machine learning. Using CoreML, you can submit an image to a Machine Learning model and get text identifiers in return, like so:

CoreML Features and Limitations in FileMaker 19

The CoreML framework is well established – it was made available for iOS and macOS a few years ago and has improved significantly since then. FileMaker developers can leverage pre-trained models created in the past few years and adapt new ideas from existing iOS applications. There are many models available.

It is important to note, however, that not all available models are supported in FileMaker 19.  Models that perform Image analysis and General analysis are supported – models that output complex arrays or produce images are not.

Image analysis models take images as input and return data – like identifying categories, product names, and so on. Imagine sending an image of a random plumbing fixture and getting a SKU number in return! General analysis models include other CoreML models take a wide range of inputs, generally text and numbers, and return various results based on their particular area of focus. You can submit an address and get demographic or market predictions, for example. Since Image analysis is easier to understand, we’ll use it as a main example in this article as well as in our sample file.

Image Analysis in FileMaker 19 in 5 Steps:

  1. Upload your Model to a container field.
  2. Load a Model by using the Configure Machine Learning script step with a “Vision” parameter. Specify the name of the model and the container field where this model is stored. Use the Get(LastError) function right after this new script step to check whether or not the model was loaded successfully.
  3. Create two fields; a container field to store the image that will be analyzed and a calculation field defined to use the new ComputeModel function. Its first parameter is the name of the model used in the script, the second one is “image”, which is the default parameter for image recognition models. Lastly, specify the name of the container that contains an image that will be analyzed.
  4. The next step will be to parse the results provided by the ComputeModel function. The result is a list of classifications sorted by accuracy. The average model usually gives a dozen of results with the first one being the most accurate one. To get the results out of this function, we can use our good old JSONGetElement function. JSONGetElement ( Calc; “[0].classification” ), for example, will show only the most accurate prediction, while JSONGetElement ( Calc; “[0].confidence” ) will return a number that represents the model’s certainty.
  5. Finally, it’s important to unload the model before exiting the application to free the resources the model consumed. Use the same script step from the second step but with an “Unload”

While image recognition is significantly simplified in FileMaker 19, there’s a lot of complexity under the hood. To help, we have included a sample file with a couple models ready for you to explore.

How to Create your own CoreML Model

Now comes the most exciting part – In FileMaker 19, we are not limited to using only pre-trained models.

To illustrate the image recognition process in FileMaker 19, we trained our own CoreML model inspired by a “Not Hotdog” app from the TV show “Silicon Valley”. It was developed when one of the characters decided to create the next great start up – “SeeFood —the ‘Shazam for food.’” It was meant to classify pictures of food but ended up being good only for recognizing hot dogs. (If you’ve never watched Silicon Valley, it’s telling that you’re reading a FileMaker blog – we suggest you may well have an affinity for the show. Just sayin’…) You can see this in action in the provided example file.

Using this great guide written by Apple, anyone can train their own CoreML model to recognize virtually anything. We see an unlimited number of uses here – like FileMaker applications that can recognize various auto parts or tools as one example.

Our Hotdog CoreML Model is far from perfect – we used only 10 images and not enough training data to make it really powerful. Yet, it can recognize hotdogs that you can find in the app under “Sample Images”. Here are the results of the training process in Xcode:

This model is also included in the file and you’re free to play with it and maybe even improve it and if you like an idea of having a FileMaker app that can recognize hotdogs.

Jokes aside, this simple example is aimed at showing how easy it is to use both pre-trained and your own models in FileMaker 19. Claris did an amazing job simplifying machine learning and allowing FileMaker developers to integrate complex CoreML models in just a few easy steps.

If you’d like to learn more about FileMaker 19, we recommend the posts we’ve prepared on summarizing its features and an example of its exciting JavaScript capabilities.

These are exciting times for Claris and for our community. We encourage you to dive into the Machine Learning pool – the water’s fine. In keeping with decades of product focus, Claris has done a great job of making the learning curve a smooth, steady one.

 

Please enter your contact information to download the CoreML Demo File.

This field is for validation purposes and should be left unchanged.
DOWNLOAD

Leave a comment

Your email address will not be published. Required fields are marked *

Your email address will not be published. Required fields are marked *

Built with you in mind

Speak to one of our expert consultants about making sense of your data today. During
this free consultation, we'll address your questions, learn more about your business, and
make some immediate recommendations.

REQUEST A TOUR GET A FREE CONSULTATION

Stay in touch!

This field is for validation purposes and should be left unchanged.