a | b/Preprocessing/preprocessing.py | ||
---|---|---|---|
1 | import cv2 |
||
2 | import torch |
||
3 | |||
4 | |||
5 | class Preprocessor: |
||
6 | def __init__(self, width, height, inter=cv2.INTER_AREA): |
||
7 | self.width = width |
||
8 | self.height = height |
||
9 | self.inter = inter |
||
10 | |||
11 | def preprocess(self, image): |
||
12 | image = image / 255 |
||
13 | image = cv2.resize(image, (self.width, self.height), interpolation=self.inter) |
||
14 | # image = torch.from_numpy(image) |
||
15 | return image |