0
$\begingroup$

I am exploring ways to create an object detection model to classify items in an image. There are 3 classes for which I have 100 images per class.

I found a tutorial of tensor flow here: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html#configuring-a-training-job

It says:

For the purposes of this tutorial we will not be creating a training job from scratch, but rather we will reuse one of the pre-trained models provided by TensorFlow.

Does pre-trained model in the above quote mean that it will re-use the training data from the pre-trained model (I can't see the original files used in the pre-trained model), plus my 300 images (100 per class)?

What is difference and factors that help to make a decision between choosing training using pre-trained model vs from scratch?

$\endgroup$

1 Answer 1

3
$\begingroup$

Does pre-trained model in the above quote mean that it will re-use the training data from the pre-trained model (I can't see the original files used in the pre-trained model), plus my 300 images (100 per class)?

No.

Using a pre-trained model means that, for the model you are going to train, the initial weights will be taken from an already trained model; for this to be possible, the architecture of the pre-trained model needs to match your model's architecture. On the other hand, training from scratch means that the initial weights of your model will be set randomly.

You usually use a pre-trained model when you don't have a lot of labeled data. By using a pre-trained model you are doing "transfer learning", meaning that you are transferring what the previous model learned in the dataset it was trained on to your dataset.

When you use a pre-trained model, you normally set a smaller learning rate to avoid diverging too much. In some cases, you only train some layers of the model, "freezing" the original weights from the pre-trained model in the rest of layers.

$\endgroup$
6
  • $\begingroup$ Suppose I use a pre-trained model to train model for my 3 class training data, then will the trained model be able to classify the previous classes or only my 3 classes? $\endgroup$
    – variable
    Commented Aug 1, 2022 at 15:56
  • $\begingroup$ Only your 3 classes. Furthermore, when doing transfer learning for image classification, you would normally only reuse part of the pre-trained model, specifically the convolutional layers (i.e. everything but the final fully connected layers). This also enables you to use for your model images of a different size than the ones used to pre-train the original model. $\endgroup$
    – noe
    Commented Aug 1, 2022 at 17:21
  • $\begingroup$ Is there any way I can use the pre-trained models abilities (classes) plus my 3 classes? $\endgroup$
    – variable
    Commented Aug 2, 2022 at 4:22
  • $\begingroup$ This may depend. Please, create a new question specifying if this is a multi-class classification problem (i.e. labels are mutually exclusive) or a multi-label classification (i.e. an input image can belong to many classes simultaneously) $\endgroup$
    – noe
    Commented Aug 2, 2022 at 6:15
  • $\begingroup$ Please can you explain what you mean by for this to be possible, the architecture of the pre-trained model needs to match your model's architecture $\endgroup$
    – variable
    Commented Aug 3, 2022 at 5:34

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.