Update main.py
Browse files
main.py
CHANGED
|
@@ -11,30 +11,22 @@ def run_transfer_learning(dataset, epochs, batch_size, imgsz, patience, cache, p
|
|
| 11 |
"--imgsz", str(imgsz),
|
| 12 |
"--patience", str(patience),
|
| 13 |
"--cache", cache,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"--model", model,
|
| 15 |
"--run", run
|
| 16 |
]
|
| 17 |
|
| 18 |
-
# Append boolean flags conditionally
|
| 19 |
-
if pretrained:
|
| 20 |
-
command.append("--pretrained")
|
| 21 |
-
if cos_lr:
|
| 22 |
-
command.append("--cos_lr")
|
| 23 |
-
if profile:
|
| 24 |
-
command.append("--profile")
|
| 25 |
-
if plots:
|
| 26 |
-
command.append("--plots")
|
| 27 |
-
if resume:
|
| 28 |
-
command.append("--resume")
|
| 29 |
-
if augment:
|
| 30 |
-
command.append("--augment")
|
| 31 |
-
|
| 32 |
# Use subprocess to run the script with the arguments
|
| 33 |
subprocess.run(command, check=True)
|
| 34 |
|
| 35 |
if __name__ == "__main__":
|
| 36 |
parser = argparse.ArgumentParser(description="Run transfer learning with YOLO model.")
|
| 37 |
-
|
| 38 |
# Define all arguments with default values from your script
|
| 39 |
parser.add_argument('--dataset', type=str, choices=["Birds-Nest", "Common-VALID", "Electric-Substation", "InsPLAD-det"], help='Dataset name to be used')
|
| 40 |
parser.add_argument("--epochs", type=int, default=1000, help="Number of epochs")
|
|
@@ -56,17 +48,17 @@ if __name__ == "__main__":
|
|
| 56 |
# Call the function to run transfer learning
|
| 57 |
run_transfer_learning(
|
| 58 |
dataset=args.dataset,
|
| 59 |
-
epochs=args.epochs,
|
| 60 |
-
batch_size=args.batch,
|
| 61 |
-
imgsz=args.imgsz,
|
| 62 |
-
patience=args.patience,
|
| 63 |
-
cache=args.cache,
|
| 64 |
-
pretrained=args.pretrained,
|
| 65 |
-
cos_lr=args.cos_lr,
|
| 66 |
-
profile=args.profile,
|
| 67 |
plots=args.plots,
|
| 68 |
resume=args.resume,
|
| 69 |
augment=args.augment,
|
| 70 |
-
model=args.model,
|
| 71 |
run=args.run
|
| 72 |
)
|
|
|
|
| 11 |
"--imgsz", str(imgsz),
|
| 12 |
"--patience", str(patience),
|
| 13 |
"--cache", cache,
|
| 14 |
+
"--pretrained", str(pretrained),
|
| 15 |
+
"--cos_lr", str(cos_lr),
|
| 16 |
+
"--profile", str(profile),
|
| 17 |
+
"--plots", str(plots),
|
| 18 |
+
"--resume", str(resume),
|
| 19 |
+
"--augment", str(augment),
|
| 20 |
"--model", model,
|
| 21 |
"--run", run
|
| 22 |
]
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Use subprocess to run the script with the arguments
|
| 25 |
subprocess.run(command, check=True)
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|
| 28 |
parser = argparse.ArgumentParser(description="Run transfer learning with YOLO model.")
|
| 29 |
+
|
| 30 |
# Define all arguments with default values from your script
|
| 31 |
parser.add_argument('--dataset', type=str, choices=["Birds-Nest", "Common-VALID", "Electric-Substation", "InsPLAD-det"], help='Dataset name to be used')
|
| 32 |
parser.add_argument("--epochs", type=int, default=1000, help="Number of epochs")
|
|
|
|
| 48 |
# Call the function to run transfer learning
|
| 49 |
run_transfer_learning(
|
| 50 |
dataset=args.dataset,
|
| 51 |
+
epochs=args.epochs,
|
| 52 |
+
batch_size=args.batch,
|
| 53 |
+
imgsz=args.imgsz,
|
| 54 |
+
patience=args.patience,
|
| 55 |
+
cache=args.cache,
|
| 56 |
+
pretrained=args.pretrained,
|
| 57 |
+
cos_lr=args.cos_lr,
|
| 58 |
+
profile=args.profile,
|
| 59 |
plots=args.plots,
|
| 60 |
resume=args.resume,
|
| 61 |
augment=args.augment,
|
| 62 |
+
model=args.model,
|
| 63 |
run=args.run
|
| 64 |
)
|