@@ -206,7 +206,7 @@ def processChunk(self, chunk):
206206
207207 metadata_deep_model = {}
208208 metadata_deep_model ["Meshroom:mrSegmentation:DeepModelName" ] = "SegmentAnything"
209- metadata_deep_model ["Meshroom:mrSegmentation:DeepModelVersion" ] = "sam3-Video"
209+ metadata_deep_model ["Meshroom:mrSegmentation:DeepModelVersion" ] = "sam3-Video-TextPrompt "
210210
211211 pil_images = []
212212 mask_images = []
@@ -257,6 +257,7 @@ def processChunk(self, chunk):
257257 logger .info (f"textPrompt: { textPrompt } " )
258258 boxes [textPrompt ] = {"forward" : {}, "backward" : {}}
259259 cryptoName = "object" if textPrompt == "" else textPrompt
260+ metadata_deep_model ["Meshroom:mrSegmentation:Prompt" ] = textPrompt
260261
261262 video_predictor .handle_request (request = dict (type = "reset_session" , session_id = session_id ))
262263
@@ -431,25 +432,28 @@ def processChunk(self, chunk):
431432
432433 image .writeCryptomatte (cryptomattePath , cryptoName , img .shape [1 ], img .shape [0 ], manifest_bwd , crypto_id_bwd , crypto_cov_bwd )
433434
434- for frameId in range (frameNumber ):
435- if chunk .node .maskInvert .value :
436- mask = (mask_images [frameId ][:,:,0 :1 ] == 0 ).astype ('float32' )
437- else :
438- mask = (mask_images [frameId ][:,:,0 :1 ] > 0 ).astype ('float32' )
439- logger .info ("frameId: {} - {}" .format (frameId , chunk_image_paths [frameId ][0 ]))
435+ prompts = [textPrompt .strip () for textPrompt in self .textPrompts if textPrompt .strip ()]
436+ metadata_deep_model ["Meshroom:mrSegmentation:Prompt" ] = ";" .join (prompts )
440437
441- if chunk .node .keepFilename .value :
442- outputFileMask = os .path .join (chunk .node .output .value , Path (chunk_image_paths [frameId ][0 ]).stem + "." + chunk .node .extensionOut .value )
443- else :
444- outputFileMask = os .path .join (chunk .node .output .value , str (chunk_image_paths [frameId ][1 ]) + "." + chunk .node .extensionOut .value )
438+ for frameId in range (frameNumber ):
439+ if chunk .node .maskInvert .value :
440+ mask = (mask_images [frameId ][:,:,0 :1 ] == 0 ).astype ('float32' )
441+ else :
442+ mask = (mask_images [frameId ][:,:,0 :1 ] > 0 ).astype ('float32' )
443+ logger .info ("frameId: {} - {}" .format (frameId , chunk_image_paths [frameId ][0 ]))
444+
445+ if chunk .node .keepFilename .value :
446+ outputFileMask = os .path .join (chunk .node .output .value , Path (chunk_image_paths [frameId ][0 ]).stem + "." + chunk .node .extensionOut .value )
447+ else :
448+ outputFileMask = os .path .join (chunk .node .output .value , str (chunk_image_paths [frameId ][1 ]) + "." + chunk .node .extensionOut .value )
445449
446- optWrite = avimg .ImageWriteOptions ()
447- optWrite .toColorSpace (avimg .EImageColorSpace_NO_CONVERSION )
448- if Path (outputFileMask ).suffix .lower () == ".exr" :
449- optWrite .exrCompressionMethod (avimg .EImageExrCompression_stringToEnum ("DWAA" ))
450- optWrite .exrCompressionLevel (300 )
450+ optWrite = avimg .ImageWriteOptions ()
451+ optWrite .toColorSpace (avimg .EImageColorSpace_NO_CONVERSION )
452+ if Path (outputFileMask ).suffix .lower () == ".exr" :
453+ optWrite .exrCompressionMethod (avimg .EImageExrCompression_stringToEnum ("DWAA" ))
454+ optWrite .exrCompressionLevel (300 )
451455
452- image .writeImage (outputFileMask , mask , sourceInfo ["h_ori" ], sourceInfo ["w_ori" ], sourceInfo ["orientation" ], sourceInfo ["PAR" ], metadata_deep_model , optWrite )
456+ image .writeImage (outputFileMask , mask , sourceInfo ["h_ori" ], sourceInfo ["w_ori" ], sourceInfo ["orientation" ], sourceInfo ["PAR" ], metadata_deep_model , optWrite )
453457
454458 jsonFilename = chunk .node .output .value + "/bboxes.json"
455459 with open (jsonFilename , "w" , encoding = "utf_8" ) as f :
0 commit comments