(self, image, cvt_type='RGB')
| 13 | self.seq_len = seq_len |
| 14 | |
| 15 | def _pillow_convert(self, image, cvt_type='RGB'): |
| 16 | if image.mode != cvt_type: |
| 17 | if image.mode == 'P': |
| 18 | image = image.convert(f'{cvt_type}A') |
| 19 | if image.mode == f'{cvt_type}A': |
| 20 | bg = Image.new( |
| 21 | cvt_type, |
| 22 | size=(image.width, image.height), |
| 23 | color=(255, 255, 255)) |
| 24 | bg.paste(image, (0, 0), mask=image) |
| 25 | image = bg |
| 26 | else: |
| 27 | image = image.convert(cvt_type) |
| 28 | return image |
| 29 | |
| 30 | def _load_image(self, img_path): |
| 31 | if img_path is None or img_path == '': |