我的代码如下。
class RecogFeatureGraph():
""" Importing and running pixel link graph """
def __init__(self,fatness,image_shape):
self.input_dat = tf.placeholder(dtype=tf.float32, shape=(None,30,80,256))
self.boxes = tf.placeholder(dtype=tf.float32, shape=(16,4))
self.box_indices = tf.placeholder(dtype=tf.int32, shape=(16,))
self.sess = tf.Session(graph = tf.get_default_graph())
self.rec_fmap = tf.image.crop_and_resize(self.input_dat, self.boxes, self.box_indices, [16, 70], method='bilinear', extrapolation_value=0, name='crop_resize')
def run(self, input_dat, in_boxes, box_indices):
return self.sess.run([self.rec_fmap], feed_dict={self.input_dat: input_dat, self.boxes:in_boxes, self.box_indices:box_indices})
input_dat.shape
是(12, 30, 80, 256)
。
收件箱是
array([[0.13, 0.31, 0.37, 0.75],
[0.4 , 0.17, 0.63, 0.62],
[0.23, 0.19, 0.54, 0.78],
[0.08, 0.21, 0.42, 0.4 ],
[0.46, 0.07, 0.79, 0.54],
[0.11, 0.32, 0.5 , 0.53],
[0.53, 0.13, 0.93, 0.67],
[0.34, 0.26, 0.63, 0.89],
[0.38, 0.3 , 0.7 , 0.86],
[0.14, 0.08, 0.48, 0.8 ],
[0.26, 0.04, 0.57, 0.71],
[0.2 , 0.35, 0.47, 0.78],
[0.33, 0.28, 0.6 , 0.51],
[0.61, 0.21, 0.88, 0.59],
[0.17, 0.07, 0.49, 0.64],
[0.09, 0.05, 0.42, 0.65]], dtype=float32)
box_indices是
array([ 0, 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10, 10, 11, 12],
dtype=int32)
因此box_indices在input_dat
范围内。
为什么会有OutOfRangeError?
我的张量流是1.14.0。