removed mean and std calculation due to poor prediction
Browse files
app.py
CHANGED
|
@@ -26,19 +26,12 @@ def inference(input_img, transparency = 0.5, target_layer_number = -1, num_top_c
|
|
| 26 |
top: Top Classes and Confidence level of the prediction
|
| 27 |
visualization: Grad Cam output
|
| 28 |
"""
|
| 29 |
-
|
| 30 |
-
org_img = input_img
|
| 31 |
-
# Convert the image to a numerical array
|
| 32 |
-
image_array = np.array(input_img, dtype=np.float32)
|
| 33 |
-
|
| 34 |
-
# Calculate the mean and standard deviation
|
| 35 |
-
mean_value = np.mean(image_array)
|
| 36 |
-
std_value = np.std(image_array)
|
| 37 |
# transform = transforms.ToTensor()
|
| 38 |
transform = transforms.Compose([
|
| 39 |
transforms.ToTensor(),
|
| 40 |
-
transforms.Normalize((
|
| 41 |
])
|
|
|
|
| 42 |
input_img = transform(input_img)
|
| 43 |
# input_img = input_img
|
| 44 |
input_img = input_img.unsqueeze(0)
|
|
|
|
| 26 |
top: Top Classes and Confidence level of the prediction
|
| 27 |
visualization: Grad Cam output
|
| 28 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# transform = transforms.ToTensor()
|
| 30 |
transform = transforms.Compose([
|
| 31 |
transforms.ToTensor(),
|
| 32 |
+
transforms.Normalize((0.1307,), (0.3081,))
|
| 33 |
])
|
| 34 |
+
org_img = input_img
|
| 35 |
input_img = transform(input_img)
|
| 36 |
# input_img = input_img
|
| 37 |
input_img = input_img.unsqueeze(0)
|