Upload app.py
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ def preprocess_image(image: Image.Image, target_size=(448, 448)):
|
|
96 |
img_array = np.array(image_resized, dtype=np.float32) / 255.0
|
97 |
img_array = img_array.transpose(2, 0, 1) # HWC -> CHW
|
98 |
# Assuming model expects RGB based on original code, no BGR conversion here
|
99 |
-
|
100 |
mean = np.array([0.5, 0.5, 0.5], dtype=np.float32).reshape(3, 1, 1)
|
101 |
std = np.array([0.5, 0.5, 0.5], dtype=np.float32).reshape(3, 1, 1)
|
102 |
img_array = (img_array - mean) / std
|
|
|
96 |
img_array = np.array(image_resized, dtype=np.float32) / 255.0
|
97 |
img_array = img_array.transpose(2, 0, 1) # HWC -> CHW
|
98 |
# Assuming model expects RGB based on original code, no BGR conversion here
|
99 |
+
img_array = img_array[::-1, :, :] # BGR conversion if needed - UNCOMMENTED based on user feedback
|
100 |
mean = np.array([0.5, 0.5, 0.5], dtype=np.float32).reshape(3, 1, 1)
|
101 |
std = np.array([0.5, 0.5, 0.5], dtype=np.float32).reshape(3, 1, 1)
|
102 |
img_array = (img_array - mean) / std
|