Update app.py
Browse files
app.py
CHANGED
@@ -56,6 +56,7 @@ net.eval()
|
|
56 |
|
57 |
def detect_corn(inp):
|
58 |
inp = cv2.cvtColor(inp, cv2.COLOR_BGR2RGB)
|
|
|
59 |
frame = torch.from_numpy(inp).cpu().float()
|
60 |
batch = FastBaseTransform()(frame.unsqueeze(0))
|
61 |
preds = net(batch)
|
@@ -74,9 +75,10 @@ def detect_corn(inp):
|
|
74 |
color = random.sample(range(0, 255), 3)
|
75 |
color_mask = random.sample(range(0, 255), 3)
|
76 |
cv2.rectangle(inp, (x1, y1), (x2, y2), color, int(inp.shape[0] * 0.01))
|
77 |
-
inp = apply_mask(inp, mask_to_save[:, :, i], [
|
78 |
-
inp = cv2.resize(inp, (inp.shape[1] //
|
79 |
inp = cv2.cvtColor(inp, cv2.COLOR_BGR2RGB)
|
|
|
80 |
return inp / 255.
|
81 |
|
82 |
|
|
|
56 |
|
57 |
def detect_corn(inp):
|
58 |
inp = cv2.cvtColor(inp, cv2.COLOR_BGR2RGB)
|
59 |
+
print(inp.shape)
|
60 |
frame = torch.from_numpy(inp).cpu().float()
|
61 |
batch = FastBaseTransform()(frame.unsqueeze(0))
|
62 |
preds = net(batch)
|
|
|
75 |
color = random.sample(range(0, 255), 3)
|
76 |
color_mask = random.sample(range(0, 255), 3)
|
77 |
cv2.rectangle(inp, (x1, y1), (x2, y2), color, int(inp.shape[0] * 0.01))
|
78 |
+
inp = apply_mask(inp, mask_to_save[:, :, i], [0, 0, 255], 0.5)
|
79 |
+
inp = cv2.resize(inp, (inp.shape[1] // 4, inp.shape[0] // 4))
|
80 |
inp = cv2.cvtColor(inp, cv2.COLOR_BGR2RGB)
|
81 |
+
print(inp.shape)
|
82 |
return inp / 255.
|
83 |
|
84 |
|