Only keep boxes with both sides >= min_size

    Arguments:
        boxlist (Boxlist)
        min_size (int)
482484
def remove_small_boxes(boxlist, min_size):
    
    # TODO maybe add an API for querying the ws / hs
    xywh_boxes = boxlist.convert("xywh").bbox
    _, _, ws, hs = xywh_boxes.unbind(dim=1)
    keep = (
        (ws >= min_size) & (hs >= min_size)
    ).nonzero().squeeze(1)
    return boxlist[keep]
1252148
def _get_boxes(pos, size=None, margin=0, keep_aspect_ratio=True):
    """"""

    # Get x, y.
    pos = np.asarray(pos, dtype=np.float64)
    x, y = pos.T
    x = x[:, np.newaxis]
    y = y[:, np.newaxis]

    w, h = size if size is not None else _get_box_size(x, y, margin=margin)

    x0, y0 = x - w, y - h
    x1, y1 = x + w, y + h

    # Renormalize the whole thing by keeping the aspect ratio.
    x0min, y0min, x1max, y1max = x0.min(), y0.min(), x1.max(), y1.max()
    if not keep_aspect_ratio:
        b = (x0min, y0min, x1max, y1max)
    else:
        dx = x1max - x0min
        dy = y1max - y0min
        if dx > dy:
            b = (x0min, (y1max + y0min) / 2. - dx / 2.,
                 x1max, (y1max + y0min) / 2. + dx / 2.)
        else:
            b = ((x1max + x0min) / 2. - dy / 2., y0min,
                 (x1max + x0min) / 2. + dy / 2., y1max)
    r = Range(from_bounds=b,
              to_bounds=(-1, -1, 1, 1))
    return np.c_[r.apply(np.c_[x0, y0]), r.apply(np.c_[x1, y1])]
108061
def _crop_list_to_size(l, size):
    """"""
    for x in range(size - len(l)):
        l.append(False)
    for x in range(len(l) - size):
        l.pop()
    return l
232537
def _box_col_values(self, values, items):
        
        klass = self._constructor_sliced
        return klass(values, index=self.index, name=items, fastpath=True)
1363134
def enclosing_box(boxes):
        
        x = max(0, min([box.x for box in boxes]))
        y = max(0, min([box.y for box in boxes]))
        x2 = max([box.bottom_right()[0] for box in boxes])
        y2 = max([box.bottom_right()[1] for box in boxes])
        return Box.from_xy(x, y, x2, y2)
108856
def update_boxes(self, box_pos, box_size):
        """"""
        assert box_pos.shape == (self.n_boxes, 2)
        assert len(box_size) == 2
        self.box_bounds = _get_boxes(box_pos,
                                     size=box_size,
                                     keep_aspect_ratio=self.keep_aspect_ratio,
                                     )
277087
def min(self):
        
        return self._constructor(self.values.min(axis=self.baseaxes, keepdims=True))
341382
def area(boxes):
    
    x_min, y_min, x_max, y_max = tf.split(boxes, 4, axis=1)
    return tf.squeeze((y_max - y_min) * (x_max - x_min), [1])
95426
def overlaps(self, box, th=0.0001):
        
        int_box = Box.intersection_box(self, box)
        small_box = self if self.smaller(box) else box
        return True if int_box.area() / small_box.area() >= th else False
824963
function(bbox) {
        var a = +bbox[0][0], b = +bbox[0][1], c = +bbox[1][0], d = +bbox[1][1];
        return [ Math.min(a, c), Math.min(b, d), Math.max(a, c), Math.max(b, d) ];
    }
973083
def left_most(boxes):
        
        x_list = [(box.x, box) for box in boxes]
        x_list.sort()
        return x_list[0][1]
963014
function(box_or_min, max){
			var min;
			if( is.AABB( box_or_min ) ){
				max = box_or_min.getMax();
				min = box_or_min.getMin();
			} else {
				min = box_or_min;
			}
			this.x = mathUtils.clip(this.x, min.x, max.x);
			this.y = mathUtils.clip(this.y, min.y, max.y);
			this.z = mathUtils.clip(this.z, min.z, max.z);
			return this;
		}
947588
def clip_boxes(boxes, shape):
    
    orig_shape = boxes.shape
    boxes = boxes.reshape([-1, 4])
    h, w = shape
    boxes[:, [0, 1]] = np.maximum(boxes[:, [0, 1]], 0)
    boxes[:, 2] = np.minimum(boxes[:, 2], w)
    boxes[:, 3] = np.minimum(boxes[:, 3], h)
    return boxes.reshape(orig_shape)
12444
def not_left(self, num):
        
        if num == None:
            return FlatList([_get_list(self)[-1]])
        if num <= 0:
            return self

        return FlatList(_get_list(self)[num::])
125839
def ensure_list_size(list_, size_):
    
    lendiff = (size_) - len(list_)
    if lendiff > 0:
        extension = [None for _ in range(lendiff)]
        list_.extend(extension)
311553
def _checkDimensionsListLike(arrays):
    
    dim1 = len(arrays)
    dim2, dim3 = arrays[0].shape
    for aa in range(1, dim1):
        dim2_aa, dim3_aa = arrays[aa].shape
        if (dim2_aa != dim2) or (dim3_aa != dim3):
            raise _error.InvalidError(_MDPERR["obj_square"])
    return dim1, dim2, dim3
1036482
def width_min(self, width_min):
        

        if width_min is None:
            self._width_limits[0] = 0
            return

        width_min = float(width_min)
        assert(0 <= width_min)

        self._width_limits[0] = width_min
        self._update_layout()