(path_config_file, shuffle, trainingsetindex=0, initweights="imagenet", lastvalue=10)
| 35 | |
| 36 | |
| 37 | def Cuttrainingschedule(path_config_file, shuffle, trainingsetindex=0, initweights="imagenet", lastvalue=10): |
| 38 | cfg = deeplabcut.auxiliaryfunctions.read_config(path_config_file) |
| 39 | posefile = os.path.join( |
| 40 | cfg["project_path"], |
| 41 | "dlc-models/iteration-" |
| 42 | + str(cfg["iteration"]) |
| 43 | + "/" |
| 44 | + cfg["Task"] |
| 45 | + cfg["date"] |
| 46 | + "-trainset" |
| 47 | + str(int(cfg["TrainingFraction"][trainingsetindex] * 100)) |
| 48 | + "shuffle" |
| 49 | + str(shuffle), |
| 50 | "train/pose_cfg.yaml", |
| 51 | ) |
| 52 | |
| 53 | edits = { |
| 54 | "save_iters": lastvalue, |
| 55 | "display_iters": 1, |
| 56 | "multi_step": [[0.001, lastvalue]], |
| 57 | "intermediate_supervision": False, |
| 58 | } |
| 59 | |
| 60 | if initweights == "previteration": |
| 61 | edits["init_weights"] = os.path.join( |
| 62 | cfg["project_path"], |
| 63 | "dlc-models/iteration-" |
| 64 | + str(cfg["iteration"] - 1) |
| 65 | + "/" |
| 66 | + cfg["Task"] |
| 67 | + cfg["date"] |
| 68 | + "-trainset" |
| 69 | + str(int(cfg["TrainingFraction"][trainingsetindex] * 100)) |
| 70 | + "shuffle" |
| 71 | + str(shuffle), |
| 72 | "train/snapshot-" + str(lastvalue), |
| 73 | ) |
| 74 | |
| 75 | print("CHANGING training parameters to end quickly!") |
| 76 | deeplabcut.auxiliaryfunctions.edit_config(posefile, edits) |
| 77 | return |
| 78 | |
| 79 | |
| 80 | if __name__ == "__main__": |
no test coverage detected