CNNTrainer_main.py 1.13 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import logging
import mxnet as mx
import CNNCreator_main_net1
import CNNCreator_main_net2

if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    logger = logging.getLogger()
    handler = logging.FileHandler("train.log","w", encoding=None, delay="true")
    logger.addHandler(handler)

    main_net1 = CNNCreator_main_net1.CNNCreator_main_net1()
    main_net1.train(
        batch_size = 64,
15
        num_epoch = 10,
16
17
18
19
20
21
22
23
24
25
26
27
28
        load_checkpoint = False,
        context = 'gpu',
        normalize = True,
        optimizer = 'adam',
        optimizer_params = {
            'weight_decay': 1.0E-4,
            'learning_rate': 0.01,
            'learning_rate_decay': 0.8,
            'step_size': 1000        }
    )
    main_net2 = CNNCreator_main_net2.CNNCreator_main_net2()
    main_net2.train(
        batch_size = 32,
29
        num_epoch = 10,
30
31
32
33
34
35
36
37
38
39
        load_checkpoint = False,
        context = 'gpu',
        normalize = True,
        optimizer = 'adam',
        optimizer_params = {
            'weight_decay': 1.0E-4,
            'learning_rate': 0.01,
            'learning_rate_decay': 0.8,
            'step_size': 1000        }
    )