aje6 commited on
Commit
2ba022b
·
verified ·
1 Parent(s): 4645685

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -249,6 +249,8 @@ def predict(image):
249
  # Resize the image to the model's input shape
250
  image = cv2.resize(image, (input_shape[2], input_shape[3]))
251
 
 
 
252
  # Reshape the image to match the model's input shape
253
  image = image.reshape(3, 640, 640)
254
 
@@ -280,7 +282,7 @@ def predict(image):
280
 
281
  # Reshape the image to match the PIL Image input shape
282
  print("annotated_img shape before reshape:", annotated_img.shape)
283
- annotated_img = annotated_img.reshape(640, 640, 3)
284
  print("annotated_img shape after reshape:", annotated_img.shape)
285
 
286
  # annotated_img = (output[0] / 255.0 - mean)/std
 
249
  # Resize the image to the model's input shape
250
  image = cv2.resize(image, (input_shape[2], input_shape[3]))
251
 
252
+ original_image_shape = image.shape
253
+
254
  # Reshape the image to match the model's input shape
255
  image = image.reshape(3, 640, 640)
256
 
 
282
 
283
  # Reshape the image to match the PIL Image input shape
284
  print("annotated_img shape before reshape:", annotated_img.shape)
285
+ annotated_img = annotated_img.reshape(original_image_shape)
286
  print("annotated_img shape after reshape:", annotated_img.shape)
287
 
288
  # annotated_img = (output[0] / 255.0 - mean)/std