我正在尝试使用TF 1.1.0使用MNIST CNN教程提供的here来实现VGGnet。我收到的错误信息是:Tensorflow版本''1.1.0'SKCompat属性错误
AttributeError: 'SKCompat' object has no attribute 'evaluate'
我的代码这部分AttributeError的抛出了:
#create estimator
vggnet_classifier = learn.SKCompat(learn.Estimator(model_fn=vggnet_model, model_dir= "/tmp/vgg_net"))
# Set up logging for predictions
tensors_to_log = {"probabilities": "softmax_tensor"}
logging_hook = tf.train.LoggingTensorHook(tensors=tensors_to_log, every_n_iter=100)
#train model
vggnet_classifier.fit(
x=X_train,
y=y_train,
batch_size=100,
steps=2,
monitors=[logging_hook])
# Configure the accuracy metric for evaluation
metrics = {
"accuracy":
learn.MetricSpec(metric_fn=tf.metrics.accuracy, prediction_key="classes"),}
# Evaluate the model and print results
eval_results = vggnet_classifier.evaluate(x=X_val, y=y_val, metrics=metrics)
print(eval_results)
我最初添加周围learn.Estimator
的包装由于弃用警告,但我可以”似乎找不到任何有关如何使用包装估计器来评估模型的信息。