Spaces:
Sleeping
Sleeping
hoping no errors
Browse files
app.py
CHANGED
|
@@ -96,7 +96,10 @@ logreg_multimode_model = load_pickle_file('multiLog2_hog.pkl')
|
|
| 96 |
def preprocess_image(image, model_choice, mode_choice):
|
| 97 |
image = np.array(image)
|
| 98 |
|
|
|
|
|
|
|
| 99 |
image = image / 255.0
|
|
|
|
| 100 |
image_hog = hog(
|
| 101 |
image,
|
| 102 |
**hog_params
|
|
@@ -107,11 +110,6 @@ def preprocess_image(image, model_choice, mode_choice):
|
|
| 107 |
image_hog = image_hog.reshape(1, -1)
|
| 108 |
image_pca = pca.transform(image_hog)
|
| 109 |
return image_pca
|
| 110 |
-
elif model_choice == "SVM":
|
| 111 |
-
image_r = image.reshape(1,-1)
|
| 112 |
-
scaled_img = svm_scaler.transform(image_r)
|
| 113 |
-
svm_img_hog = hog(scaled_img, **hog_params)
|
| 114 |
-
return svm_img_hog
|
| 115 |
else:
|
| 116 |
image_hog = image_hog.reshape(1, -1)
|
| 117 |
return image_hog
|
|
|
|
| 96 |
def preprocess_image(image, model_choice, mode_choice):
|
| 97 |
image = np.array(image)
|
| 98 |
|
| 99 |
+
#image = cv2.resize(image, (28, 28))
|
| 100 |
+
|
| 101 |
image = image / 255.0
|
| 102 |
+
|
| 103 |
image_hog = hog(
|
| 104 |
image,
|
| 105 |
**hog_params
|
|
|
|
| 110 |
image_hog = image_hog.reshape(1, -1)
|
| 111 |
image_pca = pca.transform(image_hog)
|
| 112 |
return image_pca
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
else:
|
| 114 |
image_hog = image_hog.reshape(1, -1)
|
| 115 |
return image_hog
|