worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.44k stars 1.44k forks source link

AttributeError: 'numpy.int64' object has no attribute 'read' #279

Open muradali4442 opened 2 years ago

muradali4442 commented 2 years ago

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_probsbatch = [F.softmax(el, dim=0) for el in output] , class_preds_batch = torch.max(output, 1) SS_numpy int64

    class_probs.append(class_probs_batch)
    class_preds.append(class_preds_batch)

test_probs = torch.cat([torch.stack(batch) for batch in class_probs]) test_preds = torch.cat(class_preds)