实际上,我正在使用免费帐户学习 Azure ML Studio 课程。我有一个非常简单的笔记本,我从 Keras 加载 DenseNet 并使用它(没有拆分和训练)来预测一些图像。
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from keras.applications.densenet import DenseNet121
from keras.applications.densenet import preprocess_input
from keras.applications.densenet import decode_predictions
from imageio import imread
from PIL import Image
import io
import numpy as np
# load the model
model = DenseNet121()
image = load_img("images/image2.jpeg",target_size=(224, 224))
image = img_to_array(image)
image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))
image = preprocess_input(image)
# predict the probability across all output classes
yhat = model.predict(image)
# convert the probabilities to class labels
label = decode_predictions(yhat)
# retrieve the most likely result, e.g. highest probability
label = label[0][0]
# print the classification
print('%s' % (label[1]))
print('%s' % (label[2]*100))
我想知道是否可以在 Azure ML Studio Designer(低代码)中加载在 ImageNet 上预训练的 DenseNet 而无需对其进行训练,而仅像我在笔记本中那样将其用于预测?