Multiple object detection using pre trained model in TensorFlow.js
If you were looking to learn how to load in a TensorFlow.js saved model directly yourself then please see our tutorial on loading TensorFlow.js models
If you want to train a system to recognize your own objects, using your own data, then check out our tutorials on "transfer learning".
What can this demo do?
This demo shows how we can use a pre made machine learning solution to recognize multiple objects (yes, more than one at a time!) on any image you wish to present to it. Even better, not only do we know that the image contains an object, but we can also get the co-ordinates of the bounding box for each object it finds, which allows you to highlight the found object in the image.
If what you want to recognize is in that list of things it knows about (for example a cat, dog, etc), this may be useful to you as is in your own projects, or just to experiment with Machine Learning in the browser and get familiar with the possibilities of machine learning.
If you are feeling particularly confident you can check out our GitHub documentation which goes into much more detail for customising various parameters to tailor performance to your needs.
What's in all the files?
We simply have some script tags in our HTML to grab the latest version of TensorFlow.js and the machine learning model class that can take image data as input and output predictions for what it sees in that image data.
In this case we simply reference the following to bring in TensorFlow.js:
However, if you want to pull in a particular version of TensorFlow.js you can do so like this:
Finally you will see that we pull in the machine learning model class we later use in script.js like this:
Nothing to see here. Just styles to make the demo look prettier. You can use or ignore these as you please.