Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Code For new Plugin System #30

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "mrrs/deep_mvs/robust_mvd/robustmvd"]
path = mrrs/deep_mvs/robust_mvd/robustmvd
url = https://github.com/lmb-freiburg/robustmvd
[submodule "mrrs/implicit_mesh/instant_ngp/instant-ngp"]
path = mrrs/implicit_mesh/instant_ngp/instant-ngp
url = https://github.com/NVlabs/instant-ngp.git
[submodule "mrrs/depth_maps/vismvsnet/Vis-MVSNet"]
path = mrrs/depth_maps/vismvsnet/Vis-MVSNet
[submodule "mrrs/deep_depth_map/Vis-MVSNet"]
path = mrrs/deep_depth_map/Vis-MVSNet
url = https://github.com/jzhangbs/Vis-MVSNet
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ pip install -e ./MeshroomResearch

Contributions to Meshroom-Research are welcomed! Here's a quick overview of the project structure:

- `mrrs/core`: Basic IOs, utilities, and common geometrical functions.
- `mrrs/pipeline`: Meshroom pipeline files.
- `mrrs/scripts`: Scripts, including benchmarking tools.
- `mrrs/nodes`: Interface nodes for integration into Meshroom.
- `mrrs/<feature>`: Code related to specific features.
- `mrrs/core`: The library side of MRRS, it contains basic IOs, utilities, and common geometrical functions to be used in other plugins. /!\ Your plugin needs to handle the install and the dependencies.
- `mrrs/<feature_plugin>`: Contains the code and the nodes related to a plugin feature.
- `mrrs/meshrooPlugin.json`: Contains the list of plugins in this collection.

Utilize Meshroom's nodal UI for seamless integration, and refer to the [Meshroom's repo](https://github.com/alicevision/Meshroom) for creating custom nodes. We've introduced new types of node (eg. PluginNode and DockerNode), which automates environment management for your convenience.

See meshroom's [plugin documentation](https://github.com/alicevision/Meshroom/tree/dev/plugin_system/meshroom/core) to leanrn how to make your own plugins.

Utilize Meshroom's nodal UI for seamless integration, and refer to the [Meshroom's repo](https://github.com/alicevision/Meshroom) for creating custom nodes. We've introduced a new type of node, CondaNode, which automates Conda environment management for your convenience.
45 changes: 45 additions & 0 deletions meshroomPlugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting issue: a tab '\t' is used as indentation before the first element, whereas spaces are used in the rest of the document.
Fix suggestion: replace the tab with spaces to preserve consistency.

"pluginName":"3DR_Benchmark",
"nodesFolder":"mrrs/3DR_benchmark",
"pipelineFolder":"mrrs/3DR_benchmark/pipelines"
},
{
"pluginName":"Blender",
"nodesFolder":"mrrs/blender"
},
{
"pluginName":"Colmap",
"nodesFolder":"mrrs/colmap",
"pipelineFolder":"mrrs/colmap/pipelines"
},
{
"pluginName":"Gaussian_Splatting",
"nodesFolder":"mrrs/gaussian_splatting"
},
{
"pluginName":"Deep_Depth_Maps",
"nodesFolder":"mrrs/deep_depth_map"
},
{
"pluginName":"Deep_Feature_Matching",
"nodesFolder":"mrrs/deep_feature_matching"
},
{
"pluginName":"Nerf_studio",
"nodesFolder":"mrrs/nerf"
},
{
"pluginName":"Reality_Capture",
"nodesFolder":"mrrs/reality_capture",
"pipelineFolder":"mrrs/reality_capture/pipelines"
},
{
"pluginName":"Stereo_Photometry",
"nodesFolder":"mrrs/stereo_photometry"
},
{
"pluginName":"Utils",
"nodesFolder":"mrrs/utils"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space for indentation to be conform with the preceding.

]
101 changes: 101 additions & 0 deletions mrrs/3DR_benchmark/CalibrationComparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"""
This node runs comparison between two input calibration.
"""
__version__ = "3.0"


import os

from meshroom.core import desc
from meshroom.core.plugin import PluginCommandLineNode, EnvType

class CalibrationComparison(PluginCommandLineNode):
category = 'MRRS - Benchmark'

documentation = '''For each camera, compare its estimated parameters with a given groud truth.'''

commandLine = 'python "'+os.path.join(os.path.dirname(__file__), "calibration_comparison.py")+'" {allParams}'

envFile = os.path.join(os.path.dirname(__file__), "general_env.yaml")
envType = EnvType.CONDA

