Kalbe-x-Bangkit
commited on
Commit
•
34af5f7
1
Parent(s):
4b464a7
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,7 @@ def load_model_detection():
|
|
56 |
|
57 |
def preprocess_image(image):
|
58 |
""" Preprocess the image to the required size and normalization. """
|
59 |
-
image = cv2.resize(image, (W_detection, H_detection))
|
60 |
image = (image - 127.5) / 127.5 # Normalize to [-1, +1]
|
61 |
image = np.expand_dims(image, axis=0).astype(np.float32)
|
62 |
return image
|
@@ -102,7 +102,7 @@ def load_gradcam_model():
|
|
102 |
x = GlobalAveragePooling2D()(x)
|
103 |
|
104 |
# and a logistic layer
|
105 |
-
predictions = Dense(
|
106 |
|
107 |
model = Model(inputs=base_model.input, outputs=predictions)
|
108 |
model.compile(optimizer='adam', loss="categorical_crossentropy")
|
|
|
56 |
|
57 |
def preprocess_image(image):
|
58 |
""" Preprocess the image to the required size and normalization. """
|
59 |
+
# image = cv2.resize(image, (W_detection, H_detection))
|
60 |
image = (image - 127.5) / 127.5 # Normalize to [-1, +1]
|
61 |
image = np.expand_dims(image, axis=0).astype(np.float32)
|
62 |
return image
|
|
|
102 |
x = GlobalAveragePooling2D()(x)
|
103 |
|
104 |
# and a logistic layer
|
105 |
+
predictions = Dense(14, activation="sigmoid")(x)
|
106 |
|
107 |
model = Model(inputs=base_model.input, outputs=predictions)
|
108 |
model.compile(optimizer='adam', loss="categorical_crossentropy")
|