Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify image loading with dynamic config #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion video_chat2/dataset/base_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ def load_and_transform_media_data(self, index, data_path):
else:
return self.load_and_transform_media_data_video(index, data_path)

def load_and_transform_media_data_image(self, index, data_path):
def load_and_transform_media_data_image(self, index, data_path, dynamic_config=None):
image = load_image_from_path(data_path, client=self.client)
if dynamic_config:
local_size = dynamic_config["local_size"]
hd_num = dynamic_config["hd_num"]
padding = dynamic_config["padding"]
if padding:
image = HD_transform_padding(image.float(), image_size=local_size, hd_num=hd_num)
else:
image = HD_transform_no_padding(image.float(), image_size=local_size, hd_num=hd_num)
image = self.transform(image)
return image, index

Expand Down