config.py 1.8 KB
Newer Older
P
peterzhang2029 已提交
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
__all__ = ["TrainerConfig", "ModelConfig"]


class TrainerConfig(object):

    # Whether to use GPU in training or not.
    use_gpu = True

    # The number of computing threads.
    trainer_count = 1

    # The training batch size.
    batch_size = 10

    # The epoch number.
    num_passes = 10

    # Parameter updates momentum.
    momentum = 0

    # The shape of images.
    image_shape = (173, 46)

    # The buffer size of the data reader.
    # The number of buffer size samples will be shuffled in training.
    buf_size = 1000

    # The parameter is used to control logging period.
    # Training log will be printed every log_period.
    log_period = 50


class ModelConfig(object):

    # Number of the filters for convolution group.
    filter_num = 8

    # Use batch normalization or not in image convolution group.
    with_bn = True

    # The number of channels for block expand layer.
    num_channels = 128

    # The parameter stride_x  in block expand layer.
    stride_x = 1

    # The parameter stride_y  in block expand layer.
    stride_y = 1

    # The parameter block_x  in block expand layer.
    block_x = 1

    # The parameter block_y  in block expand layer.
    block_y = 11

    # The hidden size for gru.
    hidden_size = num_channels

    # Use norm_by_times or not in warp ctc layer.
    norm_by_times = True

    # The list for number of filter in image convolution group layer.
    filter_num_list = [16, 32, 64, 128]

    # The parameter conv_padding in image convolution group layer.
    conv_padding = 1

    # The parameter conv_filter_size in image convolution group layer.
    conv_filter_size = 3

    # The parameter pool_size in image convolution group layer.
    pool_size = 2

    # The parameter pool_stride in image convolution group layer.
P
peterzhang2029 已提交
75
    pool_stride = 2