(self, img)
| 80 | self.types = types |
| 81 | self.height = height |
| 82 | def __call__(self, img): |
| 83 | if (self.types == 'train' or self.types == 'val'): |
| 84 | w, h = img.size |
| 85 | img = img.resize((int(self.height / float(h) * w), self.height), Image.BILINEAR) |
| 86 | w, h = img.size |
| 87 | if (w < self.max_width): |
| 88 | img = Add_Padding(img, 0, 0, 0, self.max_width - w) |
| 89 | img = Image.fromarray(img) |
| 90 | else: |
| 91 | img = img.resize((self.max_width, self.height), Image.BILINEAR) |
| 92 | elif self.types == 'test': |
| 93 | w, h = img.size |
| 94 | img = img.resize((int(self.height / float(h) * w)//4*4, self.height), Image.BILINEAR) |
| 95 | img = self.toTensor(img) |
| 96 | img.sub_(0.5).div_(0.5) |
| 97 | return img |
| 98 | |
| 99 | class alignCollate(object): |
| 100 | def __init__(self, config,trans_type): |
nothing calls this directly
no test coverage detected