Skip to content

Commit

Permalink
fix for missing sugar-crepe example
Browse files Browse the repository at this point in the history
  • Loading branch information
samarth4149 committed Feb 2, 2024
1 parent 5f23a76 commit 16020ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clip_benchmark/datasets/sugar_crepe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ def __init__(self, root, ann_file, transform=None):
self.root = root
self.ann = json.load(open(ann_file))
self.transform = transform
self.idx_strings = list(self.ann.keys()) # NOTE : indices may be non-contiguous

def __getitem__(self, idx):
data = self.ann[str(idx)]
idx_str = self.idx_strings[idx]
data = self.ann[idx_str]
img = Image.open(os.path.join(self.root, data['filename']))
if self.transform is not None:
img = self.transform(img)
Expand Down

0 comments on commit 16020ac

Please sign in to comment.