    def data_loader(self, image_list):
        """
        Load the images and convert them to batched data.
        """
        batch_data = []
        HH, WW = self.im_shape
        batch = np.zeros((self.batch_size, HH, WW, 3), dtype="float16")
        img_paths, img_shapes, img_scales, raw_images = [], [], [], []
        num_samples = len(image_list)
        max_iter = (
            (num_samples + self.batch_size - 1) // self.batch_size * self.batch_size
        )
        datasets = itertools.cycle(image_list)
        for idx in range(max_iter):
            im_path = next(datasets)
            input_data, raw_input, im_shape, im_scale = self.preprocess(im_path)
            im_name = im_path.split("/")[-1]
            img_paths.append(im_name)
            img_shapes.append(im_shape)
            img_scales.append(im_scale)
            raw_images.append(raw_input)
            batch[idx % self.batch_size, :, :, :] = input_data
            if (idx + 1) % self.batch_size == 0:
                batch_data.append(
                    {
                        "data": batch.astype("float16"),
                        "image_shape": img_shapes,
                        "image_scale": img_scales,
                        "path": img_paths,
                        "image": raw_images,
                    }
                )
                img_paths, img_shapes, img_scales, raw_images = [], [], [], []
        return batch_data
Load the images and convert them to batched data.
examples/02_detectron2/predictor/predictor.py