[nodes] replace CommandLineNode with AVCommandLineNode for alicevision nodes

This commit is contained in:
fabien servant 2022-12-06 15:02:05 +01:00
parent d0cebbe2b0
commit ae0ca71c1c
53 changed files with 70 additions and 63 deletions

View file

@ -548,17 +548,7 @@ class CommandLineNode(Node):
if chunk.node.isParallelized and chunk.node.size > 1:
cmdSuffix = ' ' + self.commandLineRange.format(**chunk.range.toDict())
cmdMem = ''
memSize = cgroup.getCgroupMemorySize()
if memSize > 0:
cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize)
cmdCore = ''
coresCount = cgroup.getCgroupCpuCount()
if coresCount > 0:
cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount)
return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdMem + cmdCore + cmdSuffix
return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdSuffix
def stopProcess(self, chunk):
# the same node could exists several times in the graph and
@ -603,6 +593,23 @@ class CommandLineNode(Node):
finally:
chunk.subprocess = None
#specific command line node for alicevision apps
class AVCommandLineNode(CommandLineNode):
def buildCommandLine(self, chunk):
str = super(AVCommandLineNode, self).buildCommandLine(chunk)
cmdMem = ''
memSize = cgroup.getCgroupMemorySize()
if memSize > 0:
cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize)
cmdCore = ''
coresCount = cgroup.getCgroupCpuCount()
if coresCount > 0:
cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount)
return str + cmdMem + cmdCore
# Test abstract node
class InitNode:

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class CameraCalibration(desc.CommandLineNode):
class CameraCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_cameraCalibration {allParams}'
category = 'Utils'

View file

