我遵循了 sentdex 的 Tensorflow 对象检测教程。参考网站.... https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/
我已经成功得到了结果。现在我想在训练后可视化权重。像这样.... https://medium.com/@awjuliani/visualizing-neural-network-layer-activation-tensorflow-tutorial-d45f8bf7bbc4 ..或.. https://gist.github.com/kukuruza/03731dc494603ceab0c5 .. 我尝试从 model_ckpt_meta 文件中获取一些权重信息。Model_ckpt_meta 文件有很多信息,但我不知道该选择哪一个。所以我选择其中一个信息。并尝试可视化权重。这是我的代码和结果?
import tensorflow as tf
import numpy as np
from tensorflow.python import pywrap_tensorflow
from matplotlib import pyplot as plt
with tf.Session() as sess:
new_saver = tf.train.import_meta_graph(checkpoint_path + '.meta')
new_saver.restore(sess, tf.train.latest_checkpoint(checkpoint_path))
weightArray=sess.run('BoxPredictor_5/ClassPredictor/weights:0')
weightArray = weightArray.reshape(-1,1,32,3)
x_min = np.min(weightArray)
x_max = np.max(weightArray)
wing=255.0*(weightArray.squeeze() - x_min) / (x_max - x_min)
plt.imshow(wing.astype('uint8'))
plt.axis('off')
Run Code Online (Sandbox Code Playgroud)
结果有什么办法显示的更清楚吗?如果使用 ssd_mobilenet 模型无法获得可视化权重。希望能告诉我。非常感谢。
| 归档时间: |
|
| 查看次数: |
508 次 |
| 最近记录: |