Update README.md
Browse files
README.md
CHANGED
@@ -96,13 +96,13 @@ NOTE: This pipline has just the overlook and the basic parameters any additional
|
|
96 |
# Load ResNet50 model
|
97 |
model = ResNet50(weights="imagenet", include_top=False, pooling="avg")
|
98 |
|
|
|
99 |
def extract_features(image_path):
|
100 |
-
from PIL import Image
|
101 |
-
image = Image.open(image_path).convert("RGB")
|
102 |
image = image.resize((224, 224))
|
103 |
-
image_array = np.array(image)
|
|
|
104 |
image_array = preprocess_input(image_array)
|
105 |
-
|
106 |
features = model.predict(image_array)
|
107 |
return features.flatten()
|
108 |
```
|
|
|
96 |
# Load ResNet50 model
|
97 |
model = ResNet50(weights="imagenet", include_top=False, pooling="avg")
|
98 |
|
99 |
+
from PIL import Image
|
100 |
def extract_features(image_path):
|
|
|
|
|
101 |
image = image.resize((224, 224))
|
102 |
+
image_array = np.array(image)
|
103 |
+
image_array = np.expand_dims(image_array, axis=0).astype("float32")
|
104 |
image_array = preprocess_input(image_array)
|
105 |
+
|
106 |
features = model.predict(image_array)
|
107 |
return features.flatten()
|
108 |
```
|