コード例 #1
0
		用于 for loop, just like range() function
		'''
        if len(samples) != len(labels):
            raise Exception('Length of samples and labels must equal')
        stepStart = 0  # initial step
        i = 0
        while stepStart < len(samples):
            stepEnd = stepStart + chunkSize
            if stepEnd < len(samples):
                yield i, samples[stepStart:stepEnd], labels[stepStart:stepEnd]
                i += 1
            stepStart = stepEnd

    net = Network(train_batch_size=128,
                  test_batch_size=100,
                  pooling_scale=2,
                  dropout_rate=0.90,
                  base_learning_rate=0.008,
                  decay_rate=0.99)
    net.define_inputs(
        train_samples_shape=(128, 48, 48, 1),
        train_labels_shape=(128, 7),
        test_samples_shape=(100, 48, 48, 1),
    )
    #
    net.add_conv(patch_size=3,
                 in_depth=1,
                 out_depth=32,
                 activation='relu',
                 pooling=True,
                 name='conv1')
    net.add_conv(patch_size=3,
コード例 #2
0
        用于 for loop, just like range() function
        """
        if len(samples) != len(labels):
            raise Exception('Length of samples and labels must equal')
        stepStart = 0  # initial step
        i = 0
        while stepStart < len(samples):
            stepEnd = stepStart + chunkSize
            if stepEnd < len(samples):
                yield i, samples[stepStart:stepEnd], labels[stepStart:stepEnd]
                i += 1
            stepStart = stepEnd

    net = Network(train_batch_size=64,
                  test_batch_size=500,
                  pooling_scale=2,
                  dropout_rate=0.9,
                  base_learning_rate=0.001,
                  decay_rate=0.99)
    net.define_inputs(
        train_samples_shape=(64, image_size, image_size, num_channels),
        train_labels_shape=(64, num_labels),
        test_samples_shape=(500, image_size, image_size, num_channels),
    )
    #
    net.add_conv(patch_size=3,
                 in_depth=num_channels,
                 out_depth=32,
                 activation='relu',
                 pooling=False,
                 name='conv1')
    net.add_conv(patch_size=3,
コード例 #3
0
ファイル: main.py プロジェクト: oywc410/MYPG
		Iterator/Generator: get a batch of data
		这个函数是一个迭代器/生成器,用于每一次只得到 chunkSize 这么多的数据
		用于 for loop, just like range() function
		'''
        if len(samples) != len(labels):
            raise Exception('Length of samples and labels must equal')
        stepStart = 0  # initial step
        i = 0
        while stepStart < len(samples):
            stepEnd = stepStart + chunkSize
            if stepEnd < len(samples):
                yield i, samples[stepStart:stepEnd], labels[stepStart:stepEnd]
                i += 1
            stepStart = stepEnd

    net = Network(train_batch_size=64, test_batch_size=500, pooling_scale=2)
    net.define_inputs(train_samples_shape=(64, image_size, image_size,
                                           num_channels),
                      train_labels_shape=(64, num_labels),
                      test_samples_shape=(500, image_size, image_size,
                                          num_channels))
    #
    net.add_conv(patch_size=3,
                 in_depth=num_channels,
                 out_depth=16,
                 activation='relu',
                 pooling=False,
                 name='conv1')
    net.add_conv(patch_size=3,
                 in_depth=16,
                 out_depth=16,
コード例 #4
0
        """
        if len(samples) != len(labels):
            raise Exception('Length of samples and labels must equal')
        stepStart = 0  # initial step
        i = 0
        while stepStart < len(samples):
            stepEnd = stepStart + chunkSize
            if stepEnd < len(samples):
                yield i, samples[stepStart:stepEnd], labels[stepStart:stepEnd]
                i += 1
            stepStart = stepEnd

    net = Network(train_batch_size=64,
                  test_batch_size=500,
                  pooling_scale=2,
                  dropout_rate=0.5,
                  base_learning_rate=0.001,
                  decay_rate=0.99,
                  save_path='D:/Python/CNN/Models/v1.1.ckpt')  # default
    net.define_inputs(
        train_samples_shape=(64, image_size, image_size, num_channels),
        train_labels_shape=(64, num_labels),
        test_samples_shape=(500, image_size, image_size, num_channels),
    )
    #
    net.add_conv(patch_size=3,
                 in_depth=num_channels,
                 out_depth=32,
                 activation='relu',
                 pooling=False,
                 name='conv1')