Spaces:
Build error
Build error
Upload 2 files
Browse files
ultralytics_solutions_modified/object_counter.py
CHANGED
|
@@ -50,8 +50,8 @@ class ObjectCounter:
|
|
| 50 |
# Object counting Information
|
| 51 |
self.in_counts = 0
|
| 52 |
self.out_counts = 0
|
| 53 |
-
self.out_counts_prev = self.out_counts
|
| 54 |
-
self.in_counts_prev = self.in_counts
|
| 55 |
self.counting_list = []
|
| 56 |
self.count_txt_thickness = 0
|
| 57 |
self.count_txt_color = (0, 0, 0)
|
|
@@ -264,7 +264,6 @@ class ObjectCounter:
|
|
| 264 |
if np.sign(
|
| 265 |
np.dot(obj_track_vec, self.counting_region_nvec)
|
| 266 |
) < 0:
|
| 267 |
-
# if (box[0] - prev_position[0]) * (self.counting_region.centroid.x - prev_position[0]) > 0:
|
| 268 |
self.out_counts += 1
|
| 269 |
else:
|
| 270 |
self.in_counts += 1
|
|
@@ -285,7 +284,6 @@ class ObjectCounter:
|
|
| 285 |
if np.sign(
|
| 286 |
np.dot(obj_track_vec, self.counting_region_nvec)
|
| 287 |
) < 0:
|
| 288 |
-
# if (box[0] - prev_position[0]) * (self.counting_region.centroid.x - prev_position[0]) > 0:
|
| 289 |
self.out_counts += 1
|
| 290 |
else:
|
| 291 |
self.in_counts += 1
|
|
|
|
| 50 |
# Object counting Information
|
| 51 |
self.in_counts = 0
|
| 52 |
self.out_counts = 0
|
| 53 |
+
self.out_counts_prev = self.out_counts
|
| 54 |
+
self.in_counts_prev = self.in_counts
|
| 55 |
self.counting_list = []
|
| 56 |
self.count_txt_thickness = 0
|
| 57 |
self.count_txt_color = (0, 0, 0)
|
|
|
|
| 264 |
if np.sign(
|
| 265 |
np.dot(obj_track_vec, self.counting_region_nvec)
|
| 266 |
) < 0:
|
|
|
|
| 267 |
self.out_counts += 1
|
| 268 |
else:
|
| 269 |
self.in_counts += 1
|
|
|
|
| 284 |
if np.sign(
|
| 285 |
np.dot(obj_track_vec, self.counting_region_nvec)
|
| 286 |
) < 0:
|
|
|
|
| 287 |
self.out_counts += 1
|
| 288 |
else:
|
| 289 |
self.in_counts += 1
|
ultralytics_solutions_modified/speed_estimation.py
CHANGED
|
@@ -139,7 +139,7 @@ class SpeedEstimator:
|
|
| 139 |
self.annotator.box_label(box, box_label, bbox_color)
|
| 140 |
cv2.polylines(
|
| 141 |
self.im0, [self.trk_pts],
|
| 142 |
-
isClosed=False, color=(0, 255, 0), thickness=
|
| 143 |
)
|
| 144 |
cv2.circle(
|
| 145 |
self.im0, (int(track[-1][0]), int(track[-1][1])), 5,
|
|
|
|
| 139 |
self.annotator.box_label(box, box_label, bbox_color)
|
| 140 |
cv2.polylines(
|
| 141 |
self.im0, [self.trk_pts],
|
| 142 |
+
isClosed=False, color=(0, 255, 0), thickness=self.line_thickness
|
| 143 |
)
|
| 144 |
cv2.circle(
|
| 145 |
self.im0, (int(track[-1][0]), int(track[-1][1])), 5,
|