Skip to content

Commit

Permalink
Merge pull request #383 from yuedongli1/bug_fix
Browse files Browse the repository at this point in the history
fix yolox attribute error
  • Loading branch information
CaitinZhao authored Nov 12, 2024
2 parents 26f1b76 + 3b7cca6 commit 31ba755
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ def train(args):

# Scale loss hyps
nl = network.model.model[-1].nl
args.loss.box *= 3 / nl # scale to layers
args.loss.cls *= args.data.nc / 80 * 3 / nl # scale to classes and layers
if args.anchor_base:
if hasattr(args.loss, "box"):
args.loss.box *= 3 / nl # scale to layers
if hasattr(args.loss, "cls"):
args.loss.cls *= args.data.nc / 80 * 3 / nl # scale to classes and layers
if args.anchor_base and hasattr(args.loss, "obj"):
args.loss.obj *= (args.img_size / 640) ** 2 * 3 / nl # scale to image size and layers

# Create Loss
Expand Down

0 comments on commit 31ba755

Please sign in to comment.