Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume #45

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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