mirror of
https://github.com/facebookresearch/ImageBind.git
synced 2023-12-02 12:22:10 +03:00
Merge pull request #96 from pphuc25/reformat_init
reformat: change init transform to out of loop
This commit is contained in:
@@ -80,20 +80,22 @@ def load_and_transform_vision_data(image_paths, device):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
image_outputs = []
|
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:
|
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:
|
with open(image_path, "rb") as fopen:
|
||||||
image = Image.open(fopen).convert("RGB")
|
image = Image.open(fopen).convert("RGB")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user