Created
July 25, 2019 15:03
-
-
Save previtus/e7a4b709149bdf09d9f066e10174d162 to your computer and use it in GitHub Desktop.
Dataset handling in Change Detection Projects (arc gis tile exports and saved predictions)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filename = "vector_strip2_256x256_over32/vector_strip2_8790.TIF" | |
file1 = "Fold_0/"+filename | |
file2 = "Gts/"+filename | |
from skimage import io | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# The prediction | |
img = io.imread(file1) | |
arr = np.asarray(img) | |
tmp = arr.flatten() | |
print("Prediction image range:", np.min(tmp), "-", np.max(tmp)) | |
plt.imshow(arr) | |
plt.show() | |
# The ground truth - ps: the direct exports from ArcGis have different values, hence the conversion afterwards | |
img = io.imread(file2) | |
arr = np.asarray(img) | |
arr[arr <= 0] = 0 | |
arr[arr == 65535] = 0 # hi ArcGis ghosts | |
arr[arr != 0] = 1 | |
tmp = arr.flatten() | |
print("GT image range:", np.min(tmp), "-", np.max(tmp)) | |
plt.imshow(arr) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment