Skip to content

Commit 71885b0

Browse files
authored
Make CUB200 labels 0-indexed. (#6702)
CUB200 dataset in `torchvision.prototype.datasets` module formed labels using file paths. This resulted in labels being 1-indexed (1-200) instead of 0-indexed (0-199). Similar issue occurred with Flowers102 (`torchvision.datasets` module, #5766).
1 parent 3038cb2 commit 71885b0

File tree

1 file changed

+4
-1
lines changed
  • torchvision/prototype/datasets/_builtin

1 file changed

+4
-1
lines changed

torchvision/prototype/datasets/_builtin/cub200.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ def _prepare_sample(
177177
return dict(
178178
prepare_ann_fn(anns_data, image.image_size),
179179
image=image,
180-
label=Label(int(pathlib.Path(path).parent.name.rsplit(".", 1)[0]), categories=self._categories),
180+
label=Label(
181+
int(pathlib.Path(path).parent.name.rsplit(".", 1)[0]) - 1,
182+
categories=self._categories,
183+
),
181184
)
182185

183186
def _datapipe(self, resource_dps: List[IterDataPipe]) -> IterDataPipe[Dict[str, Any]]:

0 commit comments

Comments
 (0)