Skip to content

Commit

Permalink
reformat: change init transform to out of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
pphuc25 committed Oct 16, 2023
1 parent 95d27c7 commit 6bf5975
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions imagebind/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,22 @@ def load_and_transform_vision_data(image_paths, device):
return None

image_outputs = []

data_transform = transforms.Compose(
[
transforms.Resize(
224, interpolation=transforms.InterpolationMode.BICUBIC
),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(
mean=(0.48145466, 0.4578275, 0.40821073),
std=(0.26862954, 0.26130258, 0.27577711),
),
]
)

for image_path in image_paths:
data_transform = transforms.Compose(
[
transforms.Resize(
224, interpolation=transforms.InterpolationMode.BICUBIC
),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(
mean=(0.48145466, 0.4578275, 0.40821073),
std=(0.26862954, 0.26130258, 0.27577711),
),
]
)
with open(image_path, "rb") as fopen:
image = Image.open(fopen).convert("RGB")

Expand Down

0 comments on commit 6bf5975

Please sign in to comment.