From 44547a520e0bdab4f17e8a464cff673944d18798 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 10:11:40 +0100 Subject: [PATCH 01/20] small adition to check file read on mac? --- test/test_sfm_process.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 6f8a31b..92f53cd 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -6,11 +6,13 @@ import pytest -@pytest.mark.skip("This test is flakey, needs a re-write") +# @pytest.mark.skip("This test is flakey, needs a re-write") def test_sfm_process_basic(): leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + assert len(leds) == 117, "failed to load all leds" + sfm = SFM(existing_leds=leds, max_fill=0) output_queue = Queue3D() @@ -33,6 +35,8 @@ def test_sfm_process_exit(): leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + assert len(leds) == 117, "failed to load all leds" + sfm = SFM(existing_leds=leds) output_queue = Queue3D() From 133528bf8053017fd5085d010a183068d4733eb5 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 10:37:28 +0100 Subject: [PATCH 02/20] adding print statements --- marimapper/sfm_process.py | 10 +++++++--- test/test_sfm_process.py | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/marimapper/sfm_process.py b/marimapper/sfm_process.py index 9635083..bc81b93 100644 --- a/marimapper/sfm_process.py +++ b/marimapper/sfm_process.py @@ -101,12 +101,14 @@ def run(self): needs_initial_reconstruction = len(self.leds_2d) > 0 update_info = True while not self._exit_event.is_set(): + print("looping") update_sfm = False print_overlap = False print_reconstructed = False while not self._input_queue.empty(): + print("items in input queue!") control, data = self._input_queue.get() if control == DetectionControlEnum.DETECT: @@ -129,9 +131,9 @@ def run(self): start_time = 0 end_sfm_time = 0 end_post_process_time = 0 - + print(f"len of leds {len(self.leds_2d)}") if (update_sfm or needs_initial_reconstruction) and len(self.leds_2d) > 0: - + print("update time baby!") start_time = time.time() self.leds_3d = sfm( self.leds_2d, @@ -139,7 +141,8 @@ def run(self): camera_fov=self._camera_fov, ) end_sfm_time = time.time() - + print(f"sfm complete with time of {end_sfm_time - start_time}") + print(f"len of leds {len(self.leds_3d)}") if len(self.leds_3d) > 0: rescale(self.leds_3d) @@ -150,6 +153,7 @@ def run(self): add_normals(self.leds_3d) for queue in self._output_queues: + print(f"sending to output queue: {queue}") queue.put(self.leds_3d) if update_info: diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 92f53cd..3e2df03 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -3,7 +3,6 @@ from marimapper.queues import Queue3D from utils import get_test_dir import time -import pytest # @pytest.mark.skip("This test is flakey, needs a re-write") From 4a6be6a2141e1f95e7027a6d46ce3a3d0e2a0621 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 10:43:25 +0100 Subject: [PATCH 03/20] logs plz --- .github/workflows/test_mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index b61926d..342cc5a 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -37,4 +37,4 @@ jobs: - name: Pytest run: | - pytest . \ No newline at end of file + pytest . -s \ No newline at end of file From f11775ee4fc721bb4af3e5eb1c4ab133f47ec357 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 10:57:34 +0100 Subject: [PATCH 04/20] oops --- .github/workflows/test_mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index 342cc5a..e4e96be 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -37,4 +37,4 @@ jobs: - name: Pytest run: | - pytest . -s \ No newline at end of file + pytest -s . \ No newline at end of file From f1d1615047623cb29385417887b1d0520710ca38 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:02:01 +0100 Subject: [PATCH 05/20] where is my print? --- .github/workflows/test_mac.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index e4e96be..1ebf22c 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -37,4 +37,4 @@ jobs: - name: Pytest run: | - pytest -s . \ No newline at end of file + pytest -s -v . \ No newline at end of file From 749c254909d50b72680911e42fca913659b27dd2 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:23:41 +0100 Subject: [PATCH 06/20] aaaaa --- marimapper/utils.py | 2 ++ test/test_sfm_process.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/marimapper/utils.py b/marimapper/utils.py index 52c1c01..ca05958 100644 --- a/marimapper/utils.py +++ b/marimapper/utils.py @@ -18,6 +18,7 @@ def get_user_confirmation(prompt): # pragma: no coverage class SupressLogging(object): def __enter__(self): + return self self.outnull_file = open(os.devnull, "w") self.errnull_file = open(os.devnull, "w") @@ -38,6 +39,7 @@ def __enter__(self): return self def __exit__(self, *_): + return self sys.stdout = self.old_stdout sys.stderr = self.old_stderr diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 3e2df03..3a4ee11 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -7,9 +7,9 @@ # @pytest.mark.skip("This test is flakey, needs a re-write") def test_sfm_process_basic(): - + print("starting test sfm process basic") leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) - + print("maps got") assert len(leds) == 117, "failed to load all leds" sfm = SFM(existing_leds=leds, max_fill=0) From 545cacbbe850126ef38890c4ed09877614fd75b3 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:29:02 +0100 Subject: [PATCH 07/20] what --- test/test_sfm_process.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 3a4ee11..9b6ef3e 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -8,26 +8,26 @@ # @pytest.mark.skip("This test is flakey, needs a re-write") def test_sfm_process_basic(): print("starting test sfm process basic") - leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) - print("maps got") - assert len(leds) == 117, "failed to load all leds" - - sfm = SFM(existing_leds=leds, max_fill=0) - - output_queue = Queue3D() - - sfm.add_output_queue(output_queue) - sfm.start() - - map_3d = output_queue.get(timeout=5) - - assert len(map_3d) == 21 - - sfm.stop() - timeout = time.time() + 5 - - while sfm.is_alive(): - assert time.time() < timeout, "sfm has failed to stop" + # leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + # print("maps got") + # assert len(leds) == 117, "failed to load all leds" + # + # sfm = SFM(existing_leds=leds, max_fill=0) + # + # output_queue = Queue3D() + # + # sfm.add_output_queue(output_queue) + # sfm.start() + # + # map_3d = output_queue.get(timeout=5) + # + # assert len(map_3d) == 21 + # + # sfm.stop() + # timeout = time.time() + 5 + # + # while sfm.is_alive(): + # assert time.time() < timeout, "sfm has failed to stop" def test_sfm_process_exit(): From 0a564e5f87e4adecf95a4608fee56cee498a8fd3 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:31:17 +0100 Subject: [PATCH 08/20] ??? --- marimapper/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/marimapper/utils.py b/marimapper/utils.py index ca05958..52c1c01 100644 --- a/marimapper/utils.py +++ b/marimapper/utils.py @@ -18,7 +18,6 @@ def get_user_confirmation(prompt): # pragma: no coverage class SupressLogging(object): def __enter__(self): - return self self.outnull_file = open(os.devnull, "w") self.errnull_file = open(os.devnull, "w") @@ -39,7 +38,6 @@ def __enter__(self): return self def __exit__(self, *_): - return self sys.stdout = self.old_stdout sys.stderr = self.old_stderr From 3e8905f2b74d704010205154a51139584dafb4cf Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:38:27 +0100 Subject: [PATCH 09/20] ? --- test/test_sfm_process.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 9b6ef3e..ca34155 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -8,15 +8,16 @@ # @pytest.mark.skip("This test is flakey, needs a re-write") def test_sfm_process_basic(): print("starting test sfm process basic") - # leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) - # print("maps got") - # assert len(leds) == 117, "failed to load all leds" - # - # sfm = SFM(existing_leds=leds, max_fill=0) - # - # output_queue = Queue3D() - # - # sfm.add_output_queue(output_queue) + print("\n") + leds = get_all_2d_led_maps(get_test_dir("MariMapper-Test-Data/9_point_box")) + print("maps got") + assert len(leds) == 117, "failed to load all leds" + + sfm = SFM(existing_leds=leds, max_fill=0) + + output_queue = Queue3D() + + sfm.add_output_queue(output_queue) # sfm.start() # # map_3d = output_queue.get(timeout=5) From 908f925c93186395c066aa141d18dc495c57472b Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:40:08 +0100 Subject: [PATCH 10/20] ???????????????????/ --- .github/workflows/test_mac.yml | 2 +- .github/workflows/test_ubuntu.yml | 40 ------------------------------ .github/workflows/test_windows.yml | 40 ------------------------------ test/test_sfm_process.py | 2 +- 4 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/test_ubuntu.yml delete mode 100644 .github/workflows/test_windows.yml diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index 1ebf22c..11fca17 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -18,7 +18,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test_ubuntu.yml deleted file mode 100644 index 52a2192..0000000 --- a/.github/workflows/test_ubuntu.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Ubuntu - -on: - push: - branches: [ "main" ] - paths-ignore: - - "README.md" - - "docs/**" - - "marimapper/scripts/**" - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11","3.12"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip cache purge - pip install .[develop] - - - name: Pytest - run: | - pytest . \ No newline at end of file diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml deleted file mode 100644 index 98e7580..0000000 --- a/.github/workflows/test_windows.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Windows - -on: - push: - branches: [ "main" ] - paths-ignore: - - "README.md" - - "docs/**" - - "marimapper/scripts/**" - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: windows-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip cache purge - pip install .[develop] - - - name: Pytest - run: | - pytest . \ No newline at end of file diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index ca34155..f5b4c38 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -18,7 +18,7 @@ def test_sfm_process_basic(): output_queue = Queue3D() sfm.add_output_queue(output_queue) - # sfm.start() + sfm.start() # # map_3d = output_queue.get(timeout=5) # From bf5081c63eed0cf164fb3e37f346cd41b9504179 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:42:46 +0100 Subject: [PATCH 11/20] ? --- marimapper/sfm_process.py | 4 +++- test/test_sfm_process.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/marimapper/sfm_process.py b/marimapper/sfm_process.py index bc81b93..e700150 100644 --- a/marimapper/sfm_process.py +++ b/marimapper/sfm_process.py @@ -64,6 +64,7 @@ def __init__( camera_model_name: str = camera_model_radial.__name__, camera_fov: int = 60, ): + print("initing sfm") super().__init__() self._input_queue: Queue2D = Queue2D() self._output_queues: list[Queue3D] = [] @@ -83,6 +84,7 @@ def __init__( self.leds_2d = existing_leds if existing_leds is not None else [] self.leds_3d: list[LED3D] = [] self.daemon = True + print("finished init sfm") def get_input_queue(self) -> Queue2D: return self._input_queue @@ -97,7 +99,7 @@ def stop(self): self._exit_event.set() def run(self): - + print("sfm running") needs_initial_reconstruction = len(self.leds_2d) > 0 update_info = True while not self._exit_event.is_set(): diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index f5b4c38..564f85d 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -19,6 +19,8 @@ def test_sfm_process_basic(): sfm.add_output_queue(output_queue) sfm.start() + time.sleep(2) + sfm.stop() # # map_3d = output_queue.get(timeout=5) # From 4142415545ce54c4e467094d8beb4cb3b0df39c6 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:44:46 +0100 Subject: [PATCH 12/20] ? --- test/test_sfm_process.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_sfm_process.py b/test/test_sfm_process.py index 564f85d..c006252 100644 --- a/test/test_sfm_process.py +++ b/test/test_sfm_process.py @@ -18,8 +18,11 @@ def test_sfm_process_basic(): output_queue = Queue3D() sfm.add_output_queue(output_queue) + print("here we go!") sfm.start() + print("done!") time.sleep(2) + print("stopping") sfm.stop() # # map_3d = output_queue.get(timeout=5) From 1b53da7700c5a68e226be298a8977c5f46a7af38 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:51:16 +0100 Subject: [PATCH 13/20] ????????? --- marimapper/sfm_process.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/marimapper/sfm_process.py b/marimapper/sfm_process.py index e700150..d16d3d5 100644 --- a/marimapper/sfm_process.py +++ b/marimapper/sfm_process.py @@ -9,7 +9,7 @@ last_view, combine_2d_3d, ) -from marimapper.sfm import sfm +# from marimapper.sfm import sfm from marimapper.database_populator import camera_models, camera_model_radial from marimapper.queues import Queue2D, Queue3D, DetectionControlEnum, Queue3DInfo import open3d @@ -137,11 +137,11 @@ def run(self): if (update_sfm or needs_initial_reconstruction) and len(self.leds_2d) > 0: print("update time baby!") start_time = time.time() - self.leds_3d = sfm( - self.leds_2d, - camera_model=self._camera_model, - camera_fov=self._camera_fov, - ) + # self.leds_3d = sfm( + # self.leds_2d, + # camera_model=self._camera_model, + # camera_fov=self._camera_fov, + # ) end_sfm_time = time.time() print(f"sfm complete with time of {end_sfm_time - start_time}") print(f"len of leds {len(self.leds_3d)}") From ec8687238fa94a1819e25266a5252c8ab7cf5279 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:55:19 +0100 Subject: [PATCH 14/20] ???????????????????????????????? --- .github/workflows/lint.yml | 40 -------------------------- marimapper/sfm.py | 57 +++----------------------------------- marimapper/sfm_process.py | 12 ++++---- 3 files changed, 10 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index a83d505..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Style - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - - name: Install flake - run: | - python -m pip install --upgrade pip - pip install flake8 - pip install flake8-bugbear - pip install black - - - name: Flake 8 Syntax Errors - run: | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - - name: Flake 8 Syntax Warnings - run: | - flake8 . --count --statistics - - - name: Black formatting - run: | - black . --check \ No newline at end of file diff --git a/marimapper/sfm.py b/marimapper/sfm.py index 07abea9..d75e954 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -1,7 +1,9 @@ +# it's something in heeeere from pathlib import Path from tempfile import TemporaryDirectory +print("importing pycolmap") import pycolmap - +print("pycolmap imported!") from marimapper.database_populator import ( populate_database, camera_model_radial, @@ -20,55 +22,4 @@ def sfm( camera_model: camera_model_type = camera_model_radial, camera_fov: int = 60, ) -> list[LED3D]: - # if no leds, don't bother - if len(leds_2d) == 0: - logger.debug("no leds :(") - return [] - - logger.debug("Reconstructing science...") - - # also if we're just on 1 view, don't bother - if len(get_view_ids(leds_2d)) <= 1: - logger.debug("<= 1 view :(") - return [] - - with TemporaryDirectory() as temp_dir: - database_path = Path(temp_dir, "database.db") - - populate_database(database_path, leds_2d, camera_model, camera_fov) - - options = pycolmap.IncrementalPipelineOptions() - options.triangulation.ignore_two_view_tracks = False # used to be true - options.min_num_matches = 9 # default 15 - options.mapper.abs_pose_min_num_inliers = 9 # default 30 - options.mapper.init_min_num_inliers = 50 # used to be 100 - - with SupressLogging(): - pycolmap.incremental_mapping( - database_path=database_path, - image_path=temp_dir, - output_path=temp_dir, - options=options, - ) - - # NOTE! - # There might be more map folders than just "0", however this is the base section and only the one we're - # interested in at the moment. We could iterate through all avaliable maps - # However I think it might be misleading or confusing as they will appear with no relative transform. - # Because of this, lots of existing functionality like inter-led distance might break - # Leaving it out for now but perhaps something to come back to. - - leds_3d = [] - for map_id in range(0, 10): - if not Path(temp_dir, f"{map_id}", "points3D.bin").exists(): - break - - new_map = binary_to_led_map_3d(Path(temp_dir)) - - logger.debug( - f"sfm managed to reconstruct {len(new_map)} leds in map {map_id}" - ) - - leds_3d = new_map if len(new_map) > len(leds_3d) else leds_3d - - return leds_3d + return [] \ No newline at end of file diff --git a/marimapper/sfm_process.py b/marimapper/sfm_process.py index d16d3d5..e700150 100644 --- a/marimapper/sfm_process.py +++ b/marimapper/sfm_process.py @@ -9,7 +9,7 @@ last_view, combine_2d_3d, ) -# from marimapper.sfm import sfm +from marimapper.sfm import sfm from marimapper.database_populator import camera_models, camera_model_radial from marimapper.queues import Queue2D, Queue3D, DetectionControlEnum, Queue3DInfo import open3d @@ -137,11 +137,11 @@ def run(self): if (update_sfm or needs_initial_reconstruction) and len(self.leds_2d) > 0: print("update time baby!") start_time = time.time() - # self.leds_3d = sfm( - # self.leds_2d, - # camera_model=self._camera_model, - # camera_fov=self._camera_fov, - # ) + self.leds_3d = sfm( + self.leds_2d, + camera_model=self._camera_model, + camera_fov=self._camera_fov, + ) end_sfm_time = time.time() print(f"sfm complete with time of {end_sfm_time - start_time}") print(f"len of leds {len(self.leds_3d)}") From 100c38f677323b379429242c5e298cc8e558b2b6 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 11:59:52 +0100 Subject: [PATCH 15/20] whattttt --- marimapper/sfm.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/marimapper/sfm.py b/marimapper/sfm.py index d75e954..b150769 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -22,4 +22,55 @@ def sfm( camera_model: camera_model_type = camera_model_radial, camera_fov: int = 60, ) -> list[LED3D]: - return [] \ No newline at end of file + # if no leds, don't bother + if len(leds_2d) == 0: + logger.debug("no leds :(") + return [] + + logger.debug("Reconstructing science...") + + # also if we're just on 1 view, don't bother + if len(get_view_ids(leds_2d)) <= 1: + logger.debug("<= 1 view :(") + return [] + + with TemporaryDirectory() as temp_dir: + database_path = Path(temp_dir, "database.db") + + populate_database(database_path, leds_2d, camera_model, camera_fov) + + options = pycolmap.IncrementalPipelineOptions() + options.triangulation.ignore_two_view_tracks = False # used to be true + options.min_num_matches = 9 # default 15 + options.mapper.abs_pose_min_num_inliers = 9 # default 30 + options.mapper.init_min_num_inliers = 50 # used to be 100 + + # with SupressLogging(): + # pycolmap.incremental_mapping( + # database_path=database_path, + # image_path=temp_dir, + # output_path=temp_dir, + # options=options, + # ) + + # NOTE! + # There might be more map folders than just "0", however this is the base section and only the one we're + # interested in at the moment. We could iterate through all avaliable maps + # However I think it might be misleading or confusing as they will appear with no relative transform. + # Because of this, lots of existing functionality like inter-led distance might break + # Leaving it out for now but perhaps something to come back to. + + leds_3d = [] + for map_id in range(0, 10): + if not Path(temp_dir, f"{map_id}", "points3D.bin").exists(): + break + + new_map = binary_to_led_map_3d(Path(temp_dir)) + + logger.debug( + f"sfm managed to reconstruct {len(new_map)} leds in map {map_id}" + ) + + leds_3d = new_map if len(new_map) > len(leds_3d) else leds_3d + + return leds_3d From e85929d2a6781ffa6caeed339da505d4a5882ea4 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 12:04:28 +0100 Subject: [PATCH 16/20] whattttt --- .github/workflows/test_mac.yml | 2 +- marimapper/sfm.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index 11fca17..57a0f99 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -37,4 +37,4 @@ jobs: - name: Pytest run: | - pytest -s -v . \ No newline at end of file + pytest -s -v test/test_sfm_process.py \ No newline at end of file diff --git a/marimapper/sfm.py b/marimapper/sfm.py index b150769..dc2e5c4 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -45,13 +45,14 @@ def sfm( options.mapper.abs_pose_min_num_inliers = 9 # default 30 options.mapper.init_min_num_inliers = 50 # used to be 100 - # with SupressLogging(): - # pycolmap.incremental_mapping( - # database_path=database_path, - # image_path=temp_dir, - # output_path=temp_dir, - # options=options, - # ) + # I think what's happening here is that this is spinning up a thread which is crashing the forked process https://github.com/python/cpython/issues/77906 + with SupressLogging(): + pycolmap.incremental_mapping( + database_path=database_path, + image_path=temp_dir, + output_path=temp_dir, + options=options, + ) # NOTE! # There might be more map folders than just "0", however this is the base section and only the one we're From e3993ef56416dc8b4a674fb43facc819f2253437 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 12:07:27 +0100 Subject: [PATCH 17/20] whattttt --- marimapper/sfm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/marimapper/sfm.py b/marimapper/sfm.py index dc2e5c4..f439fb4 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -46,7 +46,8 @@ def sfm( options.mapper.init_min_num_inliers = 50 # used to be 100 # I think what's happening here is that this is spinning up a thread which is crashing the forked process https://github.com/python/cpython/issues/77906 - with SupressLogging(): + # Aaaah if this sig sevs then it got caught by the handler + if True: pycolmap.incremental_mapping( database_path=database_path, image_path=temp_dir, From 56237297b7ba98413412c8add826ca323c1d0c26 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 12:12:51 +0100 Subject: [PATCH 18/20] I'm gonna give up soon --- .github/workflows/test_mac.yml | 2 +- marimapper/sfm.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_mac.yml b/.github/workflows/test_mac.yml index 57a0f99..585c79a 100644 --- a/.github/workflows/test_mac.yml +++ b/.github/workflows/test_mac.yml @@ -18,7 +18,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ["3.9"] + python-version: ["3.9","3.10"] steps: - uses: actions/checkout@v4 diff --git a/marimapper/sfm.py b/marimapper/sfm.py index f439fb4..3d5662b 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -39,6 +39,9 @@ def sfm( populate_database(database_path, leds_2d, camera_model, camera_fov) + print(f"database_path: {database_path}") + print(f"temp_dir: {temp_dir}") + options = pycolmap.IncrementalPipelineOptions() options.triangulation.ignore_two_view_tracks = False # used to be true options.min_num_matches = 9 # default 15 From 938a6be25cd7ff52849ad8e35c68bbdbbc98d494 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 12:16:30 +0100 Subject: [PATCH 19/20] waaaa --- marimapper/sfm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/marimapper/sfm.py b/marimapper/sfm.py index 3d5662b..6d45efe 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -57,6 +57,7 @@ def sfm( output_path=temp_dir, options=options, ) + print("sfm done!!!!") # NOTE! # There might be more map folders than just "0", however this is the base section and only the one we're From 70d7d3a3834c014db8887084c2be0301f4045a33 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 7 May 2025 12:27:56 +0100 Subject: [PATCH 20/20] ??????????? --- marimapper/sfm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/marimapper/sfm.py b/marimapper/sfm.py index 6d45efe..6e1fcf7 100644 --- a/marimapper/sfm.py +++ b/marimapper/sfm.py @@ -39,8 +39,8 @@ def sfm( populate_database(database_path, leds_2d, camera_model, camera_fov) - print(f"database_path: {database_path}") - print(f"temp_dir: {temp_dir}") + logger.error(f"database_path: {database_path}") + logger.error(f"temp_dir: {temp_dir}") options = pycolmap.IncrementalPipelineOptions() options.triangulation.ignore_two_view_tracks = False # used to be true @@ -57,7 +57,7 @@ def sfm( output_path=temp_dir, options=options, ) - print("sfm done!!!!") + logger.error("sfm done!!!!") # NOTE! # There might be more map folders than just "0", however this is the base section and only the one we're