For some reason I am getting this message:
self = reduction.pickle.load(from_parent)
AttributeError: Can't get attribute 'CassDataset' on <module '__main__' (built-in)>
in my terminal but not in my jupyter notebook. I am not sure what it even telling me.
It is referencing my dataset class CassDataset. The code for that class is:
class CassDataset(Dataset):
def __init__(self, Dir, FNames, Labels, Transform):
self.dir = Dir
self.fnames = FNames
self.transform = Transform
self.lbs = Labels
def __len__(self):
return len(self.fnames)
def __getitem__(self, index):
x = Image.open(os.path.join(self.dir, self.fnames[index]))
if "train" in self.dir:
res = self.transform(image=asarray(x))
image = res['image'].astype(np.float32)
return image, self.lbs[index]
elif "test" in self.dir:
return self.transform(image=asarray(x)), self.fnames[index]
And here are some of my model parameters:
model_ft = models.resnet18(pretrained=True)
num_ftrs = model_ft.fc.in_features
# Here the size of each output sample is set to 2.
# Alternatively, it can be generalized to nn.Linear(num_ftrs, len(class_names)).
model_ft.fc = nn.Linear(num_ftrs, 5)
#model_ft = model_ft.to(device)
criterion = nn.CrossEntropyLoss()
# Observe that all parameters are being optimized
optimizer_ft = optim.SGD(model_ft.parameters(), lr=1e-2, momentum=0.9)