noamholz commited on
Commit
634c7ac
·
verified ·
1 Parent(s): cca8764

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +12 -9
run.py CHANGED
@@ -8,13 +8,16 @@ from transformers import SegformerImageProcessor, SegformerForSemanticSegmentati
8
 
9
 
10
 
11
- # class Count:
12
- # def __init__(self):
13
- # self.n = 0
14
- # self.imout = np.zeros((1000, 1000))
15
-
16
- # def step(self):
17
- # self.n += 1
 
 
 
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 cnt
39
- cnt += 1
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