Loading autocnet/matcher/cpu_matcher.py +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ def match(edge, k=2, **kwargs): matches : dataframe A dataframe of matches """ if edge.matches is None: if edge.matches.empty: edge.matches = matches else: df = edge.matches Loading autocnet/matcher/tests/test_matcher.py +47 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import cv2 from .. import cpu_matcher from autocnet.examples import get_path from autocnet.graph.network import CandidateGraph sys.path.append(os.path.abspath('..')) Loading Loading @@ -38,5 +39,51 @@ class TestMatcher(unittest.TestCase): self.assertEqual(len(w), 1) self.assertEqual(w[0].category, UserWarning) def test_cpu_match(self): # Build a graph adjacency = get_path('two_image_adjacency.json') basepath = get_path('Apollo15') cang = CandidateGraph.from_adjacency(adjacency, basepath=basepath) # Extract features cang.extract_features(extractor_parameters={'nfeatures': 700}) # Make sure cpu matcher is used for test edges = list() from autocnet.matcher.cpu_matcher import match as match for s, d in cang.edges(): cang[s][d]._match = match edges.append(cang[s][d]) # Assert none of the edges have masks yet for edge in edges: self.assertTrue(edge.masks.empty) # Match & outlier detect cang.match() cang.symmetry_checks() # Grab the length of a matches df match_len = len(edges[0].matches.index) # Assert symmetry check is now in all edge masks for edge in edges: self.assertTrue('symmetry' in edge.masks) # Assert matches have been populated for edge in edges: self.assertTrue(not edge.matches.empty) # Re-match cang.match() # Assert that new matches have been added on to old ones self.assertEqual(len(edges[0].matches.index), match_len * 2) # Assert that the match cleared the masks df for edge in edges: self.assertTrue(edge.masks.empty) def tearDown(self): pass Loading
autocnet/matcher/cpu_matcher.py +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ def match(edge, k=2, **kwargs): matches : dataframe A dataframe of matches """ if edge.matches is None: if edge.matches.empty: edge.matches = matches else: df = edge.matches Loading
autocnet/matcher/tests/test_matcher.py +47 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import cv2 from .. import cpu_matcher from autocnet.examples import get_path from autocnet.graph.network import CandidateGraph sys.path.append(os.path.abspath('..')) Loading Loading @@ -38,5 +39,51 @@ class TestMatcher(unittest.TestCase): self.assertEqual(len(w), 1) self.assertEqual(w[0].category, UserWarning) def test_cpu_match(self): # Build a graph adjacency = get_path('two_image_adjacency.json') basepath = get_path('Apollo15') cang = CandidateGraph.from_adjacency(adjacency, basepath=basepath) # Extract features cang.extract_features(extractor_parameters={'nfeatures': 700}) # Make sure cpu matcher is used for test edges = list() from autocnet.matcher.cpu_matcher import match as match for s, d in cang.edges(): cang[s][d]._match = match edges.append(cang[s][d]) # Assert none of the edges have masks yet for edge in edges: self.assertTrue(edge.masks.empty) # Match & outlier detect cang.match() cang.symmetry_checks() # Grab the length of a matches df match_len = len(edges[0].matches.index) # Assert symmetry check is now in all edge masks for edge in edges: self.assertTrue('symmetry' in edge.masks) # Assert matches have been populated for edge in edges: self.assertTrue(not edge.matches.empty) # Re-match cang.match() # Assert that new matches have been added on to old ones self.assertEqual(len(edges[0].matches.index), match_len * 2) # Assert that the match cleared the masks df for edge in edges: self.assertTrue(edge.masks.empty) def tearDown(self): pass