Blog

Software tips, techniques, and news.

FileMaker Machine Learning Using CoreML

Machine learning and artificial intelligence are rushing in the next era of computing by enabling machines to make decisions, rather than humans telling machines which decisions to make. Whether you need to classify objects in an image, parse speech into text, or get recommendations on what products to market next quarter, machine learning can be adopted to assist. Leveraging FileMaker’s machine learning capabilities on MacOS makes integrating artificial intelligence into your business easier than ever.

youtube-preview

Models 0x101

A predictive machine learning algorithm relies on a model—a set of black box functions that generate an expected output set based on an unknown input set. The model is created using a collection of training data with known inputs and outputs.

For example, to create a model that identifies different types of dog breeds, you would train the model using a collection of photos for each dog breed. Once created, giving the model an image of any type of dog breed that was included in the training data would produce an output identifying the image’s breed.

The first step in using machine learning in your FileMaker system is to either create or use an existing model. Apple provides a handful of CoreML models for image and text recognition. CoreML is Apple’s library that optimizes performance of on-device machine learning processes. Executing machine learning tasks on-device, as opposed to integrating with an online API, improves responsiveness and privacy.

Models, No Assembly Required

new create ml project.

Apple also provides Create ML—an Xcode tool that makes creating a CoreML model effortless, with no code required. Once a model has been created using Create ML, getting it up and running with your FileMaker database takes only minutes.

The Create ML tool can be started by opening Xcode and then selecting Xcode>Open Developer Tool>Create ML from the menu bar. Select New Document from the dialogue and then you’ll be asked to choose a template. For this demo, we’re choosing to work with an image classifier, but Create ML provides options for sound, motion, text, and data analysis as well.

After selecting Image Classifier, give a name to your new project and click Next. Choose a location to save your project and once the project window is open, you’re ready to begin training your model.

If You Give A Model An Image

create ml training complete.

Next up, you’ll need to supply the model with a set of images for the training and testing processes. This demo will be creating a model to identify objects in the Caltech 101 dataset. You can download the image dataset yourself by visiting the Caltech 101 website. Included with the sample file is a model created using Create ML and this collection of images.

With Create ML open, we select the 101_ObjectCategories folder for the Training Data section. This folder contains subfolders that each have a set of images to train the model. To begin the training, click the Begin Training button at the top of the screen. Once the training is complete, Create ML will produce a .mlmodel file that can be used in FileMaker.

Loading The Model In FileMaker

In usual FileMaker fashion, incorporating the model into your system is effortless—just drop it into a container field. Since this demo is using an image classification model, there’s also a container to hold the image to classify. Putting the model to use requires only a couple of script steps. The first script step sets the stage for loading the model into memory.

Configure Machine Learning Model [ Operation: <operation> ; Name: <modelName> ;  From: <modelContainerField> ]

The first parameter specifies the operation, which can be either vision, general, or unload. Vision is used for image inputs and general is used for scalar input values. Unload frees the named model from memory. The second parameter specifies a name, which is used to reference the model in subsequent script steps. The last parameter specifies a container field from which to load the model.

Compute The Model

After the model is loaded, the next step is to use the ComputeModel function. This returns a result from processing the given input. There is a slight variation in this function based on which type of model is being used.

Vision:

ComputeModel ( <modelName> ; "image" ; <value1> {;"confidenceLowerLimit" ; <value2> ; "returnAtLeastOne" ; <value3>} )

General:

ComputeModel ( <modelName> ; <name1> ; <value1> {;<name2>; <value2>;...<nameN>; <valueN>} )

For vision models, value1 is the input image container. To limit the results returned, confidenceLowerLimit can optionally be specified between 0.0 and 1.0. The results will be limited to classifications that have a confidence level above the specified value. The returnAtLeastOne parameter is used in conjunction with the optional confidenceLowerLimit parameter. If no results are returned with a higher confidence level than the specified limit and returnAtLeastOne is true, the first result will be returned. This technique can be used to always return only the first classification in the list by specifying a limit of 1.0.

General models are similar but require the parameter name of the model as defined by the creator. They do not include the confidenceLowerLimit or returnAtLeastOne parameters. Multiple parameter-value pairs can be specified as needed.

Unload The Model

After using the model, it’s important to free the memory resources required to compute the output. The Configure Machine Learning Model script step supplied with the name of the model to unload is used.

Configure Machine Learning Model [ Name: <modelName> ; Operation: Unload ]

After the model is unloaded, you can continue with your script as needed.

Conclusion

Leveraging FileMaker’s machine learning capabilities will speed up time consuming tasks such as classifying images and transcribing speech; moreover, it can help with data analysis by providing predictive insights based on your existing data. Contact us today for assisting in adding machine learning to your FileMaker system!

Did you know we are an authorized reseller for Claris FileMaker Licensing?
Contact us to discuss upgrading your Claris FileMaker software.

Download the FileMaker Machine Learning Using CoreML File

Please complete the form below to download your FREE FileMaker file.

FileMaker Experience *
Terms of Use *
OPT-IN: I agree that I am downloading a completely free FileMaker application file with no strings attached. This file is unlocked, and I may use it for my business or organization as I see fit. Because I am downloading a free file, I agree that I should receive occasional marketing. I understand that I can OPT-OUT of these emails at anytime.
aaron kaiser headshot.
Aaron Kaiser

Aaron is a certified FileMaker and web developer who approaches solutions to problems from a logical standpoint and puts a high priority on the accuracy of his work.