Blog post: Train Your Own Visual Recognition Model
Quick Start and Reference: clarifai.com/developer
Web UI: clarifai.com/explorer
Goal: Build and train a custom model that can accurately categorize common aviation imagery.
Custom concepts to be trained:
jet engine, turboprop, window seat, cockpit, wing, cityscape
Step 1: Create an account at clarifai.com/developer/signup
Step 2: Create an Application and Explore the UI at clarifai.com/explorer
API calls (operations) are tied to an account and application. Any model that you create or search indexes that you add images to will be contained within an application.
Step 3: Add images to your application
Custom models are built by training on your own data. The model will be able to make predictions specific to your own unique content and context.
- Drag + drop image files
- Paste in a list of urls
Step 4: Adding the first concept to those images
A model is created as soon as you create your first concept. The model name inherits the name of your Application. As you add more concepts to other images, a new version of a model will be trained.
All images are in your application are referred to as inputs.
Step 5: Provide negative examples for that concept ('jet engine')
These selected images are not jet engines. Simply double click on the concept name of 'jet engine' for the red X to appear.
A robust and well performing concept is made up of both positive and negative examples.
Negative examples are important so that your model can learn exactly what images (objects, scenes) are jet engines. A model will perform better by providing negative image examples that are similar in nature and yet still different rather than providing negative examples that are obviously different and completely unrelated.
An image of a zebra would serve as a more effective negative example for your concept of 'cow' than providing an image of a car as a negative example.
Step 6: Adding additional concepts to your model
There are two primary ways within the UI for you to add concepts to your model.
1. "Create Concept" as you select multiple images on the main application page
2. "Add Concept" as you browse one specific image
Tip: Holding shift while choosing images on the main UI allows you to select multiple at the same time.
Add additional positive and negative examples
A quick and easy to add negative and positive examples for a particular concept is to view the concept details by clicking the three dots button next to it.
Here in the concept detail view you are able to see:
- Creation date of your concept
- Samples of positive examples
- Samples of negative examples
Adding examples of both kinds is done by clicking the Add More Upload Arrow.
Now you can paste a large list (32 max) of URLs.
Step 7: Review the positive and negative examples for each concept
Once you have started to train your model, you may want to review the examples that make up each concept. To do this, navigate to the concept detail view by clicking the three dots navigation button and then simply clicking the "Positive Examples" or "Negative Examples" header.
Step 8: Observe your model predictions and updates in real-time
Your model will make predictions on each image that you add to your application. You can view these predictions by clicking into a single image. Predictions are made with your own understanding of the world (concepts) and each is accompanied with a confidence score as to what the media contains.
Adding a concept to an image will trigger your model to re-train immediately based on that feedback.
Step 9: Search by concept
To search by concept, you simply click on the concept name in the lefthand panel.
Searching by concept is a powerful way to gauge how your concept prediction is performing. It also will surface other images in your application that may be useful to serve as positive examples.
When searching by concept, results of that query are returned.
Step 10: View model details
Click your model name in the lefthand panel to see:
- Model creation date
- Model Status
- Current concepts
Viewing model predictions and searching
As a quick test, you can add additional images to your application without applying concepts to them. As you browse these images you will start to gauge how well your model is performing.
Within an application, you can search by your custom concepts, an image url and General Model concepts. General Model concepts consist of over 11,000 objects, scenes and terms that Clarifai has built to provide widespread understanding of any media indexed with our APIs.
General Model tags appear alongside each image under your custom concept predictions as well as auto-complete suggestions in the search box.
Success! Accurate predictions now allow for real-time categorization, feedback and recommendations.