For accuracy_multi we apply the sigmoid to our activations (to make them between 0 and 1), we need to decide which ones are 0s and which ones are 1s by picking a threshold. Each value above the threshold will be considered as a 1, and each value lower than the threshold will be considered a 0:
def accuracy_multi(inp, targ, thresh=0.5, sigmoid=True): "Compute accuracy when `inp` and `targ` are the same size." if sigmoid: inp = inp.sigmoid() return ((inp>thresh)==targ.bool()).float().mean()
^^^From lectures, what i dont understand is where in this code does it say to only compute
targ are the same size ? Also what if they aren’t the same size
i.e Model recognises 1 image while target has 2 predictions by not calculating accuracy on this aren’t we losing valuable data ?