导入包人脸识别包:
预期输出:
loss=528.143
预计输出:
It's younes, welcome home!
Out[10]:
(0.67100745, True)
预期输出:
It's not kian, please go away
(0.8580015, False)
预期输出:
it's younes, the distance is 0.67100745
(0.67100745, 'younes')
导入神经风格迁移包:
预期输出:
J_content = 6.7655935
预期输出:
GA = [[ 6.422305 -4.429122 -2.096682]
[-4.429122 19.465837 19.563871]
[-2.096682 19.563871 20.686462]]
练习:计算单层的风格损失。
预期输出:
J_style_layer = 9.190278
练习:实现总损失函数,其中包括内容损失和风格损失。
预期输出:
J = 35.34667875478276
练习:现在你有了J_content和J_style,通过调用total_cost()
计算总损失J。 使用alpha = 10
和 beta = 40
。
练习:实现model_nn()函数,该函数初始化tensorflow计算图的变量,将输入图像(初始生成的图像)作为VGG16模型的输入,并运行train_step进行训练步骤。
预期输出:
Iteration 0 :
total cost = 5050363000.0
content cost = 7877.685
style cost = 126257096.0