-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
When running meshroom_batch with both the --save and --cache arguments in a single command, a nested cache directory is created (e.g., my_cache/my_cache). This occurs on the first execution, not on subsequent runs.
To Reproduce
Steps to reproduce the behavior:
-
Build Meshroom from source and navigate to the output directory containing the binaries (where meshroom_batch is located).
-
Create a subdirectory for images:
mkdir images && touch images/1.jpg -
Run meshroom_batch with both
--saveand--cachearguments:
./meshroom_batch -p photogrammetry -i ./images --save test.mg --cache test_cache -
Check the contents of the created cache directory. You will see the nested structure:
ls -R test_cache
Expected behavior
A single, non-nested cache directory should be created at the top level. The directory structure should look like this:
.
├── images/
├── test_cache/ <-- Single, top-level cache with computation results inside
└── test.mg
Instead, the actual result is test_cache/test_cache/.
Screenshots
Log
Due to an unexpectedly nested cache structure, the system fails to find the required files and cannot reference intermediate results.
ERROR:root:Error on node computation: [Errno 2] No such file or directory: 'test_cache/CameraInit/f14eab7591733466186ade10c12a536890ca3f2d/viewpoints.sfm'
WARNING:root:Downgrade status on node "Texturing_1" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "Meshing_1" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "DepthMapFilter_1(0)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "DepthMapFilter_1(1)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "ImageMatching_1" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "FeatureExtraction_1(0)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "StructureFromMotion_1" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "PrepareDenseScene_1(0)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "DepthMap_1(0)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "DepthMap_1(1)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "DepthMap_1(2)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "MeshFiltering_1" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "FeatureMatching_1(0)" from Status.SUBMITTED to Status.NONE
WARNING:root:Downgrade status on node "FeatureMatching_1(1)" from Status.SUBMITTED to Status.NONE
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
File "/opt/Meshroom/setupInitScriptUnix.py", line 42, in run
File "bin/meshroom_batch", line 228, in <module>
File "/opt/Meshroom/meshroom/core/graph.py", line 1584, in executeGraph
File "/opt/Meshroom/meshroom/core/node.py", line 411, in process
File "/opt/Meshroom/meshroom/nodes/aliceVision/CameraInit.py", line 469, in processChunk
File "/opt/Meshroom/meshroom/nodes/aliceVision/CameraInit.py", line 459, in createViewpointsFile
FileNotFoundError: [Errno 2] No such file or directory: 'test_cache/CameraInit/f14eab7591733466186ade10c12a536890ca3f2d/viewpoints.sfm'
Desktop (please complete the following and other pertinent information):
- OS: [Ubuntu 24.04]
- Python version [3.9.13]
- Meshroom version: please specify if you are using a release version or your own build
- Binary version [2023.3.0]
Additional context
1. Root Cause Analysis
The issue stems from a redundant graph.save() call at the beginning of the executeGraph() function in meshroom/core/graph.py.
The meshroom_batch script correctly calls graph.save(..., setupProjectFile=False) when the --cache argument is present, which avoids the automatic cache setup.
However, executeGraph() is then called and it immediately calls graph.save() again, this time with the default argument setupProjectFile=True.
This re-enables the automatic cache setup logic, which conflicts with the already configured cache path from the command line, resulting in the creation of a nested directory.
2. Proposed Solution
The bug can be fixed by changing the graph.save() call inside executeGraph() to explicitly use setupProjectFile=False. This preserves the functionality of saving progress without causing the path conflict.