f41dfd20ed3ab20043a224afc5413d7aae2ef4c4
ComfyUI Qwen2.5-VL Object Detection Node
This repository provides a custom ComfyUI node for running object detection with the Qwen 2.5 VL model. The node downloads the selected model on demand, runs a detection prompt and outputs bounding boxes that can be used with segmentation nodes such as SAM2.
Nodes
DownloadAndLoadQwenModel
Downloads a chosen Qwen 2.5-VL model into models/Qwen and returns the loaded model and processor. You can also choose which device to load the model onto (e.g. cuda:1 if you have multiple GPUs).
QwenVLDetection
Runs a detection prompt on an input image using the loaded model. The node outputs the raw text response and the bounding box coordinates.
The bounding boxes are converted to absolute pixel coordinates so that they can be directly fed into the SAM2 nodes.
Usage
- Place this repository inside your
ComfyUI/custom_nodesdirectory. - From the Download and Load Qwen2.5-VL Model node, select the model you want to use and, if necessary, choose the device (such as
cuda:1) where it should be loaded. The snapshot download will resume automatically if a previous attempt was interrupted. - Connect the output model to Qwen2.5-VL Object Detection, provide an image and the object you want to locate (e.g.
cat). The node will automatically build the detection prompt and return the bounding boxes. - Feed the resulting bounding boxes into the SAM2 workflow for further processing.
Languages
Python
100%