예제 #1
0
def get_squeezenet_model(layers):

    base_model = SqueezeNet(content_layers)

    all_n = []
    
    all_n = get_ckpt_weights('../squeezenet_weights/squeezenet.ckpt')
    all_weights = []
    for w in base_model.model.weights:
        all_weights.append(all_n[weight_to_weight[w.name]])
    base_model.set_weights(all_weights)
    base_model.trainable = False

    dream_model = base_model 

    return dream_model
예제 #2
0
    return total_variation_weight * tf.image.total_variation(img)


if __name__ == '__main__':
    m = SqueezeNet()

    all_n = []

    all_n = get_ckpt_weights('../squeezenet_weights/squeezenet.ckpt')

    all_weights = []
    for w in m.model.weights:
        all_weights.append(all_n[weight_to_weight[w.name]])

    m.set_weights(all_weights)
    m.trainable = False

    sw = 0.012

    params1 = {
        'content_image': 'styles/blackpool.jpg',

        #'style_image' : 'styles/composition_vii.jpg',
        #'style_image' : 'styles/muse.jpg',

        #'style_image': 'styles/starry_night.jpg',
        #'style_image': 'styles/impr_sunset.jpg',
        #'style_image': 'styles/the_scream.jpg',
        #'style_image': 'styles/mona.jpg',
        'style_image': 'styles/farm-painting.jpg',