Skip to content

Commit

Permalink
grad cam retet
Browse files Browse the repository at this point in the history
  • Loading branch information
Atashnezhad committed Sep 6, 2023
1 parent 40d3364 commit 8e3a1d0
Showing 1 changed file with 19 additions and 25 deletions.
44 changes: 19 additions & 25 deletions neural_network_model/transfer_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,11 +1139,11 @@ def predict_image_patch_classes(self, **kwargs):
# transfer_model.plot_classes_number()
# transfer_model.analyze_image_names()
# transfer_model.plot_data_images(num_rows=3, num_cols=3, cmap="jet")
# transfer_model.train_model(
# epochs=1,
# model_save_path=(Path(__file__).parent / ".." / "deep_model").resolve(),
# model_name="tf_model_core_1.h5",
# )
transfer_model.train_model(
epochs=1,
model_save_path=(Path(__file__).parent / ".." / "deep_model").resolve(),
model_name="tf_model_core_1.h5",
)
# transfer_model.plot_metrics_results()
# transfer_model.results()
# one can pass the model address to the predict_test method
Expand All @@ -1153,27 +1153,21 @@ def predict_image_patch_classes(self, **kwargs):
# "MildDemented": "Mild",
# "VeryMildDemented": "Very Mild",
# }
# transfer_model.predict_test(
# model_path=(
# Path(__file__).parent / ".." / "deep_model" / "tf_model_core_1.h5"
# ).resolve(),
# rotation=90,
# y_axis_label_size=12,
# x_axis_label_size=12,
# title_size=14,
# fig_title="Original Confusion Matrix",
# conf_matx_font_size=12,
# # custom_titles=custom_titles,
# cmap="winter",
# normalize="true",
# )
transfer_model.grad_cam_viz(
num_rows=3,
num_cols=2,
model_path=Path(__file__).parent / ".." / "deep_model" / "tf_model_core_1.h5",
test_dataset_address=Path(__file__).parent / ".." / "dataset_core" / "patch_images",
save_path=Path(__file__).parent / ".." / "figures" / "grad_cam.png",
transfer_model.predict_test(
model_path=(
Path(__file__).parent / ".." / "deep_model" / "tf_model_core_1.h5"
).resolve(),
rotation=90,
y_axis_label_size=12,
x_axis_label_size=12,
title_size=14,
fig_title="Original Confusion Matrix",
conf_matx_font_size=12,
# custom_titles=custom_titles,
cmap="winter",
normalize="true",
)
transfer_model.grad_cam_viz(num_rows=3, num_cols=2)

# transfer_model.predict_one_image(
# img_path=str(
Expand Down

0 comments on commit 8e3a1d0

Please sign in to comment.