Skip to content

Commit

Permalink
Detection training zero-mAP fix (ultralytics#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jan 10, 2023
1 parent a8a7039 commit 0a7d86c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ultralytics/yolo/engine/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __call__(self, model=None):

# Input
im = torch.zeros(self.args.batch, 3, *self.imgsz).to(self.device)
file = Path(getattr(model, 'pt_path', None) or model.yaml['yaml_file'])
file = Path(getattr(model, 'pt_path', None) or getattr(model, 'yaml_file', None) or model.yaml['yaml_file'])
if file.suffix == '.yaml':
file = Path(file.name)

Expand Down
1 change: 1 addition & 0 deletions ultralytics/yolo/engine/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@ def _reset_ckpt_args(args):
args.pop("batch", None)
args.pop("epochs", None)
args.pop("cache", None)
args.pop("save_json", None)
2 changes: 1 addition & 1 deletion ultralytics/yolo/v8/detect/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def set_model_attributes(self):
def get_model(self, cfg=None, weights=None, verbose=True):
model = DetectionModel(cfg, ch=3, nc=self.data["nc"], verbose=verbose)
if weights:
model.load(model)
model.load(weights)

return model

Expand Down

0 comments on commit 0a7d86c

Please sign in to comment.