We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e486c4 commit cbd572aCopy full SHA for cbd572a
docs/quickstarts/pytorch.mdx
@@ -182,8 +182,8 @@ def obj_to_tensor(obj):
182
# (Optional) derive label from the S3 key if applicable
183
key_path = obj.key # e.g. "train/images/7/img123.png"
184
# Assuming the directory name is the label (e.g. "7" for class 7):
185
- label_str = key_path.split("/")[1] # "7" in this example
186
- label = int(label_str) if label_str.isdigit() else label_str
+ # Assuming the directory name is the label (e.g. "7" for class 7):
+ label_str = key_path.split("/")[2] # "7" in this example
187
return tensor, label
188
```
189
0 commit comments