{
 "last_node_id": 17,
 "last_link_id": 16,
 "nodes": [
  {
   "id": 1,
   "type": "MarkdownNote",
   "pos": [
    0,
    -460.0
   ],
   "size": [
    640,
    290
   ],
   "flags": {},
   "order": 1,
   "mode": 0,
   "inputs": [],
   "outputs": [],
   "properties": {},
   "widgets_values": [
    "**Needs in ComfyUI's `input` folder:** `clip0.png` .. `clip3.png`\n\nClick to track: one click at the image centre of the first frame (positive_points = 384,384) and SAM 2.1 follows that object through the clip (clip0.png .. clip3.png). Edit the point in pixels of the first frame. Bottom: the same with the segment-anything-2 pack by kijai (video segmentor, add points on frame 0, then propagate). Measured: about 1.6x faster than that pack.\n\n**Orange group:** the same task in another pack; install it, or delete the group."
   ]
  },
  {
   "id": 2,
   "type": "LoadImage",
   "pos": [
    0.0,
    0.0
   ],
   "size": [
    300,
    340
   ],
   "flags": {},
   "order": 2,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      1
     ],
     "slot_index": 0
    },
    {
     "name": "MASK",
     "type": "MASK",
     "links": [],
     "slot_index": 1
    }
   ],
   "properties": {},
   "widgets_values": [
    "clip0.png",
    "image"
   ]
  },
  {
   "id": 3,
   "type": "LoadImage",
   "pos": [
    0.0,
    380.0
   ],
   "size": [
    300,
    340
   ],
   "flags": {},
   "order": 3,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      2
     ],
     "slot_index": 0
    },
    {
     "name": "MASK",
     "type": "MASK",
     "links": [],
     "slot_index": 1
    }
   ],
   "properties": {},
   "widgets_values": [
    "clip1.png",
    "image"
   ]
  },
  {
   "id": 4,
   "type": "LoadImage",
   "pos": [
    0.0,
    760.0
   ],
   "size": [
    300,
    340
   ],
   "flags": {},
   "order": 4,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      4
     ],
     "slot_index": 0
    },
    {
     "name": "MASK",
     "type": "MASK",
     "links": [],
     "slot_index": 1
    }
   ],
   "properties": {},
   "widgets_values": [
    "clip2.png",
    "image"
   ]
  },
  {
   "id": 5,
   "type": "LoadImage",
   "pos": [
    0.0,
    1140.0
   ],
   "size": [
    300,
    340
   ],
   "flags": {},
   "order": 5,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      6
     ],
     "slot_index": 0
    },
    {
     "name": "MASK",
     "type": "MASK",
     "links": [],
     "slot_index": 1
    }
   ],
   "properties": {},
   "widgets_values": [
    "clip3.png",
    "image"
   ]
  },
  {
   "id": 6,
   "type": "ImageBatch",
   "pos": [
    380.0,
    0.0
   ],
   "size": [
    200,
    50
   ],
   "flags": {},
   "order": 6,
   "mode": 0,
   "inputs": [
    {
     "name": "image1",
     "type": "IMAGE",
     "link": 1
    },
    {
     "name": "image2",
     "type": "IMAGE",
     "link": 2
    }
   ],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      3
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 7,
   "type": "ImageBatch",
   "pos": [
    660.0,
    120.0
   ],
   "size": [
    200,
    50
   ],
   "flags": {},
   "order": 7,
   "mode": 0,
   "inputs": [
    {
     "name": "image1",
     "type": "IMAGE",
     "link": 3
    },
    {
     "name": "image2",
     "type": "IMAGE",
     "link": 4
    }
   ],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      5
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 8,
   "type": "ImageBatch",
   "pos": [
    940.0,
    240.0
   ],
   "size": [
    200,
    50
   ],
   "flags": {},
   "order": 8,
   "mode": 0,
   "inputs": [
    {
     "name": "image1",
     "type": "IMAGE",
     "link": 5
    },
    {
     "name": "image2",
     "type": "IMAGE",
     "link": 6
    }
   ],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      7,
      11
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 9,
   "type": "FastforksVideoSegment",
   "pos": [
    1380.0,
    0.0
   ],
   "size": [
    330,
    300
   ],
   "flags": {},
   "order": 9,
   "mode": 0,
   "inputs": [
    {
     "name": "frames",
     "type": "IMAGE",
     "link": 7
    }
   ],
   "outputs": [
    {
     "name": "mask",
     "type": "MASK",
     "links": [
      8
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "title": "video segment (fastforks)",
   "widgets_values": [
    "sam2.1-hiera-small",
    "auto",
    "auto",
    "384,384",
    "",
    "",
    false
   ]
  },
  {
   "id": 10,
   "type": "MaskToImage",
   "pos": [
    1790.0,
    0.0
   ],
   "size": [
    200,
    30
   ],
   "flags": {},
   "order": 10,
   "mode": 0,
   "inputs": [
    {
     "name": "mask",
     "type": "MASK",
     "link": 8
    }
   ],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      9
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 11,
   "type": "PreviewImage",
   "pos": [
    2070.0,
    0.0
   ],
   "size": [
    300,
    300
   ],
   "flags": {},
   "order": 11,
   "mode": 0,
   "inputs": [
    {
     "name": "images",
     "type": "IMAGE",
     "link": 9
    }
   ],
   "outputs": [
    {
     "name": "images",
     "type": "IMAGE",
     "links": [],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 12,
   "type": "DownloadAndLoadSAM2Model",
   "pos": [
    1380.0,
    510.0
   ],
   "size": [
    300,
    160
   ],
   "flags": {},
   "order": 12,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "sam2_model",
     "type": "SAM2MODEL",
     "links": [
      10
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": [
    "sam2.1_hiera_small.safetensors",
    "video",
    "cuda",
    "fp16"
   ]
  },
  {
   "id": 13,
   "type": "PrimitiveString",
   "pos": [
    1380.0,
    750.0
   ],
   "size": [
    300,
    80
   ],
   "flags": {},
   "order": 13,
   "mode": 0,
   "inputs": [],
   "outputs": [
    {
     "name": "STRING",
     "type": "STRING",
     "links": [
      12
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "title": "click point (JSON)",
   "widgets_values": [
    "[{\"x\": 384, \"y\": 384}]"
   ]
  },
  {
   "id": 14,
   "type": "Sam2VideoSegmentationAddPoints",
   "pos": [
    1760.0,
    510.0
   ],
   "size": [
    300,
    200
   ],
   "flags": {},
   "order": 14,
   "mode": 0,
   "inputs": [
    {
     "name": "sam2_model",
     "type": "SAM2MODEL",
     "link": 10
    },
    {
     "name": "coordinates_positive",
     "type": "STRING",
     "link": 12
    },
    {
     "name": "image",
     "type": "IMAGE",
     "link": 11
    },
    {
     "name": "coordinates_negative",
     "type": "STRING",
     "link": null
    },
    {
     "name": "prev_inference_state",
     "type": "SAM2INFERENCESTATE",
     "link": null
    }
   ],
   "outputs": [
    {
     "name": "sam2_model",
     "type": "SAM2MODEL",
     "links": [
      13
     ],
     "slot_index": 0
    },
    {
     "name": "inference_state",
     "type": "SAM2INFERENCESTATE",
     "links": [
      14
     ],
     "slot_index": 1
    }
   ],
   "properties": {},
   "title": "segment-anything-2: add click",
   "widgets_values": [
    0,
    0
   ]
  },
  {
   "id": 15,
   "type": "Sam2VideoSegmentation",
   "pos": [
    2140.0,
    510.0
   ],
   "size": [
    300,
    120
   ],
   "flags": {},
   "order": 15,
   "mode": 0,
   "inputs": [
    {
     "name": "sam2_model",
     "type": "SAM2MODEL",
     "link": 13
    },
    {
     "name": "inference_state",
     "type": "SAM2INFERENCESTATE",
     "link": 14
    }
   ],
   "outputs": [
    {
     "name": "mask",
     "type": "MASK",
     "links": [
      15
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "title": "segment-anything-2: propagate",
   "widgets_values": [
    false
   ]
  },
  {
   "id": 16,
   "type": "MaskToImage",
   "pos": [
    2520.0,
    510.0
   ],
   "size": [
    200,
    30
   ],
   "flags": {},
   "order": 16,
   "mode": 0,
   "inputs": [
    {
     "name": "mask",
     "type": "MASK",
     "link": 15
    }
   ],
   "outputs": [
    {
     "name": "IMAGE",
     "type": "IMAGE",
     "links": [
      16
     ],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  },
  {
   "id": 17,
   "type": "PreviewImage",
   "pos": [
    2800.0,
    510.0
   ],
   "size": [
    300,
    300
   ],
   "flags": {},
   "order": 17,
   "mode": 0,
   "inputs": [
    {
     "name": "images",
     "type": "IMAGE",
     "link": 16
    }
   ],
   "outputs": [
    {
     "name": "images",
     "type": "IMAGE",
     "links": [],
     "slot_index": 0
    }
   ],
   "properties": {},
   "widgets_values": []
  }
 ],
 "links": [
  [
   1,
   2,
   0,
   6,
   0,
   "IMAGE"
  ],
  [
   2,
   3,
   0,
   6,
   1,
   "IMAGE"
  ],
  [
   3,
   6,
   0,
   7,
   0,
   "IMAGE"
  ],
  [
   4,
   4,
   0,
   7,
   1,
   "IMAGE"
  ],
  [
   5,
   7,
   0,
   8,
   0,
   "IMAGE"
  ],
  [
   6,
   5,
   0,
   8,
   1,
   "IMAGE"
  ],
  [
   7,
   8,
   0,
   9,
   0,
   "IMAGE"
  ],
  [
   8,
   9,
   0,
   10,
   0,
   "MASK"
  ],
  [
   9,
   10,
   0,
   11,
   0,
   "IMAGE"
  ],
  [
   10,
   12,
   0,
   14,
   0,
   "SAM2MODEL"
  ],
  [
   11,
   8,
   0,
   14,
   2,
   "IMAGE"
  ],
  [
   12,
   13,
   0,
   14,
   1,
   "STRING"
  ],
  [
   13,
   14,
   0,
   15,
   0,
   "SAM2MODEL"
  ],
  [
   14,
   14,
   1,
   15,
   1,
   "SAM2INFERENCESTATE"
  ],
  [
   15,
   15,
   0,
   16,
   0,
   "MASK"
  ],
  [
   16,
   16,
   0,
   17,
   0,
   "IMAGE"
  ]
 ],
 "groups": [
  {
   "id": 1,
   "title": "Inputs",
   "bounding": [
    -30.0,
    -90.0,
    1200.0,
    1600.0
   ],
   "color": "#88A",
   "font_size": 24,
   "flags": {}
  },
  {
   "id": 2,
   "title": "fastforks",
   "bounding": [
    1350.0,
    -90.0,
    1050.0,
    420.0
   ],
   "color": "#3f789e",
   "font_size": 24,
   "flags": {}
  },
  {
   "id": 3,
   "title": "Other packs (install them, or delete this group)",
   "bounding": [
    1350.0,
    420.0,
    1780.0,
    440.0
   ],
   "color": "#b58b2a",
   "font_size": 24,
   "flags": {}
  }
 ],
 "config": {},
 "extra": {},
 "version": 0.4
}