thinh-huynh-re
commited on
Commit
·
6e93e71
1
Parent(s):
12751a7
Upload processor
Browse files
image_processor_dptdepth.py
CHANGED
@@ -13,9 +13,10 @@ INPUT_IMAGE_SIZE = (352, 352)
|
|
13 |
transform = transforms.Compose(
|
14 |
[
|
15 |
transforms.Resize(
|
16 |
-
|
17 |
interpolation=TF.InterpolationMode.BICUBIC,
|
18 |
),
|
|
|
19 |
transforms.Normalize(
|
20 |
(0.5, 0.5, 0.5),
|
21 |
(0.5, 0.5, 0.5),
|
@@ -34,7 +35,8 @@ class DPTDepthImageProcessor(BaseImageProcessor):
|
|
34 |
def preprocess(
|
35 |
self, inputs: Dict[str, Image], **kwargs # {'rgb': ... }
|
36 |
) -> Dict[str, Tensor]:
|
37 |
-
|
|
|
38 |
|
39 |
def postprocess(
|
40 |
self, logits: Tensor, size: Tuple[int, int], **kwargs
|
|
|
13 |
transform = transforms.Compose(
|
14 |
[
|
15 |
transforms.Resize(
|
16 |
+
INPUT_IMAGE_SIZE,
|
17 |
interpolation=TF.InterpolationMode.BICUBIC,
|
18 |
),
|
19 |
+
transforms.ToTensor(),
|
20 |
transforms.Normalize(
|
21 |
(0.5, 0.5, 0.5),
|
22 |
(0.5, 0.5, 0.5),
|
|
|
35 |
def preprocess(
|
36 |
self, inputs: Dict[str, Image], **kwargs # {'rgb': ... }
|
37 |
) -> Dict[str, Tensor]:
|
38 |
+
rgb: Tensor = transform(inputs["rgb"])
|
39 |
+
return dict(rgb=rgb.unsqueeze(0))
|
40 |
|
41 |
def postprocess(
|
42 |
self, logits: Tensor, size: Tuple[int, int], **kwargs
|