light-and-ray / sd-webui-replacer

A tab for sd-webui for replacing objects in pictures or videos using detection prompt
208 stars 11 forks source link

Merging Fragments NoneType' object has no attribute '__array_interface__ #95

Closed kingofworlds221 closed 3 months ago

kingofworlds221 commented 3 months ago

Output #0, image2, to 'D:\output\temp\frame_%05d.png': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 comment : vid:v15044gf0000cqul8r7og65iobf1h3v0 aigc_info : {"aigc_label_type": 0} encoder : Lavf58.29.100 Stream #0:0(und): Video: png, rgb24, 576x1024 [SAR 1:1 DAR 9:16], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc58.54.100 png frame= 233 fps= 48 q=-0.0 Lsize=N/A time=00:00:07.76 bitrate=N/A speed=1.59x video:138447kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Total progress: 1%|▌ | 20/2340 [11:05<21:26:08, 33.26s/it] Start SAM Processing|▌ | 20/2340 [11:05<24:54, 1.55it/s] Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) final text_encoder_type: bert-base-uncased Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. Dilation Amount: 35 Dilation Amount: 35 Dilation Amount: 35 Start SAM Processing Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. MasksCreator cached Aspect ratio has been corrected from 512x512 to 472x552 Use cn inpaint instead of sd inpaint Reusing loaded model epicrealism_v10-inpainting.safetensors [ec6a1ba636] to load v1-5-pruned-emaonly.safetensors [6ce0161689] Loading weights [6ce0161689] from D:\stable-diffusion-webui-master\models\Stable-diffusion\v1-5-pruned-emaonly.safetensors Creating model from config: D:\stable-diffusion-webui-master\configs\v1-inference.yaml Applying attention optimization: Doggettx... done. Model loaded in 138.3s (create model: 0.4s, apply weights to model: 136.2s, apply half(): 0.2s, apply dtype to VAE: 0.2s, load textual inversion embeddings: 0.2s, calculate empty prompt: 1.0s). 2024-08-17 10:04:35,652 - ControlNet - INFO - unit_separate = False, style_align = False 2024-08-17 10:04:36,295 - ControlNet - INFO - Loading model: control_v11p_sd15_inpaint_fp16 [be8bc0ed] 2024-08-17 10:04:37,057 - ControlNet - INFO - Loaded state_dict from [D:\stable-diffusion-webui-master\models\ControlNet\control_v11p_sd15_inpaint_fp16.safetensors] 2024-08-17 10:04:37,061 - ControlNet - INFO - controlnet_default_config 2024-08-17 10:04:57,504 - ControlNet - INFO - ControlNet model control_v11p_sd15_inpaint_fp16 be8bc0ed loaded. 2024-08-17 10:04:57,565 - ControlNet - INFO - Using preprocessor: inpaint_only 2024-08-17 10:04:57,566 - ControlNet - INFO - preprocessor resolution = -1 2024-08-17 10:04:58,060 - ControlNet - INFO - ControlNet Hooked - Time = 22.412081718444824 0%| | 0/20 [00:00<?, ?it/s]2024-08-17 10:05:00,517 - ControlNet - INFO - ControlNet used torch.float16 VAE to encode torch.Size([1, 4, 69, 59]). 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:13<00:00, 1.45it/s] Restoring images resolution after ControlNet Inpainting | 20/2340 [00:12<25:23, 1.52it/s] 1 / 3 MasksCreator restored from cache 2 / 3 Start SAM Processing Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. Dilation Amount: 35 Dilation Amount: 35 Dilation Amount: 35 Start SAM Processing Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. MasksCreator cached 3 / 3 Start SAM Processing Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. Dilation Amount: 35 Dilation Amount: 35 Dilation Amount: 35 Start SAM Processing Using local groundingdino. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cuda Running SAM Inference (1024, 576, 3) SAM inference with 2 boxes, point prompts discarded Creating output image SAM inference with 2 boxes, point prompts discarded done. MasksCreator cached 'NoneType' object has no attribute '__array_interface__' Traceback (most recent call last): File "D:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\video_animatediff.py", line 132, in animatediffGenerate processed = processFragment(fragmentPath, initImage, gArgs) File "D:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\videoanimatediff.py", line 25, in processFragment processed, = inpaint(initImage, gArgs) File "D:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\inpaint.py", line 28, in inpaint x1, y1, x2, y2 = getActualCropRegion(gArgs.mask, gArgs.inpaint_full_res_padding, gArgs.inpainting_mask_invert) File "D:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\tools.py", line 300, in getActualCropRegion crop_region = masking.get_crop_region_v2(mask, padding) File "D:\stable-diffusion-webui-master\modules\masking.py", line 16, in get_crop_region_v2 mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask) File "D:\stable-diffusion-webui-master\venv\lib\site-packages\PIL\Image.py", line 3078, in fromarray arr = obj.array_interface AttributeError: 'NoneType' object has no attribute 'array_interface'


merging fragments 0it [00:00, ?it/s]

No video is output, ends right here. Generated folder shows only first frame is generated.

light-and-ray commented 3 months ago

I see you are using animatediff and aspect ratio correction. I've found this bug today and fixed it in the last commit. Can you update the extension and try again?

light-and-ray commented 3 months ago

https://github.com/light-and-ray/sd-webui-replacer/commit/12e67ebfde5b9afd3075ae8f2026d1e73168e640