Skip to content

Commit 2c891c9

Browse files
committed
modify : VGG tutorial
pyspell check,add albumentations installation code
1 parent 95b16d4 commit 2c891c9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

beginner_source/Pretraining_Vgg_from_scratch.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121
2222
pip install albumentations
2323
"""
24+
import subprocess
25+
import sys
2426

25-
27+
try:
28+
import albumentations
29+
print("albumentations are already installed")
30+
except ImportError:
31+
print("albumentations module not found. Installing...")
32+
subprocess.check_call([sys.executable, "-m", "pip", "install", "albumentations"])
33+
print("albumentations module installed successfully.")
2634

2735

2836

@@ -77,7 +85,7 @@
7785
######################################################################
7886
# VGG became a model that attracted attention because it succeeded in
7987
# building deeper layers and dramatically shortening the training time
80-
# compared to alexnet, which was the SOTA model at the time.:
88+
# compared to ``alexnet``, which was the SOTA model at the time.:
8189
#
8290

8391

@@ -97,7 +105,7 @@
97105
## model configuration
98106

99107
num_classes = 100
100-
# Caltech 257 CIFAR 100 CIFAR10 10 ,MNIST 10 ImageNet 1000
108+
# ``Caltech`` 257 CIFAR 100 CIFAR10 10 ,MNIST 10 ImageNet 1000
101109
model_version = None ## you must configure it.
102110

103111
## data configuration
@@ -120,7 +128,7 @@
120128

121129
update_count = int(256/batch_size)
122130
accum_step = int(256/batch_size)
123-
eval_step =26 * accum_step ## Caltech 5 CIFAR 5 MNIST 6 , CIFAR10 5 ImageNet 26
131+
eval_step =26 * accum_step ## ``Caltech`` 5 CIFAR 5 MNIST 6 , CIFAR10 5 ImageNet 26
124132

125133

126134
## model configuration
@@ -149,7 +157,7 @@
149157

150158
######################################################################
151159
# We use ``CIFAR100`` Dataset in this tutorial. In VGG paper , the authors
152-
# scales image isotropically . Then , they apply
160+
# scales image ``isotropically`` . Then , they apply
153161
# ``Normalization``,``RandomCrop``,``HorizontalFlip`` . So , we need to override
154162
# CIFAR100 class to apply preprocessing.
155163
#
@@ -637,7 +645,7 @@ def __getitem__(self, index: int) :
637645
)
638646

639647
######################################################################
640-
# Conculsion
648+
# Conclusion
641649
# ----------
642650
# We have seen how ``pretraining`` VGG from scratch . This Tutorial will be helpful to reproduce another Foundation Model .
643651

0 commit comments

Comments
 (0)