Browse Source
Update
Signed-off-by: shiyu22 <shiyu.chen@zilliz.com>
main
1 changed files with
4 additions and
4 deletions
-
transform_image.py
|
@ -54,9 +54,9 @@ class TransformImage(Operator): |
|
|
(`torch.Tensor`) |
|
|
(`torch.Tensor`) |
|
|
The normalized image tensor. |
|
|
The normalized image tensor. |
|
|
""" |
|
|
""" |
|
|
if isinstance(img, str): |
|
|
|
|
|
img_tensor = Image.open(img) |
|
|
|
|
|
if isinstance(img, Image.Image): |
|
|
|
|
|
img_tensor = img.convert('RGB') |
|
|
|
|
|
|
|
|
if isinstance(img_path, str): |
|
|
|
|
|
img_tensor = Image.open(img_path) |
|
|
|
|
|
if isinstance(img_path, Image.Image): |
|
|
|
|
|
img_tensor = img_path.convert('RGB') |
|
|
Outputs = NamedTuple('Outputs', [('img_transformed', torch.Tensor)]) |
|
|
Outputs = NamedTuple('Outputs', [('img_transformed', torch.Tensor)]) |
|
|
return Outputs(self.tfms(img_tensor).unsqueeze(0)) |
|
|
return Outputs(self.tfms(img_tensor).unsqueeze(0)) |
|
|