Click4Ai

331.

Medium

Fine-tuning CNN

====================

Fine-tuning a CNN involves adjusting the pre-trained model's weights to fit the new task. This can be done by training the model on the new task's data. In this problem, we will fine-tune a pre-trained CNN to classify images.

Example:

We have a pre-trained model that can classify images into 1000 categories. We want to fine-tune this model to classify images into 10 categories.

Constraints:

  • The pre-trained model is a CNN.
  • The new task has 10 categories.
  • The pre-trained model has 1000 categories.
  • The new task has limited data.
  • Test Cases

    Test Case 1
    Input: [VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3)), 10]
    Expected: Model(inputs=..., outputs=Dense(...))
    Test Case 2
    Input: [VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3)), 20]
    Expected: Model(inputs=..., outputs=Dense(...))
    + 3 hidden test cases