예제 #1
0
    calorimeter = [
        Input(shape=sizes[:2] + [1]),
        Input(shape=sizes[2:4] + [1]),
        Input(shape=sizes[4:] + [1])
    ]

    input_energy = Input(shape=(1, ))

    features = []
    energies = []

    for l in range(3):
        # build features per layer of calorimeter
        features.append(
            build_discriminator(image=calorimeter[l],
                                mbd=True,
                                sparsity=True,
                                sparsity_mbd=True))

        energies.append(calculate_energy(calorimeter[l]))

    features = concatenate(features)

    # This is a (None, 3) tensor with the individual energy per layer
    energies = concatenate(energies)

    # calculate the total energy across all rows
    total_energy = Lambda(lambda x: K.reshape(K.sum(x, axis=-1), (-1, 1)),
                          name='total_energy')(energies)

    # construct MBD on the raw energies
    nb_features = 10
예제 #2
0
    logger.info('Building discriminator')

    calorimeter = [Input(shape=sizes[:2] + [1]),
                   Input(shape=sizes[2:4] + [1]),
                   Input(shape=sizes[4:] + [1])]

    input_energy = Input(shape=(1, ))

    features = []
    energies = []

    for l in range(3):
        # build features per layer of calorimeter
        features.append(build_discriminator(
            image=calorimeter[l],
            mbd=True,
            sparsity=True,
            sparsity_mbd=True
        ))

        energies.append(calculate_energy(calorimeter[l]))

    features = concatenate(features)

    # This is a (None, 3) tensor with the individual energy per layer
    energies = concatenate(energies)

    # calculate the total energy across all rows
    total_energy = Lambda(
        lambda x: K.reshape(K.sum(x, axis=-1), (-1, 1)),
        name='total_energy'
    )(energies)