Skip to content

Commit

Permalink
class labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Atashnezhad committed Sep 6, 2023
1 parent 21437f8 commit 20ed109
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions neural_network_model/transfer_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ def predict_image_patch_classes(self, **kwargs):
"images_with_box")
fig_show = kwargs.get("fig_show", False)
model_path = kwargs.get("model_path", None)
class_labels_path = kwargs.get("class_labels_path", None)

if img_path is None:
raise ValueError("img_path is None")
Expand Down Expand Up @@ -1081,7 +1082,7 @@ def predict_image_patch_classes(self, **kwargs):
predicted_label, class_probabilities = self.predict_one_image(
img_path=patch_filename,
model_path=model_path,
class_labels_path=str(Path(__file__).parent / "class_labels.json")
class_labels_path=class_labels_path
)

save_results[f'patch_{count}.jpg'] = {
Expand Down Expand Up @@ -1181,8 +1182,9 @@ def predict_image_patch_classes(self, **kwargs):
"patch_images_dir": Path(__file__).parent / ".." / "dataset_core" / "patch_images",
"img_with_box_dir": Path(__file__).parent / ".." / "dataset_core" / "core_images_with_box_red",
"figsize": (15, 3),
"fig_show": False,
"model_path": Path(__file__).parent / ".." / "deep_model" / "tf_model_core_1.h5"
"fig_show": True,
"model_path": Path(__file__).parent / ".." / "deep_model" / "tf_model_core_1.h5",
"class_labels_path": str(Path(__file__).parent / "class_labels.json")
}
save_results = transfer_model.predict_image_patch_classes(**kwargs_dict)
print(save_results)

0 comments on commit 20ed109

Please sign in to comment.