Skip to content
Permalink
f3b3f10520
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
22 lines (20 sloc) 685 Bytes
from cnn import CNNNetwork
import torch
from sounds import sounds
from sklearn.metrics import accuracy_score, f1_score, confusion_matrix
def predict(model, input, target, classmap):
model.eval()
with torch.no_grad():
predictions = model(input)
predictedInd = predictions[0].argmax(0)
predicted = classmap[predictedInd]
expected = classmap[target]
return predicted, expected
def _predict(model, input, classmap):
model.eval()
with torch.no_grad():
predictions = model(input)
predictedInd = predictions[0].argmax(0)
predicted = classmap[predictedInd]
#expected = classmap[target]
return predicted