@ -119,7 +119,7 @@ def readSfMData(sfmFile):
return views, intrinsics
class CameraInit(desc.CommandLineNode, desc.InitNode):
class CameraInit(desc.AVCommandLineNode, desc.InitNode):
commandLine = 'aliceVision_cameraInit {allParams} --allowSingleView 1' # don't throw an error if there is only one image
size = desc.DynamicNodeSize('viewpoints')

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class CameraLocalization(desc.CommandLineNode):
class CameraLocalization(desc.AVCommandLineNode):
commandLine = 'aliceVision_cameraLocalization {allParams}'
category = 'Utils'

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class CameraRigCalibration(desc.CommandLineNode):
class CameraRigCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_rigCalibration {allParams}'
category = 'Utils'

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class CameraRigLocalization(desc.CommandLineNode):
class CameraRigLocalization(desc.AVCommandLineNode):
commandLine = 'aliceVision_rigLocalization {allParams}'
category = 'Utils'

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class ColorCheckerCorrection(desc.CommandLineNode):
class ColorCheckerCorrection(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_colorCheckerCorrection {allParams}'
size = desc.DynamicNodeSize('input')
# parallelization = desc.Parallelization(blockSize=40)

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class ColorCheckerDetection(desc.CommandLineNode):
class ColorCheckerDetection(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_colorCheckerDetection {allParams}'
size = desc.DynamicNodeSize('input')
# parallelization = desc.Parallelization(blockSize=40)

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class ConvertMesh(desc.CommandLineNode):
class ConvertMesh(desc.AVCommandLineNode):
commandLine = 'aliceVision_convertMesh {allParams}'
category = 'Utils'

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class ConvertSfMFormat(desc.CommandLineNode):
class ConvertSfMFormat(desc.AVCommandLineNode):
commandLine = 'aliceVision_convertSfMFormat {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class DepthMap(desc.CommandLineNode):
class DepthMap(desc.AVCommandLineNode):
commandLine = 'aliceVision_depthMapEstimation {allParams}'
gpu = desc.Level.INTENSIVE
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "3.0"
from meshroom.core import desc
class DepthMapFilter(desc.CommandLineNode):
class DepthMapFilter(desc.AVCommandLineNode):
commandLine = 'aliceVision_depthMapFiltering {allParams}'
gpu = desc.Level.NORMAL
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = '2.0'
from meshroom.core import desc
class DistortionCalibration(desc.CommandLineNode):
class DistortionCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_distortionCalibration {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class ExportAnimatedCamera(desc.CommandLineNode):
class ExportAnimatedCamera(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportAnimatedCamera {allParams}'
category = 'Export'

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class ExportColoredPointCloud(desc.CommandLineNode):
class ExportColoredPointCloud(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportColoredPointCloud {allParams}'
category = 'Export'

View file

@ -3,7 +3,7 @@ __version__ = "1.1"
from meshroom.core import desc
class ExportMatches(desc.CommandLineNode):
class ExportMatches(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportMatches {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class ExportMaya(desc.CommandLineNode):
class ExportMaya(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportMeshroomMaya {allParams}'
category = 'Export'

View file

@ -3,7 +3,7 @@ __version__ = "1.1"
from meshroom.core import desc
class FeatureExtraction(desc.CommandLineNode):
class FeatureExtraction(desc.AVCommandLineNode):
commandLine = 'aliceVision_featureExtraction {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=40)

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class FeatureMatching(desc.CommandLineNode):
class FeatureMatching(desc.AVCommandLineNode):
commandLine = 'aliceVision_featureMatching {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=20)

View file

@ -3,7 +3,7 @@ __version__ = "1.1"
from meshroom.core import desc
class FeatureRepeatability(desc.CommandLineNode):
class FeatureRepeatability(desc.AVCommandLineNode):
commandLine = 'aliceVision_samples_repeatabilityDataset {allParams}'
size = desc.DynamicNodeSize('input')
# parallelization = desc.Parallelization(blockSize=40)

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class GlobalSfM(desc.CommandLineNode):
class GlobalSfM(desc.AVCommandLineNode):
commandLine = 'aliceVision_globalSfM {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "3.0"
from meshroom.core import desc
class ImageMasking(desc.CommandLineNode):
class ImageMasking(desc.AVCommandLineNode):
commandLine = 'aliceVision_imageMasking {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=40)

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class ImageMatching(desc.CommandLineNode):
class ImageMatching(desc.AVCommandLineNode):
commandLine = 'aliceVision_imageMatching {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class ImageMatchingMultiSfM(desc.CommandLineNode):
class ImageMatchingMultiSfM(desc.AVCommandLineNode):
commandLine = 'aliceVision_imageMatching {allParams}'
# use both SfM inputs to define Node's size
size = desc.MultiDynamicNodeSize(['input', 'inputB'])

View file

@ -28,7 +28,7 @@ def outputImagesValueFunct(attr):
return desc.Node.internalFolder + '*' + (outputExt or '.*')
class ImageProcessing(desc.CommandLineNode):
class ImageProcessing(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_imageProcessing {allParams}'
size = desc.DynamicNodeSize('input')
# parallelization = desc.Parallelization(blockSize=40)

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class ImportKnownPoses(desc.CommandLineNode):
class ImportKnownPoses(desc.AVCommandLineNode):
commandLine = 'aliceVision_importKnownPoses {allParams}'
size = desc.DynamicNodeSize('sfmData')

View file

@ -4,7 +4,7 @@ import os
from meshroom.core import desc
class KeyframeSelection(desc.CommandLineNode):
class KeyframeSelection(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_keyframeSelection {allParams}'
category = 'Utils'

View file

@ -23,7 +23,7 @@ def findMetadata(d, keys, defaultValue):
class LdrToHdrCalibration(desc.CommandLineNode):
class LdrToHdrCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_LdrToHdrCalibration {allParams}'
size = desc.DynamicNodeSize('input')
cpu = desc.Level.INTENSIVE

View file

@ -22,7 +22,7 @@ def findMetadata(d, keys, defaultValue):
return defaultValue
class LdrToHdrMerge(desc.CommandLineNode):
class LdrToHdrMerge(desc.AVCommandLineNode):
commandLine = 'aliceVision_LdrToHdrMerge {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=2)

View file

@ -39,7 +39,7 @@ class DividedInputNodeSize(desc.DynamicNodeSize):
return s / divParam.value
class LdrToHdrSampling(desc.CommandLineNode):
class LdrToHdrSampling(desc.AVCommandLineNode):
commandLine = 'aliceVision_LdrToHdrSampling {allParams}'
size = DividedInputNodeSize('input', 'nbBrackets')
parallelization = desc.Parallelization(blockSize=2)

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class LightingEstimation(desc.CommandLineNode):
class LightingEstimation(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_lightingEstimation {allParams}'
category = 'Utils'

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class MergeMeshes(desc.CommandLineNode):
class MergeMeshes(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_mergeMeshes {allParams}'
category = 'Utils'

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class MeshDecimate(desc.CommandLineNode):
class MeshDecimate(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshDecimate {allParams}'
cpu = desc.Level.NORMAL
ram = desc.Level.NORMAL

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class MeshDenoising(desc.CommandLineNode):
class MeshDenoising(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshDenoising {allParams}'
category = 'Mesh Post-Processing'

View file

@ -3,7 +3,7 @@ __version__ = "3.0"
from meshroom.core import desc
class MeshFiltering(desc.CommandLineNode):
class MeshFiltering(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshFiltering {allParams}'
category = 'Dense Reconstruction'

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class MeshMasking(desc.CommandLineNode):
class MeshMasking(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshMasking {allParams}'
category = 'Mesh Post-Processing'
documentation = '''

View file

@ -3,7 +3,7 @@ __version__ = "1.0"
from meshroom.core import desc
class MeshResampling(desc.CommandLineNode):
class MeshResampling(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshResampling {allParams}'
cpu = desc.Level.NORMAL
ram = desc.Level.NORMAL

View file

@ -3,7 +3,7 @@ __version__ = "7.0"
from meshroom.core import desc
class Meshing(desc.CommandLineNode):
class Meshing(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshing {allParams}'
cpu = desc.Level.INTENSIVE

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class PanoramaCompositing(desc.CommandLineNode):
class PanoramaCompositing(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaCompositing {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=5)

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class PanoramaEstimation(desc.CommandLineNode):
class PanoramaEstimation(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaEstimation {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class PanoramaInit(desc.CommandLineNode):
class PanoramaInit(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaInit {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class PanoramaMerging(desc.CommandLineNode):
class PanoramaMerging(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaMerging {allParams}'
size = desc.DynamicNodeSize('input')
cpu = desc.Level.NORMAL

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class PanoramaPrepareImages(desc.CommandLineNode):
class PanoramaPrepareImages(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaPrepareImages {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class PanoramaSeams(desc.CommandLineNode):
class PanoramaSeams(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaSeams {allParams}'
size = desc.DynamicNodeSize('input')
cpu = desc.Level.INTENSIVE

View file

@ -6,7 +6,7 @@ import os
from meshroom.core import desc
class PanoramaWarping(desc.CommandLineNode):
class PanoramaWarping(desc.AVCommandLineNode):
commandLine = 'aliceVision_panoramaWarping {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=5)

View file

@ -3,7 +3,7 @@ __version__ = "3.0"
from meshroom.core import desc
class PrepareDenseScene(desc.CommandLineNode):
class PrepareDenseScene(desc.AVCommandLineNode):
commandLine = 'aliceVision_prepareDenseScene {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=40)

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class SfMAlignment(desc.CommandLineNode):
class SfMAlignment(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_sfmAlignment {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -3,7 +3,7 @@ __version__ = "3.0"
from meshroom.core import desc
class SfMDistances(desc.CommandLineNode):
class SfMDistances(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_sfmDistances {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class SfMTransfer(desc.CommandLineNode):
class SfMTransfer(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_sfmTransfer {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -5,7 +5,7 @@ from meshroom.core import desc
import os.path
class SfMTransform(desc.CommandLineNode):
class SfMTransform(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_sfmTransform {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -2,7 +2,7 @@ __version__ = "1.0"
from meshroom.core import desc
class Split360Images(desc.CommandLineNode):
class Split360Images(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_split360Images {allParams}'
category = 'Utils'

View file

@ -3,7 +3,7 @@ __version__ = "2.0"
from meshroom.core import desc
class StructureFromMotion(desc.CommandLineNode):
class StructureFromMotion(desc.AVCommandLineNode):
commandLine = 'aliceVision_incrementalSfM {allParams}'
size = desc.DynamicNodeSize('input')

View file

@ -4,7 +4,7 @@ from meshroom.core import desc, Version
import logging
class Texturing(desc.CommandLineNode):
class Texturing(desc.AVCommandLineNode):
commandLine = 'aliceVision_texturing {allParams}'
cpu = desc.Level.INTENSIVE
ram = desc.Level.INTENSIVE