Update app.py
Browse files
app.py
CHANGED
@@ -51,9 +51,10 @@ model.eval() # Set the model to evaluation mode
|
|
51 |
#def preprocess_image(image_path):
|
52 |
def preprocess_image(image):
|
53 |
#img0 = cv2.imread(image_path)
|
|
|
54 |
img0 = letterbox(image, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
|
55 |
img = letterbox(img0, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
|
56 |
-
print("in preprocess:",img.shape)
|
57 |
img = img.transpose(2, 0, 1)[::-1] # Convert BGR to RGB, to 3x416x416
|
58 |
img = np.ascontiguousarray(img)
|
59 |
img = torch.from_numpy(img).to(device)
|
|
|
51 |
#def preprocess_image(image_path):
|
52 |
def preprocess_image(image):
|
53 |
#img0 = cv2.imread(image_path)
|
54 |
+
print("in preprocess-0 image.shape:",image.shape)
|
55 |
img0 = letterbox(image, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
|
56 |
img = letterbox(img0, 640, stride=32, auto=True)[0] # Resize and pad to 640x640
|
57 |
+
print("in preprocess-1 img.shape:",img.shape)
|
58 |
img = img.transpose(2, 0, 1)[::-1] # Convert BGR to RGB, to 3x416x416
|
59 |
img = np.ascontiguousarray(img)
|
60 |
img = torch.from_numpy(img).to(device)
|