Create your Image or Text Classifier using GenAI
This tutorial explains how to create a text or image classifier, just by defining the labels or categories without the need to prepare a dataset that typically involves a lot of time and effort. This is a great way to start using automatic classifiers to tag emails, documents, articles, or any text, or tag images to detect brands, specific objects, the breed of an animal, parts of machinery, etc.
On your dashboard, click “New Project” and then choose "Classifier" from the available options:
On the next screen, choose the type of data you want to classify: Text or Image. For this tutorial, we'll cover both options.
After selecting the data type, you'll see a modal to choose your classification method. Select "GenAI Classifier":
Enter your categories and classification details.
- Click ‘Add manually’ to make a manual configuration.
Note: ‘Import from JSON file’ helps you import a pre-existing configuration or template you want to use as a base for your new project.
For example you can download a News Classifier similar to the one we will show later here: New Classifier Definition
In the "Classification Categories" section, enter the name and click "Add" for each category you want to identify. Let's say you want to create a News Text Classifier, some of the categories could be "Sports", "Economy", "Politics", "Entertainment", etc.
This step is optional but recommended depending on your use case but as a general tip it is recommended to give some examples or more context. For each category you can:
Edit description: Provide a detailed description of each category to guide the model. For example, you could specify what kind of news articles fall under the "Sports" category.
Add positive examples: Provide a few examples to help the model understand what belongs to each category. For example, for the "Sports" category, you could add sentences like "Real Madrid won the Champions League" or "Lebron James is injured."
Add negative examples: Utilize counter examples to show the model what does NOT belong to a category. For example, in the "Sports" category, you could add some negative examples like "Tech Titans Clash in High-Stakes Patent Battle" or " Top Chefs Compete for the Coveted Golden Apron Title".
Additional settings:
Enable Multi-Category: Turn on to allow the model to return multiple categories instead of only one. In some cases it could be valuable to know if a news is something related to business but also to crypto.
Explanations: Activate this option to gain insights into the model's reasoning behind each classification. This can be useful for debugging and improving the model's accuracy over time.
Contextual Information: Provide additional contextual details on how the classifier will be used. For example, you could mention that it will be used for categorizing news articles gathered through web scraping.
Model Selection: While GPT-4o-mini is the default option, you can select more powerful AI models based on your Cogniflow subscription plan to potentially boost accuracy.
Require high resolution: This option is only available for images classification. Enable this to prevent images from being reduced in size, ideal for tasks needing detailed image analysis.
Once you've set up all the details, click the "Save Settings" at the bottom of the page and then click on "Use this model!" to try it:
If you need to make changes, go to the "Settings" tab to modify your classifier's parameters.
Testing the model examples:
On your dashboard, click “New Project” and then choose "Classifier" from the available options:
On the next screen, choose the type of data you want to classify: Text or Image. For this tutorial, we'll cover both options.
After selecting the data type, you'll see a modal to choose your classification method. Select "GenAI Classifier":
Enter your categories and classification details.
- Click ‘Add manually’ to make a manual configuration.
Note: ‘Import from JSON file’ helps you import a pre-existing configuration or template you want to use as a base for your new project.
For example you can download a News Classifier similar to the one we will show later here: New Classifier Definition
In the "Classification Categories" section, enter the name and click "Add" for each category you want to identify. Let's say you want to create a News Text Classifier, some of the categories could be "Sports", "Economy", "Politics", "Entertainment", etc.
This step is optional but recommended depending on your use case but as a general tip it is recommended to give some examples or more context. For each category you can:
Edit description: Provide a detailed description of each category to guide the model. For example, you could specify what kind of news articles fall under the "Sports" category.
Add positive examples: Provide a few examples to help the model understand what belongs to each category. For example, for the "Sports" category, you could add sentences like "Real Madrid won the Champions League" or "Lebron James is injured."
Add negative examples: Utilize counter examples to show the model what does NOT belong to a category. For example, in the "Sports" category, you could add some negative examples like "Tech Titans Clash in High-Stakes Patent Battle" or " Top Chefs Compete for the Coveted Golden Apron Title".
Additional settings:
Enable Multi-Category: Turn on to allow the model to return multiple categories instead of only one. In some cases it could be valuable to know if a news is something related to business but also to crypto.
Explanations: Activate this option to gain insights into the model's reasoning behind each classification. This can be useful for debugging and improving the model's accuracy over time.
Contextual Information: Provide additional contextual details on how the classifier will be used. For example, you could mention that it will be used for categorizing news articles gathered through web scraping.
Model Selection: While GPT-4o-mini is the default option, you can select more powerful AI models based on your Cogniflow subscription plan to potentially boost accuracy.
Require high resolution: This option is only available for images classification. Enable this to prevent images from being reduced in size, ideal for tasks needing detailed image analysis.
Once you've set up all the details, click the "Save Settings" at the bottom of the page and then click on "Use this model!" to try it:
If you need to make changes, go to the "Settings" tab to modify your classifier's parameters.
Example of an Image Classifier to identify a dog’s breed
Testing the model examples:
Updated on: 22/11/2024
Thank you!