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

Fix a couple of bugs #6

Open
wants to merge 2 commits into
base: master
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
6 changes: 3 additions & 3 deletions dataloader_pth.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def __init__(self,
for aug in augmentation_list:
self.augmentation_list.append(self.augmentations[aug])
trainform, testform = self.transform()
self.target_transform = self.to_binary
self.build_train_dataset(trainform)
self.build_val_dataset(trainform)
self.build_test_dataset(testform)
self.target_transform = self.to_binary

def list_dataset_variants(self):
print(self.list_dataset_variant)
Expand Down Expand Up @@ -196,7 +196,7 @@ class T50(Dataset):
def __init__(self, img_dir, label_file, transform=None, target_transform=None):
label_data = json.load(open(label_file, "rb"))
self.label_data = label_data["annotations"]
self.frames = self.label_data.keys()
self.frames = list(self.label_data.keys())
self.img_dir = img_dir
self.transform = transform
self.target_transform = target_transform
Expand Down Expand Up @@ -229,7 +229,7 @@ def get_binary_labels(self, labels):
return (triplet_label, tool_label, verb_label, target_label, phase_label)

def __getitem__(self, index):
labels = self.label_data["annotations"][self.frames[index]]
labels = self.label_data[self.frames[index]]
basename = "{}.png".format(str(self.frames[index]).zfill(6))
img_path = os.path.join(self.img_dir, basename)
image = Image.open(img_path)
Expand Down