File size: 2,791 Bytes
ec1cb04
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from .tmux_launcher import Options, TmuxLauncher


class Launcher(TmuxLauncher):

    # List of training commands
    def commands(self):
        opt = Options()

        # common options for all training sessions defined in this launcher
        opt.set(dataroot="~/datasets/cityscapes/",  # specify --dataroot option here
                model="contrastive_cycle_gan",
                pool_size=0,
                no_dropout="",
                init_type="xavier",
                batch_size=1,
                display_freq=400,
                evaluation_metrics="fid,cityscapes",
                evaluation_freq=10000,
                direction="BtoA",
                use_recommended_options="",
                nce_idt_freq=0.1,
                )

        # Specify individual options here
        commands = [

            # first command.
            # This command can be run using python -m experiments placeholder run 0
            # It will output python train.py [OPTIONS], where OPTIONS are everything defined in the variable opt
            "python train.py " + str(opt.clone().set(
                name="cityscapes_placeholder_noidt",  # name of experiments
                nce_idt=False,
            )),

            # second command.
            # This command can be run using python -m experiments placeholder run 1
            # It removes the option --nce_idt_freq 0.1 that was defined by our common options
            "python train.py " + str(opt.clone().set(
                name="cityscapes_placeholder_singlelayer",
                nce_layers="16",
            ).remove("nce_idt_freq")),


            # third command that performs multigpu training
            # This command can be run using python -m experiments placeholder run 2
            "python train.py " + str(opt.clone().set(
                name="cityscapes_placeholder_multigpu",
                nce_layers="16",
                batch_size=4,
                gpu_ids="0,1",
            )),

        ]

        return commands

    # This is the command used for testing.
    # They can be run using python -m experiments placeholder run_test $i
    def test_commands(self):
        opt = Options()
        opt.set(dataroot="~/datasets/cityscapes_unaligned/cityscapes",
                model="contrastive_cycle_gan",
                no_dropout="",
                init_type="xavier",
                batch_size=1,
                direction="BtoA",
                epoch=40,
                phase='train',
                evaluation_metrics="fid",
                )

        commands = [
            "python test.py " + str(opt.clone().set(
                name="cityscapes_nce",
                nce_layers="0,8,16",
                direction="BtoA",
            )),
        ]

        return commands