(bbox, img_shape)
return tf.stack([y_1, x_1, y_2, x_2], axis=_axis)
Scale bboxes to [0, 1). bbox format [ymin, xmin, ymax, xmax]
  Args:
    bbox: 2-D with shape '[num_bbox, 4]'
    img_shape: 1-D with shape '[4]'
  Return:
    sclaed_bboxes: scaled bboxes
Scale bboxes to [0, 1). bbox format [ymin, xmin, ymax, xmax]
  Args:
    bbox: 2-D with shape '[num_bbox, 4]'
    img_shape: 1-D with shape '[4]'
  Return:
    sclaed_bboxes: scaled bboxes
Scale bboxes to [ 0 1 ) . bbox format [ ymin xmin ymax xmax ] Args : bbox : 2 - D with shape [ num_bbox 4 ] img_shape : 1 - D with shape [ 4 ] Return : sclaed_bboxes : scaled bboxes
def scale_bboxes(bbox, img_shape):
  """Scale bboxes to [0, 1). bbox format [ymin, xmin, ymax, xmax]
  Args:
    bbox: 2-D with shape '[num_bbox, 4]'
    img_shape: 1-D with shape '[4]'
  Return:
    sclaed_bboxes: scaled bboxes
  """
  img_h = tf.cast(img_shape[0], dtype=tf.float32)
  img_w = tf.cast(img_shape[1], dtype=tf.float32)
  shape = bbox.get_shape().as_list()
  _axis = 1 if len(shape) > 1 else 0
  [y_min, x_min, y_max, x_max] = tf.unstack(bbox, axis=_axis)
  y_1 = tf.truediv(y_min, img_h)
  x_1 = tf.truediv(x_min, img_w)
  y_2 = tf.truediv(y_max, img_h)
  x_2 = tf.truediv(x_max, img_w)
  return tf.stack([y_1, x_1, y_2, x_2], axis=_axis)
def scale_bboxes ( bbox , img_shape ) : img_h = tf . cast ( img_shape [ 0 ] , dtype = tf . float32 ) img_w = tf . cast ( img_shape [ 1 ] , dtype = tf . float32 ) shape = bbox . get_shape ( ) . as_list ( ) _axis = 1 if len ( shape ) > 1 else 0 [ y_min , x_min , y_max , x_max ] = tf . unstack ( bbox , axis = _axis ) y_1 = tf . truediv ( y_min , img_h ) x_1 = tf . truediv ( x_min , img_w ) y_2 = tf . truediv ( y_max , img_h ) x_2 = tf . truediv ( x_max , img_w ) return tf . stack ( [ y_1 , x_1 , y_2 , x_2 ] , axis = _axis )