def testFiveClasses0(self):
        segm = np.array([[1,2,3,4,3], [0,0,0,0,0]])
        gt   = np.array([[1,0,3,0,0], [0,0,0,0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, (5.0+1.0+1.0)/(8.0+1.0+1.0))
    def testFourClasses1(self):
        segm = np.array([[1,2,3,0,0], [0,0,0,0,0]])
        gt   = np.array([[1,0,0,0,0], [0,0,0,0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, (7.0+1.0)/(9.0+1.0))
    def testThreeClasses1(self):
        segm = np.array([[0,2,0,0,0], [0,0,0,0,0]])
        gt   = np.array([[1,0,0,0,0], [0,0,0,0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, (8.0+0.0)/(9.0+1.0))
    def testTwoClasses1(self):
        segm = np.array([[1,0,0,0,0], [0,0,0,0,0]])
        gt   = np.array([[0,0,0,0,0], [0,0,0,0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, (9.0)/(10.0))
    def testTwoClasses0(self):
        segm = np.array([[1,1,1,1,1], [1,1,1,1,1]])
        gt   = np.array([[0,0,0,0,0], [0,0,0,0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, 0)
    def testOneClass(self):
        segm = np.array([[0,0], [0,0]])
        gt   = np.array([[0,0], [0,0]])

        res = es.pixel_accuracy(segm, gt)
        self.assertEqual(res, 1.0)