(boxes, img_h, img_w)
:param anchors:boxes with format [xmin, ymin, xmax, ymax]
    :param img_h: height of image
    :param img_w: width of image
    :return: indices of anchors that inside the image boundary
:param anchors:boxes with format [xmin, ymin, xmax, ymax]
    :param img_h: height of image
    :param img_w: width of image
    :return: indices of anchors that inside the image boundary
: param anchors : boxes with format [ xmin ymin xmax ymax ] : param img_h : height of image : param img_w : width of image : return : indices of anchors that inside the image boundary
def filter_outside_boxes(boxes, img_h, img_w):
    '''
    :param anchors:boxes with format [xmin, ymin, xmax, ymax]
    :param img_h: height of image
    :param img_w: width of image
    :return: indices of anchors that inside the image boundary
    '''

    with tf.name_scope('filter_outside_boxes'):
        xmin, ymin, xmax, ymax = tf.unstack(boxes, axis=1)

        xmin_index = tf.greater_equal(xmin, 0)
        ymin_index = tf.greater_equal(ymin, 0)
        xmax_index = tf.less_equal(xmax, tf.cast(img_w, tf.float32))
        ymax_index = tf.less_equal(ymax, tf.cast(img_h, tf.float32))

        indices = tf.transpose(tf.stack([xmin_index, ymin_index, xmax_index, ymax_index]))
        indices = tf.cast(indices, dtype=tf.int32)
        indices = tf.reduce_sum(indices, axis=1)
        indices = tf.where(tf.equal(indices, 4))
        # indices = tf.equal(indices, 4)
        return tf.reshape(indices, [-1])
def filter_outside_boxes ( boxes , img_h , img_w ) : with tf . name_scope ( 'filter_outside_boxes' ) : xmin , ymin , xmax , ymax = tf . unstack ( boxes , axis = 1 ) xmin_index = tf . greater_equal ( xmin , 0 ) ymin_index = tf . greater_equal ( ymin , 0 ) xmax_index = tf . less_equal ( xmax , tf . cast ( img_w , tf . float32 ) ) ymax_index = tf . less_equal ( ymax , tf . cast ( img_h , tf . float32 ) ) indices = tf . transpose ( tf . stack ( [ xmin_index , ymin_index , xmax_index , ymax_index ] ) ) indices = tf . cast ( indices , dtype = tf . int32 ) indices = tf . reduce_sum ( indices , axis = 1 ) indices = tf . where ( tf . equal ( indices , 4 ) ) # indices = tf.equal(indices, 4) return tf . reshape ( indices , [ - 1 ] )