From db2564c03b66d63dd6cd63b28745d7dcc218defd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E9=9B=AA=E5=B3=B0?= Date: Thu, 22 May 2025 13:16:02 +0800 Subject: [PATCH] rename varible name --- birefnetNode.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/birefnetNode.py b/birefnetNode.py index 7d23184..efe4760 100644 --- a/birefnetNode.py +++ b/birefnetNode.py @@ -297,7 +297,7 @@ class BlurFusionForegroundEstimation: _image_maskeds.append(_image_masked) del _image_masked - _image_masked_torch = torch.cat(_image_maskeds, dim=0) + _image_masked_tensor = torch.cat(_image_maskeds, dim=0) del _image_maskeds # (b, c, h, w) @@ -311,8 +311,8 @@ class BlurFusionForegroundEstimation: # (b, h, w, 3) background_color = torch.cat((r, g, b), dim=-1) # (b, 1, h, w) => (b, h, w, 3) - apply_mask = out_masks.permute(0, 2, 3, 1).expand_as(_image_masked_torch) - out_images = _image_masked_torch * apply_mask + background_color * (1 - apply_mask) + apply_mask = out_masks.permute(0, 2, 3, 1).expand_as(_image_masked_tensor) + out_images = _image_masked_tensor * apply_mask + background_color * (1 - apply_mask) # (b, h, w, 3)=>(b, h, w, 3) del background_color, apply_mask out_masks = out_masks.squeeze(1) @@ -320,9 +320,9 @@ class BlurFusionForegroundEstimation: # (b, 1, h, w) => (b, h, w) out_masks = out_masks.squeeze(1) # image的非mask对应部分设为透明 => (b, h, w, 4) - out_images = add_mask_as_alpha(_image_masked_torch.cpu(), out_masks.cpu()) + out_images = add_mask_as_alpha(_image_masked_tensor.cpu(), out_masks.cpu()) - del _image_masked_torch + del _image_masked_tensor return out_images, out_masks