Commit
•
8076e35
1
Parent(s):
01aa272
Updated lines 59-82 with: [# notation] | Updated lines 88-94 with: [# notation] | Updated lines 108-110 with: [# notation] | Updated lines 112-117 with: # Output the predictions st.write(f'Class Mappings: {class_mappings}') st.write("\nNormal Image Prediction:", np.round(predictions[0], 3)[0]) st.write("Glioma Image Prediction:", np.round(predictions[1], 3)[0]) st.write("Meningioma Image Prediction:", np.round(predictions[2], 3)[0]) st.write("Pituitary Image Prediction:", np.round(predictions[3], 3)[0])
Browse files
app.py
CHANGED
@@ -56,42 +56,42 @@ image_paths = [
|
|
56 |
'G_1.jpg',
|
57 |
'M_1.jpg',
|
58 |
'P_1.jpg',
|
59 |
-
'N_1_BR_.jpg',
|
60 |
-
'G_1_BR_.jpg',
|
61 |
-
'M_1_BR_.jpg',
|
62 |
-
'P_1_BR_.jpg',
|
63 |
-
|
64 |
-
'G_1_DA_.jpg',
|
65 |
-
'M_1_DA_.jpg',
|
66 |
-
'P_1_DA_.jpg',
|
67 |
-
'N_1_HF_.jpg',
|
68 |
-
'G_1_HF_.jpg',
|
69 |
-
'M_1_HF_.jpg',
|
70 |
-
'P_1_HF_.jpg',
|
71 |
-
'N_1_RO_.jpg',
|
72 |
-
'G_1_RO_.jpg',
|
73 |
-
'M_1_RO_.jpg',
|
74 |
-
'P_1_RO_.jpg',
|
75 |
-
'N_1_SP_.jpg',
|
76 |
-
'G_1_SP_.jpg',
|
77 |
-
'M_1_SP_.jpg',
|
78 |
-
'P_1_SP_.jpg',
|
79 |
-
'N_1_VF_.jpg',
|
80 |
-
'G_1_VF_.jpg',
|
81 |
-
'M_1_VF_.jpg',
|
82 |
-
'P_1_VF_.jpg'
|
83 |
|
84 |
]
|
85 |
|
86 |
# True labels for images
|
87 |
true_labels = [
|
88 |
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # Original tumor types
|
89 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # BR_ (Brightness)
|
90 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # DA_ (Darkness)
|
91 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # HF_ (High Frequency)
|
92 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # RO_ (Rotation)
|
93 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # SP_ (Salt and Pepper)
|
94 |
-
'Notumor', 'Glioma', 'Meningioma', 'Pituitary' # VF_ (Vertical Flip)
|
95 |
]
|
96 |
|
97 |
# Load and preprocess images, then make predictions
|
@@ -105,12 +105,16 @@ predicted_labels = [inv_class_mappings[np.argmax(one_hot)] for one_hot in predic
|
|
105 |
st.markdown("<h1 style='text-align: center; color: navy;'>Brain Tumor One Hot Encode TF Model</h1>", unsafe_allow_html=True)
|
106 |
|
107 |
# Output the predictions
|
108 |
-
st.write(f'Class Mappings: {class_mappings}')
|
109 |
-
for i, (prediction, true_label) in enumerate(zip(predicted_labels, true_labels)):
|
110 |
-
st.write(f"Image {i+1} Prediction: {prediction}, True Label: {true_label}")
|
111 |
-
|
112 |
-
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
|
116 |
# Display images with predictions
|
|
|
56 |
'G_1.jpg',
|
57 |
'M_1.jpg',
|
58 |
'P_1.jpg',
|
59 |
+
#'N_1_BR_.jpg',
|
60 |
+
#'G_1_BR_.jpg',
|
61 |
+
#'M_1_BR_.jpg',
|
62 |
+
#'P_1_BR_.jpg',
|
63 |
+
#'N_1_DA_.jpg',
|
64 |
+
#'G_1_DA_.jpg',
|
65 |
+
#'M_1_DA_.jpg',
|
66 |
+
#'P_1_DA_.jpg',
|
67 |
+
#'N_1_HF_.jpg',
|
68 |
+
#'G_1_HF_.jpg',
|
69 |
+
#'M_1_HF_.jpg',
|
70 |
+
#'P_1_HF_.jpg',
|
71 |
+
#'N_1_RO_.jpg',
|
72 |
+
#'G_1_RO_.jpg',
|
73 |
+
#'M_1_RO_.jpg',
|
74 |
+
#'P_1_RO_.jpg',
|
75 |
+
#'N_1_SP_.jpg',
|
76 |
+
#'G_1_SP_.jpg',
|
77 |
+
#'M_1_SP_.jpg',
|
78 |
+
#'P_1_SP_.jpg',
|
79 |
+
#'N_1_VF_.jpg',
|
80 |
+
#'G_1_VF_.jpg',
|
81 |
+
#'M_1_VF_.jpg',
|
82 |
+
#'P_1_VF_.jpg'
|
83 |
|
84 |
]
|
85 |
|
86 |
# True labels for images
|
87 |
true_labels = [
|
88 |
'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # Original tumor types
|
89 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # BR_ (Brightness)
|
90 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # DA_ (Darkness)
|
91 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # HF_ (High Frequency)
|
92 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # RO_ (Rotation)
|
93 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary', # SP_ (Salt and Pepper)
|
94 |
+
#'Notumor', 'Glioma', 'Meningioma', 'Pituitary' # VF_ (Vertical Flip)
|
95 |
]
|
96 |
|
97 |
# Load and preprocess images, then make predictions
|
|
|
105 |
st.markdown("<h1 style='text-align: center; color: navy;'>Brain Tumor One Hot Encode TF Model</h1>", unsafe_allow_html=True)
|
106 |
|
107 |
# Output the predictions
|
108 |
+
#st.write(f'Class Mappings: {class_mappings}')
|
109 |
+
#for i, (prediction, true_label) in enumerate(zip(predicted_labels, true_labels)):
|
110 |
+
#st.write(f"Image {i+1} Prediction: {prediction}, True Label: {true_label}")
|
|
|
|
|
111 |
|
112 |
+
# Output the predictions
|
113 |
+
st.write(f'Class Mappings: {class_mappings}')
|
114 |
+
st.write("\nNormal Image Prediction:", np.round(predictions[0], 3)[0])
|
115 |
+
st.write("Glioma Image Prediction:", np.round(predictions[1], 3)[0])
|
116 |
+
st.write("Meningioma Image Prediction:", np.round(predictions[2], 3)[0])
|
117 |
+
st.write("Pituitary Image Prediction:", np.round(predictions[3], 3)[0])
|
118 |
|
119 |
|
120 |
# Display images with predictions
|