Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def predict_2(image):
|
|
45 |
|
46 |
image = Image.fromarray(image).resize((size,size))
|
47 |
image = np.array(image)
|
48 |
-
stride =
|
49 |
steps = int(pach_size/stride)
|
50 |
patches_img = patchify(image, (pach_size, pach_size, 3), step=steps) #Step=256 for 256 patches means no overlap
|
51 |
patches_img = patches_img[:,:,0,:,:,:]
|
@@ -77,7 +77,7 @@ def predict_2(image):
|
|
77 |
|
78 |
unpatched_prediction = unpatchify(patched_prediction, (image.shape[0], image.shape[1]))
|
79 |
labels = LABEL_NAMES
|
80 |
-
res =
|
81 |
out = dict(list(zip(labels, res)))
|
82 |
unpatched_prediction = targets_classes_colors[unpatched_prediction]
|
83 |
|
|
|
45 |
|
46 |
image = Image.fromarray(image).resize((size,size))
|
47 |
image = np.array(image)
|
48 |
+
stride = 1
|
49 |
steps = int(pach_size/stride)
|
50 |
patches_img = patchify(image, (pach_size, pach_size, 3), step=steps) #Step=256 for 256 patches means no overlap
|
51 |
patches_img = patches_img[:,:,0,:,:,:]
|
|
|
77 |
|
78 |
unpatched_prediction = unpatchify(patched_prediction, (image.shape[0], image.shape[1]))
|
79 |
labels = LABEL_NAMES
|
80 |
+
res = np.bincount(unpatched_prediction.reshape(-1))/unpatched_prediction.reshape(-1).shape[0]
|
81 |
out = dict(list(zip(labels, res)))
|
82 |
unpatched_prediction = targets_classes_colors[unpatched_prediction]
|
83 |
|