![](/img/trans.png)
[英]AttributeError: 'NoneType' object has no attribute 'image_data_format' in keras resnet50
[英]How can I display a features of a image that was extracted by a Resnet50 model in keras
因此,我想做的是显示从Resnet50模型提取并另存为.npy的功能。
我完全可以阅读它,数组看起来也很好。 但是我无法找到一种很好地显示结果的方法。 如何在opencv
matplotlib
中显示此内容?
这是我到目前为止的内容:
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from matplotlib import cm
import os
path = "ResnetFeatures/"
def load_resnet_features(file, path):
file_path = os.path.join(path, file)
return np.load(file_path)
test_file = '1500test.npy'
test_feature = load_resnet_features(test_file, path)
print(test_feature.shape)
test_feature = np.squeeze(test_feature, axis=0)
print(test_feature.shape)
test_feature = test_feature.reshape((49, 2048))
plt.imshow(test_feature)
plt.show()
这给这个
(1, 7, 7, 2048)
(7, 7, 2048)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.