Raj Bhalerao commited on
Commit
23f66d2
·
1 Parent(s): 9fe06be

release: processing engine, domain url

Browse files
Files changed (2) hide show
  1. backend/engine.py +4 -1
  2. frontend/initial.html +15 -2
backend/engine.py CHANGED
@@ -77,6 +77,9 @@ def run(model, video_path, line, config, on_frame, save_annotated=False, annotat
77
  out_h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
78
  cap.release()
79
 
 
 
 
80
  stride = config["detect_stride"]
81
  total_iters = total // stride
82
 
@@ -143,7 +146,7 @@ def run(model, video_path, line, config, on_frame, save_annotated=False, annotat
143
  if obj_id in prev_side and obj_id not in counted_ids:
144
  if prev_side[obj_id] != current:
145
  dist = _point_to_segment_dist(cx, cy, a[0], a[1], b[0], b[1])
146
- if dist < 12:
147
  t = frame_idx * stride / fps
148
  flow_times.append(round(t, 2))
149
 
 
77
  out_h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
78
  cap.release()
79
 
80
+ # Dynamic crossing threshold: 5% of frame height, min 40px
81
+ cross_dist = max(40, int(out_h * 0.05))
82
+
83
  stride = config["detect_stride"]
84
  total_iters = total // stride
85
 
 
146
  if obj_id in prev_side and obj_id not in counted_ids:
147
  if prev_side[obj_id] != current:
148
  dist = _point_to_segment_dist(cx, cy, a[0], a[1], b[0], b[1])
149
+ if dist < cross_dist:
150
  t = frame_idx * stride / fps
151
  flow_times.append(round(t, 2))
152
 
frontend/initial.html CHANGED
@@ -1,7 +1,20 @@
1
  <!DOCTYPE html>
2
- <html lang="en">
3
 
4
  <head>
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
  <title>UrbanFlow</title>
@@ -347,7 +360,7 @@
347
  line: line,
348
  config: runConfig
349
  }));
350
- window.location.href = 'vehicles.html';
351
  }
352
  </script>
353
  </body>
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
 
4
  <head>
5
+ <!-- SPA Bootstrap: load dashboard without changing URL -->
6
+ <script>
7
+ if (sessionStorage.getItem('funky_run')) {
8
+ document.documentElement.style.display = 'none';
9
+ fetch('/vehicles.html')
10
+ .then(function (r) { return r.text(); })
11
+ .then(function (html) {
12
+ document.open();
13
+ document.write(html);
14
+ document.close();
15
+ });
16
+ }
17
+ </script>
18
  <meta charset="UTF-8">
19
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
20
  <title>UrbanFlow</title>
 
360
  line: line,
361
  config: runConfig
362
  }));
363
+ window.location.href = '/';
364
  }
365
  </script>
366
  </body>