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

New node for semantic image segmentation #2076

Merged
merged 8 commits into from
Jun 27, 2023
18 changes: 17 additions & 1 deletion meshroom/nodes/aliceVision/FeatureExtraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.2"
__version__ = "1.3"

from meshroom.core import desc

Expand Down Expand Up @@ -45,6 +45,22 @@ class FeatureExtraction(desc.AVCommandLineNode):
value="",
uid=[0],
),
desc.ChoiceParam(
name="maskExtension",
label="Mask Extension",
description="File extension for masks.",
value="png",
values=["png", "exr", "jpg"],
exclusive=True,
uid=[0],
),
desc.BoolParam(
name="maskInvert",
label="Invert Masks",
description="Invert mask values.",
value=False,
uid=[0],
),
desc.ChoiceParam(
name="describerTypes",
label="Describer Types",
Expand Down
89 changes: 89 additions & 0 deletions meshroom/nodes/aliceVision/ImageSegmentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
__version__ = "1.0"

from meshroom.core import desc


class ImageSegmentation(desc.AVCommandLineNode):
commandLine = 'aliceVision_imageSegmentation {allParams}'
size = desc.DynamicNodeSize('input')
gpu = desc.Level.NORMAL
parallelization = desc.Parallelization(blockSize=50)
commandLineRange = '--rangeStart {rangeStart} --rangeSize {rangeBlockSize}'

category = 'Utils'
documentation = '''
Generate a mask with segmented labels for each pixel.
'''

inputs = [
desc.File(
name="input",
label="Input",
description="SfMData file input.",
value="",
uid=[0],
),

desc.File(
name="modelPath",
label="Segmentation Model",
description="Weights file for the internal model.",
value="${ALICEVISION_SEMANTIC_SEGMENTATION_MODEL}",
uid=[0]
),

desc.ListAttribute(
elementDesc=desc.ChoiceParam(
name="className",
label="Class Name",
description="Class name to be added to the mask.",
value="person",
values=[
"__background__",
"aeroplane",
"bicycle", "bird", "boat", "bottle", "bus",
"car", "cat", "chair", "cow",
"diningtable", "dog",
"horse",
"motorbike",
"person", "pottedplant",
"sheep", "sofa",
"train", "tvmonitor"
],
exclusive=True,
uid=[0]),
name="validClasses",
label="Classes",
description="Classes names which are to be considered."
),

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,
uid=[],
)
]

outputs = [
desc.File(
name="output",
label="Masks Folder",
description="Output path for the masks.",
value=desc.Node.internalFolder,
uid=[],
),
desc.File(
name="masks",
label="Masks",
description="Generated segmentation masks.",
semantic="image",
value=desc.Node.internalFolder + "<VIEW_ID>.exr",
group="",
uid=[],
),
]