annie08 commited on
Commit
f10eb97
·
1 Parent(s): 30ab3e7

changed layer

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,9 +7,9 @@ from tensorflow.keras.models import Model
7
  from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input
8
  from tensorflow.keras.preprocessing.sequence import pad_sequences
9
 
10
- # Load MobileNetV2 model for feature extraction (using the final layer)
11
- mobilenet_model = MobileNetV2(weights="imagenet")
12
- mobilenet_model = Model(inputs=mobilenet_model.inputs, outputs=mobilenet_model.layers[-1].output)
13
 
14
 
15
  # Load the trained captioning model
 
7
  from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input
8
  from tensorflow.keras.preprocessing.sequence import pad_sequences
9
 
10
+ # Load MobileNetV2 model for feature extraction (with pooling and no top layer)
11
+ mobilenet_model = MobileNetV2(weights="imagenet", include_top=False, pooling='avg')
12
+ mobilenet_model = Model(inputs=mobilenet_model.inputs, outputs=mobilenet_model.output)
13
 
14
 
15
  # Load the trained captioning model