# Merging categories

With category merging, there is no need to create a new dataset when you want to perform a new operation on the same data. Training can use images from different datasets when you merge their categories to create new ones.

# Merging during model creation

Let’s say you have four different datasets that contain images of cats and dogs. They were uploaded at different times and were used for different tasks. Now you want to use them for a common training task, and you will use the category merge function to do so.

Dashboard view
Dashboard view
The datasets have categories with four different names. You want the model to classify the images into only two categories - DOG and CAT.

This can be achieved through the model parametrization process. In the step where you have to define the training set, you can access all the datasets you have ever uploaded along with their categories. Now it is only up to you to decide which categories from which datasets to select for the training set.

New model
New model

The categories can be freely merged. In this example, you will include the sets of cats, perros, gatos, and one category dog from the cats_dogs set in the merged training set.

Category selection
Category selection

You have selected a total of four categories from four sets - two categories representing cats, and two representing dogs. Based on the previously selected categories, you created super-categories, so-called buckets, represented by a rectangle framed by a dashed line. The names of the categories have now become the names of the buckets.

The tiles within the buckets show the original dataset name, along with the category names. Each category is automatically assigned to a corresponding bucket.

Bucket names can be edited (with the same restrictions as for category names), click on the pencil icon to do so. You can also add new buckets by clicking on Add category, and remove unnecessary ones by clicking on the trash can icon. Category tiles can be dragged and dropped between buckets. If there are two or more categories in a bucket, they will be merged.

Keep in mind: No bucket can be empty, because in the training context you cannot use a category that is not represented by any dataset.

Back to the example. We want the classification model to recognize two categories: CAT and DOG. To do this, merge the categories. Drag and drop chats into the CAT category and perros into the DOG category.

Merging categories
Merging categories

Now remove the empty buckets and (optionally) edit the bucket name.

From the four data sets with assigned categories, you have now created a training set with two categories.

Deleting empty categories
Deleting empty categories

# Merging categories within a dataset

It is also possible to merge categories within a dataset. To do this, navigate to the dataset of your choice.

Dataset view
Dataset view

Select the categories you want to merge. For example, we want to merge the category Gilt-Head_Bream into Gilt_Head_Bream. Click the Merge categories button to continue.

Select category
Select category

In the pop-up window, pick the category name to which you want to merge the selected category/categories. Confirm by clicking Ok.

Merge selected category
Merge selected category

As you can see, the images from the category Gilt-Head_Bream were successfully merged into the category Gilt_Head_Bream.