Model enhancements 2 (#109)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Ayush Chaurasia 2022-12-28 21:01:51 +05:30 committed by GitHub
parent 8406b49b49
commit 0303ced8ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 19 deletions

View file

@ -46,7 +46,9 @@ class BasePredictor:
def __init__(self, config=DEFAULT_CONFIG, overrides={}):
self.args = get_config(config, overrides)
self.save_dir = increment_path(Path(self.args.project) / self.args.name, exist_ok=self.args.exist_ok)
project = overrides.get("project") or self.args.task
name = overrides.get("name") or self.args.mode
self.save_dir = increment_path(Path("runs") / project / name, exist_ok=self.args.exist_ok)
(self.save_dir / 'labels' if self.args.save_txt else self.save_dir).mkdir(parents=True, exist_ok=True)
self.done_setup = False
@ -84,18 +86,6 @@ class BasePredictor:
if is_url and is_file:
source = check_file(source) # download
# data
if self.data:
try:
if self.data.endswith(".yaml"):
self.data = check_dataset_yaml(self.data)
else:
self.data = check_dataset(self.data)
except AssertionError as e:
LOGGER.info(f"Error ocurred: {e}")
finally:
LOGGER.info("Predictor will continue without reading the dataset")
# model
device = select_device(self.args.device)
model = model or self.args.model