You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running a python code on jupyter notebook and encounter the error "AttributeError: 'numpy.int64' object has no attribute 'read'". I have already searched it a lot but there is nothing available related to "read". I am attaching the code and the SS of the error. Anyone who can help will be really appreciated.
model = models.resnet18(pretrained = True)
num_ftrs = model.fc.in_features
model.fc = nn.Linear(num_ftrs, 2)
model.load_state_dict(torch.load('2_stage_model.pt'))
model.eval()
classes = ('Flowers', 'No_Flowers')
class_probs = []
class_preds = []
with torch.no_grad():
for data in testloader:
images = data
output = model(images)
images = data
output = model(images)
class_probs_batch = [F.softmax(el, dim=0) for el in output]
_, class_preds_batch = torch.max(output, 1)
I am running a python code on jupyter notebook and encounter the error "AttributeError: 'numpy.int64' object has no attribute 'read'". I have already searched it a lot but there is nothing available related to "read". I am attaching the code and the SS of the error. Anyone who can help will be really appreciated.
model = models.resnet18(pretrained = True)
num_ftrs = model.fc.in_features
model.fc = nn.Linear(num_ftrs, 2)
model.load_state_dict(torch.load('2_stage_model.pt'))
model.eval()
classes = ('Flowers', 'No_Flowers')
class_probs = []
class_preds = []
with torch.no_grad():
for data in testloader:
images = data
output = model(images)
images = data
output = model(images)
class_probs_batch = [F.softmax(el, dim=0) for el in output]
_, class_preds_batch = torch.max(output, 1)
test_probs = torch.cat([torch.stack(batch) for batch in class_probs])
test_preds = torch.cat(class_preds)
The text was updated successfully, but these errors were encountered: