Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -244,15 +244,18 @@ def predict(image):
|
|
244 |
input_name = model.get_inputs()[0].name
|
245 |
input_shape = model.get_inputs()[0].shape
|
246 |
|
247 |
-
print(input_shape)
|
248 |
|
249 |
# Resize the image to the model's input shape
|
250 |
-
# image = cv2.resize(image, (640, 640))
|
251 |
image = cv2.resize(image, (input_shape[2], input_shape[3]))
|
|
|
|
|
252 |
|
253 |
# Convert the image to a numpy array and add a batch dimension
|
254 |
image = np.expand_dims(image, axis=0).astype(np.float32)
|
255 |
|
|
|
|
|
256 |
# Perform inference
|
257 |
output = model.run(None, {input_name: image})
|
258 |
print(type(output))
|
|
|
244 |
input_name = model.get_inputs()[0].name
|
245 |
input_shape = model.get_inputs()[0].shape
|
246 |
|
247 |
+
print("after model.get_inputs()[0].shape:", input_shape)
|
248 |
|
249 |
# Resize the image to the model's input shape
|
|
|
250 |
image = cv2.resize(image, (input_shape[2], input_shape[3]))
|
251 |
+
|
252 |
+
print("after cv2.resize:", input_shape)
|
253 |
|
254 |
# Convert the image to a numpy array and add a batch dimension
|
255 |
image = np.expand_dims(image, axis=0).astype(np.float32)
|
256 |
|
257 |
+
print("np.expand_dims:", input_shape)
|
258 |
+
|
259 |
# Perform inference
|
260 |
output = model.run(None, {input_name: image})
|
261 |
print(type(output))
|