ComfyPilotComfyPilot
工作流 / 视频工具 / 视频分割: SAM3
视频分割: SAM3

视频分割: SAM3

Video Segmentation: SAM3

使用SAM3模型从视频中分割出主要主体或内容,隔离特定对象或区域。输入视频并接收分割后的掩码输出。

视频工具 5 个节点 1 个输入 127 次使用 ComfyUI ≥ 0.20.0 ComfyUI 24 KB

下载工作流 JSON 查看官方来源

下载后把文件拖进 ComfyUI 窗口即可打开。

需要的权重

这个工作流引用了 1 个权重文件,其中 1 个能在本站模型库里找到。

sam3.1_multiplex_fp16.safetensors 在模型库查看

节点构成

MarkdownNote × 2
MaskPreview × 1
a6f60fa7-1c86-4060-bf6f-01a10288e343 × 1
LoadVideo × 1

官方标注的模型

SAM3

工作流 JSON

和上面「下载工作流 JSON」是同一份文件。

1{
2 "id": "1d367ebe-cf07-4c87-b73a-db40277e6d53",
3 "revision": 0,
4 "last_node_id": 124,
5 "last_link_id": 299,
6 "nodes": [
7 {
8 "id": 95,
9 "type": "MaskPreview",
10 "pos": [
11 -1309.9999009577123,
12 -3260.0001358456125
13 ],
14 "size": [
15 320,
16 400
17 ],
18 "flags": [],
19 "order": 4,
20 "mode": 0,
21 "inputs": [
22 {
23 "name": "mask",
24 "type": "MASK",
25 "link": 285
26 }
27 ],
28 "outputs": [],
29 "properties": {
30 "Node name for S&R": "MaskPreview",
31 "cnr_id": "comfy-core",
32 "ver": "0.19.3",
33 "enableTabs": false,
34 "tabWidth": 65,
35 "tabXOffset": 10,
36 "hasSecondTab": false,
37 "secondTabText": "Send Back",
38 "secondTabOffset": 80,
39 "secondTabWidth": 65
40 },
41 "widgets_values": []
42 },
43 {
44 "id": 112,
45 "type": "MarkdownNote",
46 "pos": [
47 -2529.9999161386568,
48 -3250.000119098066
49 ],
50 "size": [
51 520,
52 900
53 ],
54 "flags": [],
55 "order": 0,
56 "mode": 0,
57 "inputs": [],
58 "outputs": [],
59 "properties": [],
60 "widgets_values": [
61 "Guide: [Subgraph](https://docs.comfy.org/interface/features/subgraph)\n\n## Model Links\n\n- [Hugging Face:Comfy-Org/sam3.1](https://huggingface.co/Comfy-Org/sam3.1)\n\n**ModelScope mirrors** (alternative repo location)\n\n- [ModelScope:Comfy-Org/sam3.1](https://modelscope.cn/models/Comfy-Org/sam3.1)\n\n**checkpoints**\n\n- [sam3.1_multiplex_fp16.safetensors](https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors) (1.63 GB)\n\n## Model Storage Location\n\n```\n📂 ComfyUI/\n├── 📂 models/\n│ └── 📂 checkpoints/\n│ └── sam3.1_multiplex_fp16.safetensors\n```\n\n## Report Issue\n\nNote: Please update ComfyUI first ([guide](https://docs.comfy.org/installation/update_comfyui)) and prepare required models. Desktop/Cloud updates follow stable releases, so some nightly-supported models may not be available yet.\n\n- Cannot run / runtime errors: [ComfyUI/issues](https://github.com/comfyanonymous/ComfyUI/issues)\n- UI / frontend issues: [ComfyUI_frontend/issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues)\n- Workflow issues: [workflow_templates/issues](https://github.com/Comfy-Org/workflow_templates/issues)\n"
62 ],
63 "color": "#222",
64 "bgcolor": "#000"
65 },
66 {
67 "id": 113,
68 "type": "MarkdownNote",
69 "pos": [
70 -1629.9999422402416,
71 -2800.000156880806
72 ],
73 "size": [
74 300,
75 380
76 ],
77 "flags": [],
78 "order": 1,
79 "mode": 0,
80 "inputs": [],
81 "outputs": [],
82 "title": "Note: Prompt format",
83 "properties": [],
84 "widgets_values": [
85 "Max tokens for this model is only 32, to separately prompt multiple subjects you can separate prompts with comma, and set the max amount of objects detected for each prompt with :N\n\nFor example above test prompt finds 2 cakes, one apron, 4 window panels\n\n```\neye:2, window panels:4\n```\n\n\n\n"
86 ],
87 "color": "#222",
88 "bgcolor": "#000"
89 },
90 {
91 "id": 114,
92 "type": "a6f60fa7-1c86-4060-bf6f-01a10288e343",
93 "pos": [
94 -1629.9999422402416,
95 -3260.0001358456125
96 ],
97 "size": [
98 300,
99 370
100 ],
101 "flags": [],
102 "order": 3,
103 "mode": 0,
104 "inputs": [
105 {
106 "name": "video",
107 "type": "VIDEO",
108 "link": 284
109 },
110 {
111 "name": "bboxes",
112 "type": "BOUNDING_BOX",
113 "link": null
114 },
115 {
116 "name": "positive_coords",
117 "type": "STRING",
118 "link": null
119 },
120 {
121 "name": "negative_coords",
122 "type": "STRING",
123 "link": null
124 }
125 ],
126 "outputs": [
127 {
128 "name": "masks",
129 "type": "MASK",
130 "links": [
131 285
132 ]
133 },
134 {
135 "name": "bboxes",
136 "type": "BOUNDING_BOX",
137 "links": []
138 },
139 {
140 "name": "audio",
141 "type": "AUDIO",
142 "links": null
143 },
144 {
145 "name": "fps",
146 "type": "FLOAT",
147 "links": null
148 }
149 ],
150 "properties": {
151 "proxyWidgets": [
152 [
153 "100",
154 "text"
155 ],
156 [
157 "101",
158 "threshold"
159 ],
160 [
161 "101",
162 "refine_iterations"
163 ],
164 [
165 "101",
166 "individual_masks"
167 ],
168 [
169 "102",
170 "ckpt_name"
171 ]
172 ],
173 "cnr_id": "comfy-core",
174 "ver": "0.19.3",
175 "enableTabs": false,
176 "tabWidth": 65,
177 "tabXOffset": 10,
178 "hasSecondTab": false,
179 "secondTabText": "Send Back",
180 "secondTabOffset": 80,
181 "secondTabWidth": 65
182 },
183 "widgets_values": []
184 },
185 {
186 "id": 115,
187 "type": "LoadVideo",
188 "pos": [
189 -1960.000005306642,
190 -3260.000180992658
191 ],
192 "size": [
193 290,
194 416
195 ],
196 "flags": [],
197 "order": 2,
198 "mode": 0,
199 "inputs": [],
200 "outputs": [
201 {
202 "name": "VIDEO",
203 "type": "VIDEO",
204 "links": [
205 284
206 ]
207 }
208 ],
209 "properties": {
210 "Node name for S&R": "LoadVideo",
211 "cnr_id": "comfy-core",
212 "ver": "0.19.3",
213 "enableTabs": false,
214 "tabWidth": 65,
215 "tabXOffset": 10,
216 "hasSecondTab": false,
217 "secondTabText": "Send Back",
218 "secondTabOffset": 80,
219 "secondTabWidth": 65
220 },
221 "widgets_values": [
222 "drinking_unicorn.mp4",
223 "image"
224 ]
225 }
226 ],
227 "links": [
228 [
229 284,
230 115,
231 0,
232 114,
233 0,
234 "VIDEO"
235 ],
236 [
237 285,
238 114,
239 0,
240 95,
241 0,
242 "MASK"
243 ]
244 ],
245 "groups": [],
246 "definitions": {
247 "subgraphs": [
248 {
249 "id": "a6f60fa7-1c86-4060-bf6f-01a10288e343",
250 "version": 1,
251 "state": {
252 "lastGroupId": 0,
253 "lastNodeId": 124,
254 "lastLinkId": 299,
255 "lastRerouteId": 0
256 },
257 "revision": 0,
258 "config": [],
259 "name": "Video Segment (SAM3)",
260 "inputNode": {
261 "id": -10,
262 "bounding": [
263 -2260,
264 -3450,
265 136.369140625,
266 220
267 ]
268 },
269 "outputNode": {
270 "id": -20,
271 "bounding": [
272 -1050,
273 -3510,
274 120,
275 120
276 ]
277 },
278 "inputs": [
279 {
280 "id": "680ffd88-32fe-48be-88d6-91ea44d5eaee",
281 "name": "video",
282 "type": "VIDEO",
283 "linkIds": [
284 252
285 ],
286 "pos": [
287 -2143.630859375,
288 -3430
289 ]
290 },
291 {
292 "id": "ceaf249c-32d7-4624-8bf6-e590e347ed90",
293 "name": "text",
294 "type": "STRING",
295 "linkIds": [
296 254
297 ],
298 "pos": [
299 -2143.630859375,
300 -3410
301 ]
302 },
303 {
304 "id": "1ffbff36-da0c-4854-8cb4-88ad31e64f99",
305 "name": "bboxes",
306 "type": "BOUNDING_BOX",
307 "linkIds": [
308 255
309 ],
310 "pos": [
311 -2143.630859375,
312 -3390
313 ]
314 },
315 {
316 "id": "67b7f4c7-cec0-4e00-b154-23cc1abf880e",
317 "name": "positive_coords",
318 "type": "STRING",
319 "linkIds": [
320 256
321 ],
322 "pos": [
323 -2143.630859375,
324 -3370
325 ]
326 },
327 {
328 "id": "b090a498-2bde-46b9-9554-18501401d687",
329 "name": "negative_coords",
330 "type": "STRING",
331 "linkIds": [
332 257
333 ],
334 "pos": [
335 -2143.630859375,
336 -3350
337 ]
338 },
339 {
340 "id": "1a76dfcf-ce95-46af-bba5-c42160c683dd",
341 "name": "threshold",
342 "type": "FLOAT",
343 "linkIds": [
344 261
345 ],
346 "pos": [
347 -2143.630859375,
348 -3330
349 ]
350 },
351 {
352 "id": "999523fa-c476-4c53-80c3-0a2f554d18ab",
353 "name": "refine_iterations",
354 "type": "INT",
355 "linkIds": [
356 262
357 ],
358 "pos": [
359 -2143.630859375,
360 -3310
361 ]
362 },
363 {
364 "id": "d2371011-7fe5-4a39-b0c1-df2e0bbd6ece",
365 "name": "individual_masks",
366 "type": "BOOLEAN",
367 "linkIds": [
368 263
369 ],
370 "pos": [
371 -2143.630859375,
372 -3290
373 ]
374 },
375 {
376 "id": "675a8b37-17db-48d1-853c-2fe5d6a74582",
377 "name": "ckpt_name",
378 "type": "COMBO",
379 "linkIds": [
380 273
381 ],
382 "pos": [
383 -2143.630859375,
384 -3270
385 ]
386 }
387 ],
388 "outputs": [
389 {
390 "id": "ff50da09-1e59-4a58-9b7f-be1a00aa5913",
391 "name": "masks",
392 "type": "MASK",
393 "linkIds": [
394 231
395 ],
396 "localized_name": "masks",
397 "pos": [
398 -1030,
399 -3490
400 ]
401 },
402 {
403 "id": "8f622e40-8528-4078-b7d3-147e9f872194",
404 "name": "bboxes",
405 "type": "BOUNDING_BOX",
406 "linkIds": [
407 232
408 ],
409 "localized_name": "bboxes",
410 "pos": [
411 -1030,
412 -3470
413 ]
414 },
415 {
416 "id": "6c9924ec-f0fa-4509-83ea-8f97f5889bcc",
417 "name": "audio",
418 "type": "AUDIO",
419 "linkIds": [
420 259
421 ],
422 "pos": [
423 -1030,
424 -3450
425 ]
426 },
427 {
428 "id": "82c1cddc-ab11-44eb-9e2f-1a5c7ea5645b",
429 "name": "fps",
430 "type": "FLOAT",
431 "linkIds": [
432 260
433 ],
434 "pos": [
435 -1030,
436 -3430
437 ]
438 }
439 ],
440 "widgets": [],
441 "nodes": [
442 {
443 "id": 100,
444 "type": "CLIPTextEncode",
445 "pos": [
446 -2010,
447 -3040
448 ],
449 "size": [
450 400,
451 200
452 ],
453 "flags": [],
454 "order": 1,
455 "mode": 0,
456 "inputs": [
457 {
458 "localized_name": "clip",
459 "name": "clip",
460 "type": "CLIP",
461 "link": 240
462 },
463 {
464 "localized_name": "text",
465 "name": "text",
466 "type": "STRING",
467 "widget": {
468 "name": "text"
469 },
470 "link": 254
471 }
472 ],
473 "outputs": [
474 {
475 "localized_name": "CONDITIONING",
476 "name": "CONDITIONING",
477 "type": "CONDITIONING",
478 "links": [
479 200
480 ]
481 }
482 ],
483 "properties": {
484 "Node name for S&R": "CLIPTextEncode",
485 "cnr_id": "comfy-core",
486 "ver": "0.19.3",
487 "enableTabs": false,
488 "tabWidth": 65,
489 "tabXOffset": 10,
490 "hasSecondTab": false,
491 "secondTabText": "Send Back",
492 "secondTabOffset": 80,
493 "secondTabWidth": 65
494 },
495 "widgets_values": [
496 "unicorn"
497 ]
498 },
499 {
500 "id": 101,
501 "type": "SAM3_Detect",
502 "pos": [
503 -1520,
504 -3520
505 ],
506 "size": [
507 270,
508 260
509 ],
510 "flags": [],
511 "order": 2,
512 "mode": 0,
513 "inputs": [
514 {
515 "label": "model",
516 "localized_name": "model",
517 "name": "model",
518 "type": "MODEL",
519 "link": 237
520 },
521 {
522 "label": "image",
523 "localized_name": "image",
524 "name": "image",
525 "type": "IMAGE",
526 "link": 253
527 },
528 {
529 "label": "conditioning",
530 "localized_name": "conditioning",
531 "name": "conditioning",
532 "shape": 7,
533 "type": "CONDITIONING",
534 "link": 200
535 },
536 {
537 "label": "bboxes",
538 "localized_name": "bboxes",
539 "name": "bboxes",
540 "shape": 7,
541 "type": "BOUNDING_BOX",
542 "link": 255
543 },
544 {
545 "label": "positive_coords",
546 "localized_name": "positive_coords",
547 "name": "positive_coords",
548 "shape": 7,
549 "type": "STRING",
550 "link": 256
551 },
552 {
553 "label": "negative_coords",
554 "localized_name": "negative_coords",
555 "name": "negative_coords",
556 "shape": 7,
557 "type": "STRING",
558 "link": 257
559 },
560 {
561 "localized_name": "threshold",
562 "name": "threshold",
563 "type": "FLOAT",
564 "widget": {
565 "name": "threshold"
566 },
567 "link": 261
568 },
569 {
570 "localized_name": "refine_iterations",
571 "name": "refine_iterations",
572 "type": "INT",
573 "widget": {
574 "name": "refine_iterations"
575 },
576 "link": 262
577 },
578 {
579 "localized_name": "individual_masks",
580 "name": "individual_masks",
581 "type": "BOOLEAN",
582 "widget": {
583 "name": "individual_masks"
584 },
585 "link": 263
586 }
587 ],
588 "outputs": [
589 {
590 "localized_name": "masks",
591 "name": "masks",
592 "type": "MASK",
593 "links": [
594 231
595 ]
596 },
597 {
598 "localized_name": "bboxes",
599 "name": "bboxes",
600 "type": "BOUNDING_BOX",
601 "links": [
602 232
603 ]
604 }
605 ],
606 "properties": {
607 "Node name for S&R": "SAM3_Detect",
608 "cnr_id": "comfy-core",
609 "ver": "0.19.3",
610 "enableTabs": false,
611 "tabWidth": 65,
612 "tabXOffset": 10,
613 "hasSecondTab": false,
614 "secondTabText": "Send Back",
615 "secondTabOffset": 80,
616 "secondTabWidth": 65
617 },
618 "widgets_values": [
619 0.5,
620 2,
621 false
622 ]
623 },
624 {
625 "id": 102,
626 "type": "CheckpointLoaderSimple",
627 "pos": [
628 -1970,
629 -3310
630 ],
631 "size": [
632 330,
633 140
634 ],
635 "flags": [],
636 "order": 3,
637 "mode": 0,
638 "inputs": [
639 {
640 "localized_name": "ckpt_name",
641 "name": "ckpt_name",
642 "type": "COMBO",
643 "widget": {
644 "name": "ckpt_name"
645 },
646 "link": 273
647 }
648 ],
649 "outputs": [
650 {
651 "localized_name": "MODEL",
652 "name": "MODEL",
653 "type": "MODEL",
654 "links": [
655 237
656 ]
657 },
658 {
659 "localized_name": "CLIP",
660 "name": "CLIP",
661 "type": "CLIP",
662 "links": [
663 240
664 ]
665 },
666 {
667 "localized_name": "VAE",
668 "name": "VAE",
669 "type": "VAE",
670 "links": null
671 }
672 ],
673 "properties": {
674 "Node name for S&R": "CheckpointLoaderSimple",
675 "cnr_id": "comfy-core",
676 "ver": "0.19.3",
677 "enableTabs": false,
678 "tabWidth": 65,
679 "tabXOffset": 10,
680 "hasSecondTab": false,
681 "secondTabText": "Send Back",
682 "secondTabOffset": 80,
683 "secondTabWidth": 65,
684 "models": [
685 {
686 "name": "sam3.1_multiplex_fp16.safetensors",
687 "url": "https://huggingface.co/Comfy-Org/sam3.1/resolve/main/checkpoints/sam3.1_multiplex_fp16.safetensors",
688 "directory": "checkpoints"
689 }
690 ]
691 },
692 "widgets_values": [
693 "sam3.1_multiplex_fp16.safetensors"
694 ]
695 },
696 {
697 "id": 104,
698 "type": "GetVideoComponents",
699 "pos": [
700 -1910,
701 -3540
702 ],
703 "size": [
704 230,
705 100
706 ],
707 "flags": [],
708 "order": 4,
709 "mode": 0,
710 "inputs": [
711 {
712 "localized_name": "video",
713 "name": "video",
714 "type": "VIDEO",
715 "link": 252
716 }
717 ],
718 "outputs": [
719 {
720 "localized_name": "images",
721 "name": "images",
722 "type": "IMAGE",
723 "links": [
724 253
725 ]
726 },
727 {
728 "localized_name": "audio",
729 "name": "audio",
730 "type": "AUDIO",
731 "links": [
732 259
733 ]
734 },
735 {
736 "localized_name": "fps",
737 "name": "fps",
738 "type": "FLOAT",
739 "links": [
740 260
741 ]
742 }
743 ],
744 "properties": {
745 "Node name for S&R": "GetVideoComponents",
746 "cnr_id": "comfy-core",
747 "ver": "0.19.3",
748 "enableTabs": false,
749 "tabWidth": 65,
750 "tabXOffset": 10,
751 "hasSecondTab": false,
752 "secondTabText": "Send Back",
753 "secondTabOffset": 80,
754 "secondTabWidth": 65
755 },
756 "widgets_values": []
757 },
758 {
759 "id": 105,
760 "type": "Note",
761 "pos": [
762 -1980,
763 -2790
764 ],
765 "size": [
766 370,
767 250
768 ],
769 "flags": [],
770 "order": 0,
771 "mode": 0,
772 "inputs": [],
773 "outputs": [],
774 "title": "Note: Prompt format",
775 "properties": [],
776 "widgets_values": [
777 "Max tokens for this model is only 32, to separately prompt multiple subjects you can separate prompts with comma, and set the max amount of objects detected for each prompt with :N\n\nFor example above test prompt finds 2 cakes, one apron, 4 window panels"
778 ],
779 "color": "#432",
780 "bgcolor": "#653"
781 }
782 ],
783 "groups": [],
784 "links": [
785 {
786 "id": 237,
787 "origin_id": 102,
788 "origin_slot": 0,
789 "target_id": 101,
790 "target_slot": 0,
791 "type": "MODEL"
792 },
793 {
794 "id": 200,
795 "origin_id": 100,
796 "origin_slot": 0,
797 "target_id": 101,
798 "target_slot": 2,
799 "type": "CONDITIONING"
800 },
801 {
802 "id": 240,
803 "origin_id": 102,
804 "origin_slot": 1,
805 "target_id": 100,
806 "target_slot": 0,
807 "type": "CLIP"
808 },
809 {
810 "id": 231,
811 "origin_id": 101,
812 "origin_slot": 0,
813 "target_id": -20,
814 "target_slot": 0,
815 "type": "MASK"
816 },
817 {
818 "id": 232,
819 "origin_id": 101,
820 "origin_slot": 1,
821 "target_id": -20,
822 "target_slot": 1,
823 "type": "BOUNDING_BOX"
824 },
825 {
826 "id": 252,
827 "origin_id": -10,
828 "origin_slot": 0,
829 "target_id": 104,
830 "target_slot": 0,
831 "type": "VIDEO"
832 },
833 {
834 "id": 253,
835 "origin_id": 104,
836 "origin_slot": 0,
837 "target_id": 101,
838 "target_slot": 1,
839 "type": "IMAGE"
840 },
841 {
842 "id": 254,
843 "origin_id": -10,
844 "origin_slot": 1,
845 "target_id": 100,
846 "target_slot": 1,
847 "type": "STRING"
848 },
849 {
850 "id": 255,
851 "origin_id": -10,
852 "origin_slot": 2,
853 "target_id": 101,
854 "target_slot": 3,
855 "type": "BOUNDING_BOX"
856 },
857 {
858 "id": 256,
859 "origin_id": -10,
860 "origin_slot": 3,
861 "target_id": 101,
862 "target_slot": 4,
863 "type": "STRING"
864 },
865 {
866 "id": 257,
867 "origin_id": -10,
868 "origin_slot": 4,
869 "target_id": 101,
870 "target_slot": 5,
871 "type": "STRING"
872 },
873 {
874 "id": 259,
875 "origin_id": 104,
876 "origin_slot": 1,
877 "target_id": -20,
878 "target_slot": 2,
879 "type": "AUDIO"
880 },
881 {
882 "id": 260,
883 "origin_id": 104,
884 "origin_slot": 2,
885 "target_id": -20,
886 "target_slot": 3,
887 "type": "FLOAT"
888 },
889 {
890 "id": 261,
891 "origin_id": -10,
892 "origin_slot": 5,
893 "target_id": 101,
894 "target_slot": 6,
895 "type": "FLOAT"
896 },
897 {
898 "id": 262,
899 "origin_id": -10,
900 "origin_slot": 6,
901 "target_id": 101,
902 "target_slot": 7,
903 "type": "INT"
904 },
905 {
906 "id": 263,
907 "origin_id": -10,
908 "origin_slot": 7,
909 "target_id": 101,
910 "target_slot": 8,
911 "type": "BOOLEAN"
912 },
913 {
914 "id": 273,
915 "origin_id": -10,
916 "origin_slot": 8,
917 "target_id": 102,
918 "target_slot": 0,
919 "type": "COMBO"
920 }
921 ],
922 "extra": []
923 }
924 ]
925 },
926 "config": [],
927 "extra": {
928 "ds": {
929 "scale": 0.6786634141865573,
930 "offset": [
931 2919.7833963527087,
932 3639.2117505789324
933 ]
934 },
935 "frontendVersion": "1.42.6",
936 "VHS_latentpreview": false,
937 "VHS_latentpreviewrate": 0,
938 "VHS_MetadataImage": true,
939 "VHS_KeepIntermediate": true
940 },
941 "version": 0.4
942}