ultralytics 8.0.24 mosaic, DDP, download fixes (#703)

Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-01-29 18:10:25 +01:00
committed by GitHub
parent 899abe9f82
commit aecd17d455
15 changed files with 120 additions and 98 deletions

View File

@ -7,7 +7,7 @@ from ultralytics.nn.tasks import (ClassificationModel, DetectionModel, Segmentat
guess_model_task)
from ultralytics.yolo.cfg import get_cfg
from ultralytics.yolo.engine.exporter import Exporter
from ultralytics.yolo.utils import DEFAULT_CFG, LOGGER, callbacks, yaml_load
from ultralytics.yolo.utils import DEFAULT_CFG, LOGGER, RANK, callbacks, yaml_load
from ultralytics.yolo.utils.checks import check_yaml
from ultralytics.yolo.utils.torch_utils import smart_inference_mode
@ -205,8 +205,9 @@ class YOLO:
self.model = self.trainer.model
self.trainer.train()
# update model and cfg after training
self.model, _ = attempt_load_one_weight(str(self.trainer.best))
self.overrides = self.model.args
if RANK in {0, -1}:
self.model, _ = attempt_load_one_weight(str(self.trainer.best))
self.overrides = self.model.args
def to(self, device):
"""

View File

@ -135,6 +135,8 @@ class BasePredictor:
def stream_inference(self, source=None, model=None):
self.run_callbacks("on_predict_start")
if self.args.verbose:
LOGGER.info("")
# setup model
if not self.model:

View File

@ -518,7 +518,7 @@ class BaseTrainer:
last = Path(check_file(resume) if isinstance(resume, (str, Path)) else get_latest_run())
args_yaml = last.parent.parent / 'args.yaml' # train options yaml
assert args_yaml.is_file(), \
FileNotFoundError('Resume checkpoint f{last} not found. '
FileNotFoundError(f'Resume checkpoint {last} not found. '
'Please pass a valid checkpoint to resume from, i.e. yolo resume=path/to/last.pt')
args = get_cfg(args_yaml) # replace
args.model, resume = str(last), True # reinstate