Skip to content

Commit 57979ad

Browse files
authored
Lint the Transfer learning and fine-tuning tutorial
1 parent 32a0d14 commit 57979ad

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

site/en/tutorials/images/transfer_learning.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
"## Create the base model from the pre-trained convnets\n",
428428
"You will create the base model from the **MobileNet V2** model developed at Google. This is pre-trained on the ImageNet dataset, a large dataset consisting of 1.4M images and 1000 classes. ImageNet is a research training dataset with a wide variety of categories like `jackfruit` and `syringe`. This base of knowledge will help us classify cats and dogs from our specific dataset.\n",
429429
"\n",
430-
"First, you need to pick which layer of MobileNet V2 you will use for feature extraction. The very last classification layer (on \"top\", as most diagrams of machine learning models go from bottom to top) is not very useful. Instead, you will follow the common practice to depend on the very last layer before the flatten operation. This layer is called the \"bottleneck layer\". The bottleneck layer features retain more generality as compared to the final/top layer.\n",
430+
"First, you need to pick which layer of MobileNet V2 you will use for feature extraction. The very last classification layer (on \"top\", as most diagrams of machine learning models go from bottom to top) is not very useful. Instead, you will follow the common practice to depend on the very last layer before the flatten operation. This layer is called the \"bottleneck layer\". The bottleneck layer features retain more generality as compared to the final/top layer.\n",
431431
"\n",
432432
"First, instantiate a MobileNet V2 model pre-loaded with weights trained on ImageNet. By specifying the **include_top=False** argument, you load a network that doesn't include the classification layers at the top, which is ideal for feature extraction."
433433
]
@@ -574,7 +574,7 @@
574574
"id": "O1p0OJBR6dOT"
575575
},
576576
"source": [
577-
"Apply a `tf.keras.layers.Dense` layer to convert these features into a single prediction per image. You don't need an activation function here because this prediction will be treated as a `logit`, or a raw prediction value. Positive numbers predict class 1, negative numbers predict class 0."
577+
"Apply a `tf.keras.layers.Dense` layer to convert these features into a single prediction per image. You don't need an activation function here because this prediction will be treated as a `logit`, or a raw prediction value. Positive numbers predict class 1, negative numbers predict class 0."
578578
]
579579
},
580580
{
@@ -596,7 +596,7 @@
596596
"id": "HXvz-ZkTa9b3"
597597
},
598598
"source": [
599-
"Build a model by chaining together the data augmentation, rescaling, base_model and feature extractor layers using the [Keras Functional API](https://www.tensorflow.org/guide/keras/functional). As previously mentioned, use `training=False` as our model contains a `BatchNormalization` layer."
599+
"Build a model by chaining together the data augmentation, rescaling, `base_model` and feature extractor layers using the [Keras Functional API](https://www.tensorflow.org/guide/keras/functional). As previously mentioned, use `training=False` as our model contains a `BatchNormalization` layer."
600600
]
601601
},
602602
{
@@ -659,7 +659,7 @@
659659
"id": "lxOcmVr0ydFZ"
660660
},
661661
"source": [
662-
"The 2.5M parameters in MobileNet are frozen, but there are 1.2K _trainable_ parameters in the Dense layer. These are divided between two `tf.Variable` objects, the weights and biases."
662+
"The 2.5 million parameters in MobileNet are frozen, but there are 1.2 thousand _trainable_ parameters in the Dense layer. These are divided between two `tf.Variable` objects, the weights and biases."
663663
]
664664
},
665665
{
@@ -730,7 +730,7 @@
730730
"source": [
731731
"### Learning curves\n",
732732
"\n",
733-
"Let's take a look at the learning curves of the training and validation accuracy/loss when using the MobileNet V2 base model as a fixed feature extractor."
733+
"Let's take a look at the learning curves of the training and validation accuracy/loss when using the MobileNetV2 base model as a fixed feature extractor."
734734
]
735735
},
736736
{
@@ -785,7 +785,7 @@
785785
},
786786
"source": [
787787
"## Fine tuning\n",
788-
"In the feature extraction experiment, you were only training a few layers on top of an MobileNet V2 base model. The weights of the pre-trained network were **not** updated during training.\n",
788+
"In the feature extraction experiment, you were only training a few layers on top of an MobileNetV2 base model. The weights of the pre-trained network were **not** updated during training.\n",
789789
"\n",
790790
"One way to increase performance even further is to train (or \"fine-tune\") the weights of the top layers of the pre-trained model alongside the training of the classifier you added. The training process will force the weights to be tuned from generic feature maps to features associated specifically with the dataset.\n",
791791
"\n",
@@ -929,9 +929,9 @@
929929
"id": "TfXEmsxQf6eP"
930930
},
931931
"source": [
932-
"Let's take a look at the learning curves of the training and validation accuracy/loss when fine-tuning the last few layers of the MobileNet V2 base model and training the classifier on top of it. The validation loss is much higher than the training loss, so you may get some overfitting.\n",
932+
"Let's take a look at the learning curves of the training and validation accuracy/loss when fine-tuning the last few layers of the MobileNetV2 base model and training the classifier on top of it. The validation loss is much higher than the training loss, so you may get some overfitting.\n",
933933
"\n",
934-
"You may also get some overfitting as the new training set is relatively small and similar to the original MobileNet V2 datasets.\n"
934+
"You may also get some overfitting as the new training set is relatively small and similar to the original MobileNetV2 datasets.\n"
935935
]
936936
},
937937
{

0 commit comments

Comments
 (0)