Fix CLI detect and segment resume (#134)

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
2023-01-03 00:31:17 +05:30
committed by GitHub
parent c5c86a3acd
commit 6d5123297e
2 changed files with 15 additions and 7 deletions

View File

@ -17,9 +17,12 @@ from ultralytics.yolo.utils.torch_utils import de_parallel
class SegmentationTrainer(v8.detect.DetectionTrainer):
def load_model(self, model_cfg=None, weights=None, verbose=True):
model = SegmentationModel(model_cfg or weights.yaml, ch=3, nc=self.data["nc"], verbose=verbose)
model = SegmentationModel(model_cfg or getattr(weights, 'yaml', None) or weights['model'].yaml,
ch=3,
nc=self.data["nc"],
verbose=verbose)
if weights:
model.load(weights, verbose)
model.load(weights['model'] if isinstance(weights, dict) else weights, verbose)
return model
def get_validator(self):