Datasets:
mickylan2367
commited on
Commit
·
edbba0c
1
Parent(s):
ab14b79
Update README Code
Browse files
README.md
CHANGED
@@ -29,9 +29,9 @@ from torch.utils.data import DataLoader
|
|
29 |
|
30 |
def load_datasets():
|
31 |
data_transforms = [
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
]
|
36 |
data_transform = transforms.Compose(data_transforms)
|
37 |
|
@@ -40,9 +40,9 @@ def load_datasets():
|
|
40 |
# validation = load_dataset("mickylan2367/spectrogram", split="validation")
|
41 |
|
42 |
for idx in range(len(train["image"])):
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
train = Dataset.from_dict(train)
|
48 |
# test = Dataset.from_dict(test)
|
|
|
29 |
|
30 |
def load_datasets():
|
31 |
data_transforms = [
|
32 |
+
transforms.Resize((IMG_SIZE, IMG_SIZE)),
|
33 |
+
transforms.ToTensor(), # Scales data into [0,1]
|
34 |
+
transforms.Lambda(lambda t: (t * 2) - 1) # Scale between [-1, 1]
|
35 |
]
|
36 |
data_transform = transforms.Compose(data_transforms)
|
37 |
|
|
|
40 |
# validation = load_dataset("mickylan2367/spectrogram", split="validation")
|
41 |
|
42 |
for idx in range(len(train["image"])):
|
43 |
+
train["image"][idx] = data_transform(train["image"][idx])
|
44 |
+
# test["image"][idx] = data_transform(test["image"][idx])
|
45 |
+
# validation["image"][idx] = data_transform(validation["image"][idx])
|
46 |
|
47 |
train = Dataset.from_dict(train)
|
48 |
# test = Dataset.from_dict(test)
|