import tensorflow as tf

        cls = tf.sigmoid(cls)
        anchors = anchors.astype(np.float32)

        grid_shape = x_shape[1:3]
        # print(grid_shape)
        grid_h, grid_w = grid_shape[0], grid_shape[1]
        # print(grid_h,tf.range(grid_h))
        
        grid = tf.meshgrid(tf.range(grid_w), tf.range(grid_h))
        grid = tf.expand_dims(tf.stack(grid, axis=-1), axis=2)  # [gx, gy, 1, 2]

        box_xy = (box_xy + tf.cast(grid, dtype)) * stride
        box_wh = tf.exp(box_wh) * anchors

        box_x1y1 = box_xy - box_wh / 2.
        box_x2y2 = box_xy + box_wh / 2.
        box = tf.concat([box_x1y1, box_x2y2], axis=-1)

        boxes.append(tf.reshape(box, (x_shape[0], -1, 1, 4)))
        objects.append(tf.reshape(obj, (x_shape[0], -1, 1)))
        classes.append(tf.reshape(cls, (x_shape[0], -1, num_classes)))

    boxes = tf.concat(boxes, axis=1)
    objects = tf.concat(objects, axis=1)
