Skip to content

Commit

Permalink
fix args.loss.obj AttributeError
Browse files Browse the repository at this point in the history
  • Loading branch information
yuedongli1 committed Oct 17, 2024
1 parent eeebe04 commit 70520af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ def train(args):
eval_dataset, eval_dataloader = None, None

# Scale loss hyps
args.loss.cls *= args.data.nc / 80
args.loss.obj *= (args.img_size / 640) ** 2
args.loss.cls *= args.data.nc / 80 # scale to classes and layers
if hasattr(args.loss, "obj"):
args.loss.obj *= (args.img_size / 640) ** 2 # scale to image size and layers

# Create Loss
loss_fn = create_loss(
Expand Down

0 comments on commit 70520af

Please sign in to comment.