Skip to content

Commit 2db1099

Browse files
committed
modify : VGG tutorial
feedback accepted Re PullRequest because of network issue
1 parent c9723cf commit 2db1099

File tree

1 file changed

+10
-67
lines changed

1 file changed

+10
-67
lines changed

beginner_source/Pretraining_Vgg_from_scratch.py

Lines changed: 10 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
"""
2-
<<<<<<< HEAD
3-
Pretraining VGG from scratch
4-
=======
5-
Pretraining VGG from scratch
6-
>>>>>>> origin/master
2+
Pre-training VGG from scratch
73
============================
84
95
@@ -37,26 +33,17 @@
3733
Overview
3834
------------
3935
40-
<<<<<<< HEAD
41-
If you are running this in Google Colab, install ``albumentations`` by running the following command:
42-
43-
.. code-block:: py
44-
45-
46-
!pip install albumentations
47-
=======
4836
​​VGG is a model that attracted attention due to its ability to build deeper layers and dramatically
49-
shorten the training time compared to AlexNet, which was the state-of-the-art model at the time of the publishing
37+
shorten the training time compared to ``AlexNet``, which was the state-of-the-art model at the time of the publishing
5038
of the `original paper <https://arxiv.org/abs/1409.1556>`__.
51-
>>>>>>> origin/master
5239
53-
Unlike AlexNet's 5x5 and 9x9 filters, VGG uses only 3x3 filters. Using multiple 3x3 filters can
40+
Unlike ``AlexNet``'s 5x5 and 9x9 filters, VGG uses only 3x3 filters. Using multiple 3x3 filters can
5441
obtain the same receptive field as using a 5x5 filter, but it is effective in reducing the number
55-
of parameters. In addition, since it passes through multiple nonlinear functions, the
56-
nonlinearity increases even more.
42+
of parameters. In addition, since it passes through multiple non-linear functions, the
43+
non-linearity increases even more.
5744
5845
VGG applies a max pooling layer after multiple convolutional layers to reduce the spatial size.
59-
This allows the feature map to be downsampled while preserving important information. Thanks
46+
This allows the feature map to be down-sampled while preserving important information. Thanks
6047
to this, the network can learn high-dimensional features in deeper layers and prevent overfitting.
6148
6249
In this tutorial, we will train the VGG model from scratch using only the configuration presented
@@ -103,55 +90,11 @@
10390

10491

10592
######################################################################
106-
<<<<<<< HEAD
107-
# Purpose point of this tutorial
108-
# ----------------------------
109-
#
110-
111-
112-
######################################################################
113-
# - We train the model from scratch using only the configuration
114-
# presented in the paper.
115-
#
116-
# - we do not use future method, like ``Batch normalization``,Adam , He
117-
# initialization.
118-
#
119-
# - You can apply to ImageNet Data.
120-
#
121-
# - If you can download the ImageNet Data(140GB), you can apply this
122-
# tutorial to reproduce Original VGG.
123-
#
124-
# - You can learn VGG within the training time suggested in the paper.
125-
#
126-
127-
128-
######################################################################
129-
# Background
130-
# -----------------------
131-
#
132-
133-
134-
######################################################################
135-
# VGG became a model that attracted attention because it succeeded in
136-
# building deeper layers and dramatically shortening the training time
137-
# compared to ``AlexNet``, which was the SOTA model at the time.
138-
#
139-
# Unlike ``AlexNet``'s 5x5 9x9 filters, VGG only uses 3x3 filters.
140-
# Using multiple 3x3 filters can obtain the same receptive field as using a 5x5 filter, but it is effective in reducing the number of parameters.
141-
# In addition, since it passes through multiple nonlinear functions, the ``nonlinearity`` increases even more.
142-
#
143-
# VGG applied a max pooling layer after multiple convolutional layers to reduce the spatial size.
144-
# This allowed the feature map to be ``downsampled`` while preserving important information.
145-
# Thanks to this, the network could learn high-dimensional features in deeper layers and prevent overfitting.
146-
147-
######################################################################
148-
=======
149-
>>>>>>> origin/master
15093
# VGG Configuration
15194
# -----------------
15295
#
15396
# In this section, we will define configurations suggested in the VGG paper.
154-
# We use the CIFAR100 dataset. The authors of the VGG paper scale images isotropically,
97+
# We use the CIFAR100 dataset. The authors of the VGG paper scale images ``isotropically``,
15598
# which means increasing the size of an image while maintaining its proportions,
15699
# preventing distortion and maintaining the consistency of the object.
157100

@@ -207,7 +150,7 @@
207150
# --------------------
208151
#
209152
# As mentioned above we use the CIFAR100 dataset in this tutorial. According to the VGG paper,
210-
# the authors scale the images isotropically to maintain their proportions. This method, known
153+
# the authors scale the images ``isotropically`` to maintain their proportions. This method, known
211154
# as isotropic scaling, increases the size of an image while preserving its aspect ratio,
212155
# thus avoiding distortion and maintaining object consistency.
213156
#
@@ -421,7 +364,7 @@ def _init_weights(self,m):
421364
# Initializing Model Weights
422365
# ----------------------------
423366
#
424-
# ggIn the original VGG paper, the authors trained model A first and then
367+
# In the original VGG paper, the authors trained model A first and then
425368
# used its weights as a starting point for training other variants. However,
426369
# this approach can be time-consuming. The authors also mentioned using Xavier
427370
# initialization as an alternative to initializing with model A's weights,
@@ -702,7 +645,7 @@ def __getitem__(self, index: int) :
702645
# Conclusion
703646
# ----------
704647
#
705-
# In this tutorial, we have successfully demonstrated how to pretrain the VGG model
648+
# In this tutorial, we have successfully demonstrated how to pre-train the VGG model
706649
# from scratch. The techniques and insights provided in this tutorial can serve as
707650
# a basis for reproducing and adapting other foundational models.
708651
#

0 commit comments

Comments
 (0)