|
你好,我在object_detection_tutorial.ipynb目前可以调用模型,正常输出结果。也在ensorflow\models\research\object_detection\meta_architectures\ssd_meta_arch.py的相应位置添加了如下代码,但整个推理过程结束后,也没有生成文件。请问,是不是我修改位置错了?
在 tensorflow\models\research\object_detection\meta_architectures\ssd_meta_arch.py
predictions_dict = {
'preprocessed_inputs': preprocessed_inputs,
'feature_maps': feature_maps,
'anchors': self._anchors.get()
} 代码后添加以下代码:
sess = tf.Session()
with sess.as_default():
anchors_np = self._anchors.get().eval()
anchors_np = anchors_np.transpose()
minx = anchors_np[0]
miny = anchors_np[1]
maxx = anchors_np[2]
maxy = anchors_np[3]
cx = (minx + maxx) / 2.
cy = (miny + maxy) / 2.
w = maxx - minx
h = maxy - miny
np.savetxt('box_priors.txt', (cx, cy, w, h), fmt='%0.8f') |
|