-
Notifications
You must be signed in to change notification settings - Fork 1
/
local_fast_trainer.py
58 lines (47 loc) · 1.74 KB
/
local_fast_trainer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""Local Fast Trainer
This is the file for running Calvo Fast Trainer loaclly. Make sure
to have an 'Images' folder with the correct inputs in the same directory.
If not, you can change the values in 'inputs' and 'outputs'.
Simply run `python local_fast_trainer.py` to see the output.
This will call `training_engine_sae.py`.
It should generate 3 files in its current state. A background model,
a Model 0, and a Log File.
If you're running it in a Rodan container, this will be located in code/Rodan/rodan/jobs/Calvo_classifier
If the container is already running, try `docker exec -it [container_name] bash` to run the script without
stopping.
"""
from fast_trainer_lib import CalvoTrainer
def main():
batch_size = 1
patch_height = 32
patch_width = 256
max_number_of_epochs = 1
max_samples_per_class = 100
# Fail if arbitrary layers are not equal before training occurs.
inputs = {
"Image": [{"resource_path": "Images/Halifax_Folio_42v.png"}],
"rgba PNG - Layer 0 (Background)": [
{"resource_path": "Images/042v_BackgroundForNeumes.png"}
],
"rgba PNG - Layer 1": [{"resource_path": "Images/042v_Neumes.png"}],
"rgba PNG - Selected regions": [
{"resource_path": "Images/042v_SelectedRegion.png"}
],
}
outputs = {
"Model 0": [{"resource_path": "Images/model0.hdf5"}],
"Model 1": [{"resource_path": "Images/model1.hdf5"}],
# "Log File": [{"resource_path": "Images/logfile"}],
}
trainer = CalvoTrainer(
batch_size,
patch_height,
patch_width,
max_number_of_epochs,
max_samples_per_class,
inputs,
outputs,
)
trainer.runTrainer()
if __name__ == "__main__":
main()