Skip to content

Commit 1a83a96

Browse files
authored
Merge pull request #1 from slothkong/master
Fixed argument that broke due to Keras update and improved zero mean subtract module
2 parents 51455e7 + 790cc78 commit 1a83a96

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

transfer_learning_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from vgg16 import VGG16
33
from resnet50 import ResNet50
44
from keras.preprocessing import image
5-
from imagenet_utils import preprocess_input, decode_predictions
5+
from keras.applications.imagenet_utils import preprocess_input
6+
from imagenet_utils import decode_predictions
67

78
model = VGG16(include_top=True, weights='imagenet')
89

transfer_learning_vgg16_custom_data.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import time
55
from vgg16 import VGG16
66
from keras.preprocessing import image
7-
from imagenet_utils import preprocess_input, decode_predictions
7+
from keras.applications.imagenet_utils import preprocess_input
8+
from imagenet_utils import decode_predictions
89
from keras.layers import Dense, Activation, Flatten
910
from keras.layers import merge, Input
1011
from keras.models import Model
@@ -33,7 +34,7 @@
3334
img_list=os.listdir(data_path+'/'+ dataset)
3435
print ('Loaded the images of dataset-'+'{}\n'.format(dataset))
3536
for img in img_list:
36-
img_path = data_path + '/'+ dataset + '/'+ img
37+
img_path = data_path + '/'+ dataset + '/'+ img
3738
img = image.load_img(img_path, target_size=(224, 224))
3839
x = image.img_to_array(img)
3940
x = np.expand_dims(x, axis=0)
@@ -62,7 +63,7 @@
6263
labels[606:]=3
6364

6465
names = ['cats','dogs','horses','humans']
65-
66+
6667
# convert class labels to on-hot encoding
6768
Y = np_utils.to_categorical(labels, num_classes)
6869

vgg16.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def VGG16(include_top=True, weights='imagenet',
9999
default_size=224,
100100
min_size=48,
101101
data_format=K.image_data_format(),
102-
include_top=include_top)
102+
require_flatten=include_top)
103103

104104
if input_tensor is None:
105105
img_input = Input(shape=input_shape)

0 commit comments

Comments
 (0)