One image / label pair for the given index is picked up and pre-processed. Args: index (int): data index Returns: img (numpy.ndarray): pre-processed image padded_labels (torch.Tensor): pre-processed label data. The shape
(self, index)
| 105 | |
| 106 | @Dataset.resize_getitem |
| 107 | def __getitem__(self, index): |
| 108 | """ |
| 109 | One image / label pair for the given index is picked up and pre-processed. |
| 110 | |
| 111 | Args: |
| 112 | index (int): data index |
| 113 | |
| 114 | Returns: |
| 115 | img (numpy.ndarray): pre-processed image |
| 116 | padded_labels (torch.Tensor): pre-processed label data. |
| 117 | The shape is :math:`[max_labels, 5]`. |
| 118 | each label consists of [class, xc, yc, w, h]: |
| 119 | class (float): class index. |
| 120 | xc, yc (float) : center of bbox whose values range from 0 to 1. |
| 121 | w, h (float) : size of bbox whose values range from 0 to 1. |
| 122 | info_img : tuple of h, w, nh, nw, dx, dy. |
| 123 | h, w (int): original shape of the image |
| 124 | nh, nw (int): shape of the resized image without padding |
| 125 | dx, dy (int): pad size |
| 126 | img_id (int): same as the input index. Used for evaluation. |
| 127 | """ |
| 128 | img, target, img_info, img_id = self.pull_item(index) |
| 129 | |
| 130 | if self.preproc is not None: |
| 131 | img, target = self.preproc(img, target, self.input_dim) |
| 132 | return img, target, img_info, img_id |