Пример #1
0
    # cnn2_output = load_RGB('data/kosode/cnn2_after_train_norm', file_num * motif_num)

    # cnn1_W = loadW('data/kosode_motif2/train/cnn1_after_train')
    # cnn2_W = loadW('data/kosode_motif2/train/cnn2_after_train')

    makeFolder()

    # 時間計測
    time1 = time.clock()

    print '~~~CNN1~~~'

    cnn1 = CNN(train_set, filter_shape, filter_shift_list[0], input_shape, node_shape[1], cnn_pre_train_lr, cnn_pre_train_epoch, isRGB)

    output_list = cnn1.output()
    cnn_saveColorImage(output_list, node_shape[1], 'cnn1_before_train')
    output_list_norm = local_contrast_normalization(output_list)
    cnn_saveColorImage(output_list_norm, node_shape[1], 'cnn1_before_training_norm')

    cnn1.pre_train()
    # cnn1.setW(cnn1_W)

    output_list = cnn1.output()
    cnn_saveColorImage(output_list, node_shape[1], 'cnn1_after_train')
    output_list_norm = local_contrast_normalization(output_list)
    cnn_saveColorImage(output_list_norm, node_shape[1], 'cnn1_after_train_norm')

    print '~~~CNN2~~~'

    cnn2 = CNN(cnn1.output(), filter_shape, filter_shift_list[1], node_shape[1], node_shape[2], cnn_pre_train_lr, cnn_pre_train_epoch, isRGB)
Пример #2
0
    # node_shape = ((80,52), (74,46), (35,21))
    node_shape = ((80, 52), (74, 46), (34, 20))
    filter_shift_list = ((1, 1), (2, 2))
    input_shape = [80, 52]
    filter_shape = [7, 7]

    data_list = load_image(data_path, file_num, isRGB)

    makeFolder()

    # 時間計測
    time1 = time.clock()

    cnn1 = CNN(data_list, filter_shape, filter_shift_list[0], input_shape, node_shape[1], pre_train_lr, pre_train_epoch)

    output_list = cnn1.output()
    saveImage(output_list, node_shape[1], 'cnn1_before_training')

    cnn1.pre_train()
    output_list = cnn1.output()
    saveImage(output_list, node_shape[1], 'cnn1_after_training')

    # for i in xrange(pre_train_epoch):
    # 	cnn1.pre_train()
    # 	output_list = cnn1.output()
    # 	saveImage(output_list, (74,46))

    cnn2 = CNN(cnn1.output(), filter_shape, filter_shift_list[1], node_shape[1], node_shape[2], pre_train_lr, pre_train_epoch)
    output_list = cnn2.output()
    saveImage(output_list, node_shape[2], 'cnn2_before_train')