我正在尝试与from datasets import imagenet
from tensorflow.contrib import slim
from nets import inception
def predict(image, version='V3'):
tf.reset_default_graph()
# Process the image
raw_image, processed_image = process_image(image)
class_names = imagenet.create_readable_names_for_imagenet_labels()
# Create a placeholder for the images
X = tf.placeholder(tf.float32, [None, 299, 299, 3], name="X")
'''
inception_v3 function returns logits and end_points dictionary
logits are output of the network before applying softmax activation
'''
if version.upper() == 'V3':
model_ckpt_path = INCEPTION_V3_CKPT_PATH
with slim.arg_scope(inception.inception_v3_arg_scope()):
# Set the number of classes and is_training parameter
logits, end_points = inception.inception_v3(X, num_classes=1001, is_training=False)
predictions = end_points.get('Predictions', 'No key named predictions')
saver = tf.train.Saver()
with tf.Session() as sess:
saver.restore(sess, model_ckpt_path)
prediction_values = predictions.eval({X: processed_image})
try:
# Add an index to predictions and then sort by probability
prediction_values = [(i, prediction) for i, prediction in enumerate(prediction_values[0,:])]
prediction_values = sorted(prediction_values, key=lambda x: x[1], reverse=True)
# Plot the image
plot_color_image(raw_image)
plt.show()
print("Using Inception_{} CNN\nPrediction: Probability\n".format(version))
# Display the image and predictions
for i in range(10):
predicted_class = class_names[prediction_values[i][0]]
probability = prediction_values[i][1]
print("{}: {:.2f}%".format(predicted_class, probability*100))
# If the predictions do not come out right
except:
print(predictions)
一起使用Versions Maven Plugin。
问题:运行spring-boot
自动检查最新依赖项时,我不仅在versions:display-dependency-updates
中定义了更新,而且还从pom.xml
继承了所有依赖项。
问题:如何防止继承并仅显示自定义依赖项?
spring-boot-starter-parent
充其量,该插件会通知我类似的更新
<project>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<properties>
<cxf.version>3.0.0</cxf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
</project>
但是,相反,我正在输出从spring父级继承的所有依赖项。
答案 0 :(得分:2)
您可以改用versions:display-property-updates
目标。该目标仅考虑作为属性给出的依赖项版本,因此不会显示可传递的依赖项。您必须在pom中添加一些其他版本属性,但这通常不是一件坏事。
versions:display-dependency-updates
目标的文档中未包含用于排除传递依赖项的标志。因此,我认为使用该目标是不可能的。我也没有在issues.apache.org上找到任何相关的未解决问题,因此它似乎也未列入路线图。