Skip to content
Snippets Groups Projects
Commit 32eeda76 authored by Nattapon Jaroenchai's avatar Nattapon Jaroenchai
Browse files

Update inference.py

parent cb4d8336
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ def save_plot_as_png(prediction_result, map_name, legend, outputPath):
legend_patch = h5_image.get_legend(map_name, legend)
# Resize the legend to the specified dimensions
legend_resized = tf.image.resize(legend_patch, (256,256))
legend_resized = cv2.resize(legend_patch, (256,256))
# Convert the legend to uint8 range [0, 255] if its dtype is float32
if legend_resized.dtype == tf.float32:
......@@ -162,10 +162,10 @@ def perform_inference(legend_patch, map_patch, model):
"""
global h5_image
legend_resized = tf.image.resize(legend_patch, (h5_image.patch_size, h5_image.patch_size))
legend_resized = cv2.resize(legend_patch, (h5_image.patch_size, h5_image.patch_size))
legend_resized = tf.cast(legend_resized, dtype=tf.float32) / 255.0
map_patch_resize = tf.image.resize(map_patch, (h5_image.patch_size, h5_image.patch_size))
map_patch_resize = cv2.resize(map_patch, (h5_image.patch_size, h5_image.patch_size))
map_patch_resize = tf.cast(map_patch_resize, dtype=tf.float32) / 255.0
# Concatenate along the third axis and normalize
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment