(self, inputs)
return batch_data
assume order = ["image", "boxes", "boxes_category", "info"]
assume order = ["image", "boxes", "boxes_category", "info"]
assume order = [ image boxes boxes_category info ]
def apply(self, inputs):
        """
        assume order = ["image", "boxes", "boxes_category", "info"]
        """
        batch_data = defaultdict(list)

        for image, boxes, boxes_category, info in inputs:
            batch_data["data"].append(image.astype(np.float32))
            batch_data["gt_boxes"].append(
                np.concatenate([boxes, boxes_category[:, np.newaxis]], axis=1).astype(
                    np.float32
                )
            )

            _, current_height, current_width = image.shape
            assert len(boxes) == len(boxes_category)
            num_instances = len(boxes)
            info = [
                current_height,
                current_width,
                info[0],
                info[1],
                num_instances,
            ]
            batch_data["im_info"].append(np.array(info, dtype=np.float32))

        for key, value in batch_data.items():
            pad_shape = list(max(s) for s in zip(*[x.shape for x in value]))
            pad_value = [
                np.pad(
                    v,
                    self._get_padding(v.shape, pad_shape),
                    constant_values=self.pad_value,
                )
                for v in value
            ]
            batch_data[key] = np.ascontiguousarray(pad_value)

        return batch_data
def apply ( self , inputs ) : batch_data = defaultdict ( list ) for image , boxes , boxes_category , info in inputs : batch_data [ "data" ] . append ( image . astype ( np . float32 ) ) batch_data [ "gt_boxes" ] . append ( np . concatenate ( [ boxes , boxes_category [ : , np . newaxis ] ] , axis = 1 ) . astype ( np . float32 ) ) _ , current_height , current_width = image . shape assert len ( boxes ) == len ( boxes_category ) num_instances = len ( boxes ) info = [ current_height , current_width , info [ 0 ] , info [ 1 ] , num_instances , ] batch_data [ "im_info" ] . append ( np . array ( info , dtype = np . float32 ) ) for key , value in batch_data . items ( ) : pad_shape = list ( max ( s ) for s in zip ( * [ x . shape for x in value ] ) ) pad_value = [ np . pad ( v , self . _get_padding ( v . shape , pad_shape ) , constant_values = self . pad_value , ) for v in value ] batch_data [ key ] = np . ascontiguousarray ( pad_value ) return batch_data