Skip to content

Commit

Permalink
Merge pull request #96 from pphuc25/reformat_init
Browse files Browse the repository at this point in the history
reformat: change init transform to out of loop
  • Loading branch information
liuzhuang13 authored Nov 29, 2023
2 parents 95d27c7 + 6bf5975 commit c6a47d6
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 c6a47d6

Please sign in to comment.