我正在嘗試使用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
的包裝由於棄用警告,但我可以」似乎找不到任何有關如何使用包裝估計器來評估模型的信息。