def test_allTruePos(self): npTestImgTruth1 = np.ones((3, 3)) npTestImgGen1 = np.ones((3, 3)) npError = Error.ConfMatrix(npTestImgTruth1, npTestImgGen1) npExpectError = [0, 0, 0, 9] self.assertEqual(npExpectError[0], npError[0]) self.assertEqual(npExpectError[1:], npError[1:])
def test_allTrueNeg(self): npTestImgTruth1 = np.zeros((3, 3)) npTestImgGen1 = np.zeros((3, 3)) npError = Error.ConfMatrix(npTestImgTruth1, npTestImgGen1) npExpectError = [9, 0, 0, 0] self.assertEqual(npExpectError[0], npError[0]) self.assertEqual(npExpectError[1:], npError[1:])
def test_mixed(self): npTestImgTruth1 = np.array([[0, 0, 1], [0, 0, 1], [1, 0, 1]]) npTestImgGen1 = np.array([[0, 0, 1], [1, 1, 0], [0, 0, 0]]) npError = Error.ConfMatrix(npTestImgTruth1, npTestImgGen1) #tn, fp, fn, tp npExpectError = [3, 2, 3, 1] self.assertEqual(npExpectError[0], npError[0]) self.assertEqual(npExpectError[1:], npError[1:])