From fa5c8f27646dac217777744932ae3b0281b4f73d Mon Sep 17 00:00:00 2001 From: Ketil Malde Date: Thu, 27 Jul 2023 19:42:37 +0200 Subject: [PATCH] Fix counter overflow for video frame crop names, set default separator for same-frame detection counter (#3982) Co-authored-by: Glenn Jocher --- ultralytics/engine/predictor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ultralytics/engine/predictor.py b/ultralytics/engine/predictor.py index 142fe63..d6b8f69 100644 --- a/ultralytics/engine/predictor.py +++ b/ultralytics/engine/predictor.py @@ -105,6 +105,7 @@ class BasePredictor: self.results = None self.transforms = None self.callbacks = _callbacks or callbacks.get_default_callbacks() + self.txt_path = None callbacks.add_integration_callbacks(self) def get_save_dir(self): @@ -178,7 +179,8 @@ class BasePredictor: if self.args.save_txt: result.save_txt(f'{self.txt_path}.txt', save_conf=self.args.save_conf) if self.args.save_crop: - result.save_crop(save_dir=self.save_dir / 'crops', file_name=self.data_path.stem) + result.save_crop(save_dir=self.save_dir / 'crops', + file_name=self.data_path.stem + ('' if self.dataset.mode == 'image' else f'_{frame}')) return log_string