| 36 | self.max_wh_ratio = self.image_shape[1] / self.image_shape[0] |
| 37 | |
| 38 | def merge_ext_data(self, data, ext_data): |
| 39 | ori_w = round(data['image'].shape[1] / data['image'].shape[0] * self.image_shape[0]) |
| 40 | ext_w = round(ext_data['image'].shape[1] / ext_data['image'].shape[0] * self.image_shape[0]) |
| 41 | data['image'] = cv2.resize(data['image'], (ori_w, self.image_shape[0])) |
| 42 | ext_data['image'] = cv2.resize(ext_data['image'], (ext_w, self.image_shape[0])) |
| 43 | data['image'] = np.concatenate([data['image'], ext_data['image']], axis=1) |
| 44 | data["label"] += ext_data["label"] |
| 45 | return data |
| 46 | |
| 47 | def __call__(self, data): |
| 48 | rnd_num = random.random() |