Update run.py
Browse files
run.py
CHANGED
@@ -8,13 +8,16 @@ from transformers import SegformerImageProcessor, SegformerForSemanticSegmentati
|
|
8 |
|
9 |
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
|
20 |
cnt = 0
|
@@ -35,8 +38,8 @@ model.to(device).eval()
|
|
35 |
# counter = Count()
|
36 |
|
37 |
def segment(im, interval_s=2):
|
38 |
-
global
|
39 |
-
|
40 |
im = cv2.resize(im, (im.shape[1] // 2, im.shape[0] // 2))
|
41 |
imout = im.copy()
|
42 |
|
|
|
8 |
|
9 |
|
10 |
|
11 |
+
class Counter:
|
12 |
+
def __init__(self):
|
13 |
+
self.count = 0
|
14 |
+
|
15 |
+
def increment(self):
|
16 |
+
self.count += 1
|
17 |
+
return self.count
|
18 |
+
|
19 |
+
counter = Counter()
|
20 |
+
|
21 |
|
22 |
|
23 |
cnt = 0
|
|
|
38 |
# counter = Count()
|
39 |
|
40 |
def segment(im, interval_s=2):
|
41 |
+
global counter
|
42 |
+
counter.increment()
|
43 |
im = cv2.resize(im, (im.shape[1] // 2, im.shape[0] // 2))
|
44 |
imout = im.copy()
|
45 |
|