|
|
@ -65,14 +65,13 @@ class BasePredictor:
|
|
|
|
Attributes:
|
|
|
|
Attributes:
|
|
|
|
args (SimpleNamespace): Configuration for the predictor.
|
|
|
|
args (SimpleNamespace): Configuration for the predictor.
|
|
|
|
save_dir (Path): Directory to save results.
|
|
|
|
save_dir (Path): Directory to save results.
|
|
|
|
done_setup (bool): Whether the predictor has finished setup.
|
|
|
|
done_warmup (bool): Whether the predictor has finished setup.
|
|
|
|
model (nn.Module): Model used for prediction.
|
|
|
|
model (nn.Module): Model used for prediction.
|
|
|
|
data (dict): Data configuration.
|
|
|
|
data (dict): Data configuration.
|
|
|
|
device (torch.device): Device used for prediction.
|
|
|
|
device (torch.device): Device used for prediction.
|
|
|
|
dataset (Dataset): Dataset used for prediction.
|
|
|
|
dataset (Dataset): Dataset used for prediction.
|
|
|
|
vid_path (str): Path to video file.
|
|
|
|
vid_path (str): Path to video file.
|
|
|
|
vid_writer (cv2.VideoWriter): Video writer for saving video output.
|
|
|
|
vid_writer (cv2.VideoWriter): Video writer for saving video output.
|
|
|
|
annotator (Annotator): Annotator used for prediction.
|
|
|
|
|
|
|
|
data_path (str): Path to data.
|
|
|
|
data_path (str): Path to data.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
@ -85,9 +84,7 @@ class BasePredictor:
|
|
|
|
overrides (dict, optional): Configuration overrides. Defaults to None.
|
|
|
|
overrides (dict, optional): Configuration overrides. Defaults to None.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.args = get_cfg(cfg, overrides)
|
|
|
|
self.args = get_cfg(cfg, overrides)
|
|
|
|
project = self.args.project or Path(SETTINGS['runs_dir']) / self.args.task
|
|
|
|
self.save_dir = self.get_save_dir()
|
|
|
|
name = self.args.name or f'{self.args.mode}'
|
|
|
|
|
|
|
|
self.save_dir = increment_path(Path(project) / name, exist_ok=self.args.exist_ok)
|
|
|
|
|
|
|
|
if self.args.conf is None:
|
|
|
|
if self.args.conf is None:
|
|
|
|
self.args.conf = 0.25 # default conf=0.25
|
|
|
|
self.args.conf = 0.25 # default conf=0.25
|
|
|
|
self.done_warmup = False
|
|
|
|
self.done_warmup = False
|
|
|
@ -108,6 +105,11 @@ class BasePredictor:
|
|
|
|
self.callbacks = _callbacks or callbacks.get_default_callbacks()
|
|
|
|
self.callbacks = _callbacks or callbacks.get_default_callbacks()
|
|
|
|
callbacks.add_integration_callbacks(self)
|
|
|
|
callbacks.add_integration_callbacks(self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_save_dir(self):
|
|
|
|
|
|
|
|
project = self.args.project or Path(SETTINGS['runs_dir']) / self.args.task
|
|
|
|
|
|
|
|
name = self.args.name or f'{self.args.mode}'
|
|
|
|
|
|
|
|
return increment_path(Path(project) / name, exist_ok=self.args.exist_ok)
|
|
|
|
|
|
|
|
|
|
|
|
def preprocess(self, im):
|
|
|
|
def preprocess(self, im):
|
|
|
|
"""Prepares input image before inference.
|
|
|
|
"""Prepares input image before inference.
|
|
|
|
|
|
|
|
|
|
|
|