inputs = [
desc.File(
name='inputSfM',
label='SfMData',
description='SfMData file.',
value='',
),

desc.File(
name='inputSfMGT',
label='GtSfMData',
description='Ground Truth SfMData file.',
value='',
),

desc.ChoiceParam(
name='metrics',
label='Metrics',
description='Metrics to be used in the comparison.',
value=['MSECameraCenter'],
values=['MSECameraCenter','AngleBetweenRotations','MSEFocal', 'MSEPrincipalPoint', 'validCams'],
exclusive=False,
joinChar=',',
),

desc.StringParam(
name='csvName',
label='CsvName',
description='Name for the csv file to be used.',
value="calibration_comparison.csv",
),

desc.ChoiceParam(
name='verboseLevel',
label='Verbose Level',
description='''verbosity level (fatal, error, warning, info, debug, trace).''',
value='info',
values=['fatal', 'error', 'warning', 'info', 'debug', 'trace'],
exclusive=True,
),
]

outputs = [
desc.File(
name='outputFolder',
label='Output Folder',
description='Output folder for generated results.',
group="",
value=desc.Node.internalFolder,
),
desc.File(
name='outputCsv',
label='Output Csv',
description='Output file to generated results.',
value=lambda attr: os.path.join(desc.Node.internalFolder, attr.node.csv_name.value),
)
]

def check_inputs(self, chunk):
"""
Checks that all inputs are properly set.
"""
if not chunk.node.inputSfM.value:
chunk.logger.warning('No inputSfM in node, skipping')
return False
if not chunk.node.inputSfMGT.value:
chunk.logger.warning('No inputSfMGT in node, skipping')
return False
return True

def processChunk(self, chunk):
"""
Computes the different metrics on the input and groud truth depth maps.
"""
chunk.logManager.start(chunk.node.verboseLevel.value)
if not self.check_inputs(chunk):
raise RuntimeError("Missing arguments")
super().processChunk(chunk)
chunk.logger.info('Calib comparison ends')
chunk.logManager.end()
100 changes: 100 additions & 0 deletions mrrs/3DR_benchmark/DepthMapComparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
__version__ = "3.0"

import os
from meshroom.core import desc
from meshroom.core.plugin import PluginCommandLineNode, EnvType

class DepthMapComparison(PluginCommandLineNode):

category = 'MRRS - Benchmark'

documentation = '''For each camera, compare its depth maps to a given ground truth.
The names of the original inputSfM file is used to retrieve the GT file, therefore must match.
The depth maps are assumed to be estimated with the same inputSfM poses.
Autorescale may be used otherwise but it is far from ideal.
'''

commandLine = 'python "'+os.path.join(os.path.dirname(__file__), "depth_map_comparison.py")+'" {allParams}'

envFile = os.path.join(os.path.dirname(__file__), "general_env.yaml")
envType = EnvType.CONDA

inputs = [
desc.File(
name='inputSfM',
label='SfMData',
description='SfMData file.',
value='',
),

desc.File(
name="depthMapsFolder",
label="DepthMaps Folder",
description="Input depth maps folder.",
value="",
),

desc.File(
name="depthMapsFolderGT",
label="GT DepthMaps Folder",
description="Input ground truth depth maps folder.",
value="",
),

desc.ChoiceParam(
name='metrics',
label='Metrics',
description='Metrics to be used in the comparison.',
value=['RMSE', 'MAE', 'validity_ratio'],
values=['RMSE', 'MAE', 'validity_ratio'],
exclusive=False,
joinChar=',',
),

desc.BoolParam(
name='autoRescale',
label='Auto Rescale',
description='''Will attempt to find a scale factor between GT depth maps and estimated depth maps. To be used when the depth maps have not been estimated from the same camera coordinate system.''',
value=False,
),

desc.StringParam(
name='maskValue',
label='Mask Value',
description='''If this is not None, will mask the pixels with value bellow this (in gt and estimated).''',
value='0',
),

desc.StringParam(
name='csv_name',
label='CsvName',
description='Name for the csv file to be used.',
value="depth_map_comparison.csv",
group="0"
),

desc.ChoiceParam(
name='verboseLevel',
label='Verbose Level',
description='''Verbosity level (fatal, error, warning, info, debug, trace).''',
value='info',
values=['fatal', 'error', 'warning', 'info', 'debug', 'trace'],
exclusive=True,
),
]

outputs = [
desc.File(
name='output',
label='Output',
description='Output folder for generated results.',
value=desc.Node.internalFolder,
),

desc.File(
name='outputCsv',
label='Output Csv',
description='Output file to generated results.',
value=lambda attr: os.path.join(desc.Node.internalFolder, attr.node.csv_name.value),
)
]
Loading