def compute_inputs(self, image_group, annotations_group):
    '\n        Compute inputs for the network using an image_group.\n        '
    batch_images = np.zeros((len(image_group), self.input_size, self.input_size, 3), dtype=np.float32)
    batch_hms = np.zeros((len(image_group), self.output_size, self.output_size, self.num_classes()), dtype=np.float32)
    batch_hms_2 = np.zeros((len(image_group), self.output_size, self.output_size, self.num_classes()), dtype=np.float32)
    batch_whs = np.zeros((len(image_group), self.max_objects, 2), dtype=np.float32)
    batch_regs = np.zeros((len(image_group), self.max_objects, 2), dtype=np.float32)
    batch_reg_masks = np.zeros((len(image_group), self.max_objects), dtype=np.float32)
    batch_indices = np.zeros((len(image_group), self.max_objects), dtype=np.float32)
    for (b, (image, annotations)) in enumerate(zip(image_group, annotations_group)):
        c = np.array([(image.shape[1] / 2.0), (image.shape[0] / 2.0)], dtype=np.float32)
        s = (max(image.shape[0], image.shape[1]) * 1.0)
        trans_input = get_affine_transform(c, s, self.input_size)
        image = self.preprocess_image(image, c, s, tgt_w=self.input_size, tgt_h=self.input_size)
        batch_images[b] = image
        bboxes = annotations['bboxes']
        assert (bboxes.shape[0] != 0)
        class_ids = annotations['labels']
        assert (class_ids.shape[0] != 0)
        trans_output = get_affine_transform(c, s, self.output_size)
        for i in range(bboxes.shape[0]):
            bbox = bboxes[i].copy()
            cls_id = class_ids[i]
            bbox[:2] = affine_transform(bbox[:2], trans_output)
            bbox[2:] = affine_transform(bbox[2:], trans_output)
            bbox[[0, 2]] = np.clip(bbox[[0, 2]], 0, (self.output_size - 1))
            bbox[[1, 3]] = np.clip(bbox[[1, 3]], 0, (self.output_size - 1))
            (h, w) = ((bbox[3] - bbox[1]), (bbox[2] - bbox[0]))
            if ((h > 0) and (w > 0)):
                (radius_h, radius_w) = gaussian_radius((math.ceil(h), math.ceil(w)))
                radius_h = max(0, int(radius_h))
                radius_w = max(0, int(radius_w))
                radius = gaussian_radius_2((math.ceil(h), math.ceil(w)))
                radius = max(0, int(radius))
                ct = np.array([((bbox[0] + bbox[2]) / 2), ((bbox[1] + bbox[3]) / 2)], dtype=np.float32)
                ct_int = ct.astype(np.int32)
                draw_gaussian(batch_hms[b, :, :, cls_id], ct_int, radius_h, radius_w)
                draw_gaussian_2(batch_hms_2[b, :, :, cls_id], ct_int, radius)
                batch_whs[(b, i)] = ((1.0 * w), (1.0 * h))
                batch_indices[(b, i)] = ((ct_int[1] * self.output_size) + ct_int[0])
                batch_regs[(b, i)] = (ct - ct_int)
                batch_reg_masks[(b, i)] = 1
    return [batch_images, batch_hms_2, batch_whs, batch_regs, batch_reg_masks, batch_indices]
Compute inputs for the network using an image_group.
def compute_inputs(self, image_group, annotations_group):
    '\n        \n        '
    batch_images = np.zeros((len(image_group), self.input_size, self.input_size, 3), dtype=np.float32)
    batch_hms = np.zeros((len(image_group), self.output_size, self.output_size, self.num_classes()), dtype=np.float32)
    batch_hms_2 = np.zeros((len(image_group), self.output_size, self.output_size, self.num_classes()), dtype=np.float32)
    batch_whs = np.zeros((len(image_group), self.max_objects, 2), dtype=np.float32)
    batch_regs = np.zeros((len(image_group), self.max_objects, 2), dtype=np.float32)
    batch_reg_masks = np.zeros((len(image_group), self.max_objects), dtype=np.float32)
    batch_indices = np.zeros((len(image_group), self.max_objects), dtype=np.float32)
    for (b, (image, annotations)) in enumerate(zip(image_group, annotations_group)):
        c = np.array([(image.shape[1] / 2.0), (image.shape[0] / 2.0)], dtype=np.float32)
        s = (max(image.shape[0], image.shape[1]) * 1.0)
        trans_input = get_affine_transform(c, s, self.input_size)
        image = self.preprocess_image(image, c, s, tgt_w=self.input_size, tgt_h=self.input_size)
        batch_images[b] = image
        bboxes = annotations['bboxes']
        assert (bboxes.shape[0] != 0)
        class_ids = annotations['labels']
        assert (class_ids.shape[0] != 0)
        trans_output = get_affine_transform(c, s, self.output_size)
        for i in range(bboxes.shape[0]):
            bbox = bboxes[i].copy()
            cls_id = class_ids[i]
            bbox[:2] = affine_transform(bbox[:2], trans_output)
            bbox[2:] = affine_transform(bbox[2:], trans_output)
            bbox[[0, 2]] = np.clip(bbox[[0, 2]], 0, (self.output_size - 1))
            bbox[[1, 3]] = np.clip(bbox[[1, 3]], 0, (self.output_size - 1))
            (h, w) = ((bbox[3] - bbox[1]), (bbox[2] - bbox[0]))
            if ((h > 0) and (w > 0)):
                (radius_h, radius_w) = gaussian_radius((math.ceil(h), math.ceil(w)))
                radius_h = max(0, int(radius_h))
                radius_w = max(0, int(radius_w))
                radius = gaussian_radius_2((math.ceil(h), math.ceil(w)))
                radius = max(0, int(radius))
                ct = np.array([((bbox[0] + bbox[2]) / 2), ((bbox[1] + bbox[3]) / 2)], dtype=np.float32)
                ct_int = ct.astype(np.int32)
                draw_gaussian(batch_hms[b, :, :, cls_id], ct_int, radius_h, radius_w)
                draw_gaussian_2(batch_hms_2[b, :, :, cls_id], ct_int, radius)
                batch_whs[(b, i)] = ((1.0 * w), (1.0 * h))
                batch_indices[(b, i)] = ((ct_int[1] * self.output_size) + ct_int[0])
                batch_regs[(b, i)] = (ct - ct_int)
                batch_reg_masks[(b, i)] = 1
    return [batch_images, batch_hms_2, batch_whs, batch_regs, batch_reg_masks, batch_indices]