Skip to content

Commit b0d4721

Browse files
authored
Update README.md
1 parent 88f79e8 commit b0d4721

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This is the skeleton that you have to fill to have a custom dataset. A dataset m
3939
* `__init__()` function is where the initial logic happens like reading a csv, assigning transforms etc.
4040
* `__getitem__()` function returns the data and labels. This function is called from dataloader like this:
4141
```python
42-
img, label = CustomDataset.__getitem__(99) # For 99th item
42+
img, label = MyCustomDataset.__getitem__(99) # For 99th item
4343
```
4444
So, the index parameter is the **n**th data/image (as tensor) you are going to return.
4545

@@ -60,14 +60,14 @@ class MyCustomDataset(Dataset):
6060
def __init__(self, ..., transforms=None):
6161
# stuff
6262
...
63-
self.transform = transform
63+
self.transforms = transforms
6464

6565
def __getitem__(self, index):
6666
# stuff
6767
...
6868
data = # Some data read from a file or image
69-
if self.transform is not None:
70-
data = self.transform(data)
69+
if self.transforms is not None:
70+
data = self.transforms(data)
7171
# If the transform variable is not empty
7272
# then it applies the operations in the transforms with the order that it is created.
7373
return (img, label)
@@ -114,8 +114,8 @@ class MyCustomDataset(Dataset):
114114
data = self.center_crop(data) # (2)
115115
data = self.to_tensor(data) # (2)
116116

117-
# (3) Or you can call the composed version
118-
data = self.trasnformations(data)
117+
# Or you can call the composed version
118+
data = self.trasnformations(data) # (3)
119119

120120
# Note that you only need one of the implementations, (2) or (3)
121121
return (img, label)

0 commit comments

Comments
 (0)