0
$\begingroup$

I do not understand how it is possible to add classes incrementally to a classification model without retraining the whole model with all classes. Even getting an idea of the general working logic or a simple example will be valuable for me.

$\endgroup$

2 Answers 2

0
$\begingroup$

In the simplest scenario each time you want to add new class you need to retrain the whole model. You have to also use loss function for multiclass (e.g. https://keras.io/api/losses/probabilistic_losses/#categoricalcrossentropy-class).

Complicated: if adding new class is very dynamic (system where many new classes are added every day, hour, second) you can think if model with triplet loss is applicable.

$\endgroup$
7
  • $\begingroup$ I was looking for a solution besides the retraining whole model.. Can you give more explanation about "you can think if model with triplet loss is applicable?" $\endgroup$
    – Mas A
    Jan 17, 2022 at 12:33
  • $\begingroup$ In triplet loss you build one model that creates embbedings for a sample and you can find closest sample from database. Look at: youtube.com/watch?v=6jfw8MuKwpI&ab_channel=DeepLearningAI , youtube.com/watch?v=d2XB5-tuCWU&ab_channel=DeepLearningAI , arxiv.org/pdf/1503.03832.pdf $\endgroup$
    – jacekblaz
    Jan 17, 2022 at 12:48
  • $\begingroup$ but what is its relation with class incremental learning (CIL)? suppose that we have a model that classifies fruits as the apple, orange. After a certain time, we want to add banana to the model. Therefore, for a given image, we want the probability of being apple, orange and banana as output. What is the relation of that with triplet loss? $\endgroup$
    – Mas A
    Jan 17, 2022 at 13:16
  • 1
    $\begingroup$ "suppose that we have a model that classifies fruits as the apple, orange" - that is wrong assumption with tripplet loss trained model. This model does not classify samples as orange or apple. This model produce vector as output. In database you store vectors (produced by model) for 10 different samples of oranges, 10 vectors (produced by the same model) of different apples. Now you pass through model image of orange and the output is vector (e.g. shape=(1,100)). Now you use e.g. n-closest neighbor between this bector of new image vs all vectors in database. That is how you obtain label. $\endgroup$
    – jacekblaz
    Jan 17, 2022 at 13:41
  • 1
    $\begingroup$ Now if you want to add class strawberry, then just pass 10 images of strawberry through model and store those 10 vectors in database. The thing is you need to train model with triplet loss (or sth similar) so the model does not learn to classify to some defined classes but learns to produce good embedding representation. Please watch youtube link I provided before - Andrew Ng with longer time teaches much better than me in stack comments ;) $\endgroup$
    – jacekblaz
    Jan 17, 2022 at 13:44
0
$\begingroup$

Bit late to the party, but so-called one-class classifiers (aka class models) model each class completely independently of all other classes.

Thus, adding (or changing/retraining) one class doesn't affect any of the other classes.

Note that these are rather different from discriminative classifiers, they are e.g. for scenarios where something unknown may appear and should be identified as such. A scenario where new classes "appear" later on is inherently very foreign to dicriminative models.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.