ultralytics 8.0.226 Validator Path and Tuner space (#6901)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Muhammad Rizwan Munawar <chr043416@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: DennisJ <106725464+DennisJcy@users.noreply.github.com>
Co-authored-by: Kirill Ionkin <56236621+kirill-ionkin@users.noreply.github.com>
This commit is contained in:
Glenn Jocher 2023-12-10 18:15:59 +01:00 committed by GitHub
parent 6e660dfaaf
commit 412eb57fca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 60 additions and 22 deletions

View file

@ -4,7 +4,7 @@ from collections import defaultdict
import cv2
from ultralytics.utils.checks import check_requirements
from ultralytics.utils.checks import check_imshow, check_requirements
from ultralytics.utils.plotting import Annotator, colors
check_requirements('shapely>=2.0.0')
@ -46,6 +46,9 @@ class ObjectCounter:
self.track_thickness = 2
self.draw_tracks = False
# Check if environment support imshow
self.env_check = check_imshow(warn=True)
def set_args(self,
classes_names,
reg_pts,
@ -136,7 +139,7 @@ class ObjectCounter:
else:
self.in_counts += 1
if self.view_img:
if self.env_check and self.view_img:
incount_label = 'InCount : ' + f'{self.in_counts}'
outcount_label = 'OutCount : ' + f'{self.out_counts}'
self.annotator.count_labels(in_count=incount_label, out_count=outcount_label)