Kalbe-x-Bangkit
commited on
Commit
•
25f93ce
1
Parent(s):
34af5f7
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ from tensorflow import image
|
|
18 |
from tensorflow.python.keras.models import load_model
|
19 |
from keras.applications.densenet import DenseNet121
|
20 |
from keras.layers import Dense, GlobalAveragePooling2D
|
|
|
21 |
from pydicom.pixel_data_handlers.util import apply_voi_lut
|
22 |
|
23 |
# Environment Configuration
|
@@ -57,9 +58,9 @@ def load_model_detection():
|
|
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
|
63 |
|
64 |
def predict(model_detection, image):
|
65 |
""" Predict bounding box and label for the input image. """
|
|
|
18 |
from tensorflow.python.keras.models import load_model
|
19 |
from keras.applications.densenet import DenseNet121
|
20 |
from keras.layers import Dense, GlobalAveragePooling2D
|
21 |
+
from keras.models import Model
|
22 |
from pydicom.pixel_data_handlers.util import apply_voi_lut
|
23 |
|
24 |
# Environment Configuration
|
|
|
58 |
def preprocess_image(image):
|
59 |
""" Preprocess the image to the required size and normalization. """
|
60 |
# image = cv2.resize(image, (W_detection, H_detection))
|
61 |
+
# image = (image - 127.5) / 127.5 # Normalize to [-1, +1]
|
62 |
+
# image = np.expand_dims(image, axis=0).astype(np.float32)
|
63 |
+
# return image
|
64 |
|
65 |
def predict(model_detection, image):
|
66 |
""" Predict bounding box and label for the input image. """
|