コード例 #1
0
ファイル: tests.py プロジェクト: DLlearn/facefit
 def setUp(self):
     features = np.array([ [0, 1], [1, 2] ], dtype=int)
     bins = [
        [1, 2, 3, 4],
        [0, 0, 1, 1],
        [34, 33, 13, 134],
        [52, 42, 57, 21]
     ]
     thresholds = [ 10, 5]
     self.fern1 = Fern(2, features, np.array(bins), np.array(thresholds))
コード例 #2
0
class FernTest(unittest.TestCase):
    def setUp(self):
        features = np.array([[0, 1], [1, 2]], dtype=int)
        bins = [[1, 2, 3, 4], [0, 0, 1, 1], [34, 33, 13, 134],
                [52, 42, 57, 21]]
        thresholds = [10, 5]
        self.fern1 = Fern(2, features, np.array(bins), np.array(thresholds))

    def test_apply(self):
        test_cases = [{
            "pixels": [100, 14, 123],
            "result": [[34, 33], [13, 134]]
        }]

        for t in test_cases:
            ans = self.fern1.apply(np.array(t['pixels']))
            compare_arrays(self, ans, np.array(t['result']))
コード例 #3
0
ファイル: tests.py プロジェクト: DLlearn/facefit
class FernTest(unittest.TestCase):
    def setUp(self):
        features = np.array([ [0, 1], [1, 2] ], dtype=int)
        bins = [
           [1, 2, 3, 4],
           [0, 0, 1, 1],
           [34, 33, 13, 134],
           [52, 42, 57, 21]
        ]
        thresholds = [ 10, 5]
        self.fern1 = Fern(2, features, np.array(bins), np.array(thresholds))

    def test_apply(self):
        test_cases = [
            {
                "pixels": [100, 14, 123],
                "result": [[34, 33], [13, 134]]
            }
        ]

        for t in test_cases:
            ans = self.fern1.apply(np.array(t['pixels']))
            compare_arrays(self, ans, np.array(t['result']))
コード例 #4
0
 def setUp(self):
     features = np.array([[0, 1], [1, 2]], dtype=int)
     bins = [[1, 2, 3, 4], [0, 0, 1, 1], [34, 33, 13, 134],
             [52, 42, 57, 21]]
     thresholds = [10, 5]
     self.fern1 = Fern(2, features, np.array(bins), np.array(thresholds))