Skip to content

Commit

Permalink
Merge pull request #45 from naseemap47/resume
Browse files Browse the repository at this point in the history
Resume
  • Loading branch information
naseemap47 authored Sep 22, 2023
2 parents 95c8fda + 357921c commit 0e8a725
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ You can train your **YOLO-NAS** model with **Single Command Line**
`-w`, `--weight`: path to pre-trained model weight (default: `coco` weight) <br>
`--gpus`: Train on multiple gpus <br>
`--cpu`: Train on CPU <br>
`--resume`: To resume model training <br>

**Other Training Parameters:**<br>
`--warmup_mode`: Warmup Mode, eg: Linear Epoch Step <br>
Expand Down
20 changes: 15 additions & 5 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
help="Model type (eg: yolo_nas_s)")
ap.add_argument("-w", "--weight", type=str, default='coco',
help="path to pre-trained model weight")
ap.add_argument("-r", "--resume", action='store_true',
help="to resume model training")
ap.add_argument("-s", "--size", type=int, default=640,
help="input image size")
ap.add_argument("--gpus", action='store_true',
Expand Down Expand Up @@ -128,11 +130,19 @@
}
)

model = models.get(
args['model'],
num_classes=len(yaml_params['names']),
pretrained_weights=args["weight"]
)
# To Resume Training
if args['resume']:
model = models.get(
args['model'],
num_classes=len(yaml_params['names']),
checkpoint_path=args["weight"]
)
else:
model = models.get(
args['model'],
num_classes=len(yaml_params['names']),
pretrained_weights=args["weight"]
)

train_params = {
# ENABLING SILENT MODE
Expand Down

0 comments on commit 0e8a725

Please sign in to comment.