激活虛擬環境,退出虛擬環境html
activate tensorflow
deactivatepython
tansorflow 、pip 都更新到最新 :git
pip install --upgrade pipgithub
parser.add_argument('style_reference_image_path_1', metavar='ref', type=str, help='Path to the style reference image_1.') parser.add_argument('style_reference_image_path_2', metavar='ref', type=str, help='Path to the style reference image_2.')
style_reference_image_path_1 = args.style_reference_image_path_1 style_reference_image_path_2 = args.style_reference_image_path_2
style_reference_image_1 = K.variable(preprocess_image(style_reference_image_path_1)) style_reference_image_2 = K.variable(preprocess_image(style_reference_image_path_2))
input_tensor = K.concatenate([base_image, style_reference_image_1, style_reference_image_2, combination_image], axis=0)
combination_features = layer_features[3, :, :, :]
for layer_name in feature_layers: layer_features = outputs_dict[layer_name] style_reference_features_1 = layer_features[1, :, :, :] combination_features = layer_features[3, :, :, :] sl = style_loss(style_reference_features_1, combination_features) loss += (style_weight / len(feature_layers)) * sl style_reference_features_2 = layer_features[2, :, :, :] combination_features = layer_features[3, :, :, :] sl = style_loss(style_reference_features_2, combination_features) loss += (style_weight / len(feature_layers)) * sl
主要代碼能夠根據 keras中文文檔 瞭解含義算法
甚至並不用深刻理解代碼。。。跟着感受把代碼改了一下。。。莫名其妙代碼一遍改好。。。跑一下就把結果跑出來了。。。編程