Skip to content

Commit

Permalink
fix loss hyps
Browse files Browse the repository at this point in the history
  • Loading branch information
yuedongli1 committed Oct 17, 2024
1 parent 13c0f0d commit 834489e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,9 @@ def train(args):
eval_dataset, eval_dataloader = None, None

# Scale loss hyps
nl = len(args.network.anchors)
args.loss.box *= 3 / nl # scale to layers
args.loss.cls *= args.data.nc / 80 * 3 / nl # scale to classes and layers
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 * 3 / nl # scale to image size and layers
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 834489e

Please sign in to comment.