Skip to content

Commit 98fa93c

Browse files
authored
Merge pull request #69 from MuffinUser/master
move of model initialisation
2 parents c56de19 + 5a5f127 commit 98fa93c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

code/chapter-2/visualization.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
CLASS_INDEX = None
2121
CLASS_INDEX_PATH = '../imagenet_class_index.json'
2222

23+
model = VGG16(weights='imagenet', include_top=True, input_tensor=None, input_shape=None, pooling=None, classes=1000)
24+
2325
# Note: decode_predictions(preds, top) is originally a keras function.
2426
# We have modified it here so that it returns the index of the class label along with the predictions.
2527
# The results are assimilated based on the assumption that there is only one top 1% prediction.
@@ -113,7 +115,6 @@ def join_images(img1, img2):
113115

114116

115117
def process_image(image_path, output_path):
116-
model = VGG16(weights='imagenet', include_top=True, input_tensor=None, input_shape=None, pooling=None, classes=1000)
117118
explainer = GradCAM()
118119

119120
img = image.load_img(image_path, target_size=(224, 224))

0 commit comments

Comments
 (0)