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

Update inference.py

Add normalization to inference function
Add visualization function
parent 211a5fd8
No related branches found
No related tags found
1 merge request!1updated main for release
......@@ -109,6 +109,7 @@ def prediction_mask(prediction_result, map_name, legend, outputPath):
# Perform the bitwise operation with the mask also converted to uint8
masked_img = cv2.bitwise_and(prediction_result_int, mask)
return masked_img
def perform_inference(legend_patch, map_patch, model):
......@@ -126,10 +127,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 = tf.cast(tf.io.decode_png(legend_resized), dtype=tf.float32) / 255.0
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 = tf.cast(tf.io.decode_png(map_patch_resize), dtype=tf.float32) / 255.0
map_patch_resize = tf.cast(map_patch_resize, dtype=tf.float32) / 255.0
print("map_patch", map_patch.shape, "legend_patch", legend_resized.shape)
......
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