Introduction:
- ComfyUI-Impact-Subpack Repository
- Stars: 2500
- Author: ltdrdata ComfyUI-Impact-Subpack is an extension that complements the Impact Pack, offering features not deemed suitable for the main pack. This extension includes various nodes for image processing, including those related to object detection using Ultralytics models.
UltralyticsDetectorProvider Introduction
The UltralyticsDetectorProvider
node in ComfyUI-Impact-Subpack is designed to load Ultralytics YOLO (You Only Look Once) models for object detection and segmentation tasks. It allows users to easily integrate pre-trained YOLO models into their ComfyUI workflows. The node supports both bounding box detection and segmentation models.
UltralyticsDetectorProvider Input
The UltralyticsDetectorProvider
node accepts the following input:
model_name
: A dropdown list of available Ultralytics models. The models are categorized intobbox
(bounding box detection) andsegm
(segmentation) models. The node searches for these models in theultralytics_bbox
andultralytics_segm
directories within the ComfyUI models directory.
UltralyticsDetectorProvider Output
The UltralyticsDetectorProvider
node provides the following outputs:
BBOX_DETECTOR
: An object that can be used for bounding box detection. It is essentially a wrapper around the loaded YOLO model, configured for bounding box prediction.SEGM_DETECTOR
: An object that can be used for instance segmentation. Similar to theBBOX_DETECTOR
, it wraps the YOLO model but is configured for segmentation tasks. If a bounding box model is loaded, this output returns aNO_SEGM_DETECTOR()
object, indicating that segmentation is not available.
UltralyticsDetectorProvider Usage Tips
-
Model Placement: Ensure that your Ultralytics YOLO
.pt
model files are placed in the correct directories (ultralytics/bbox
for bounding box models andultralytics/segm
for segmentation models) within your ComfyUI models directory. The code also checks the 'download_model_base' directory if it exists. -
Model Selection: When selecting the
model_name
, pay attention to the prefix (bbox/
orsegm/
) to ensure you are loading the correct type of model. -
Error Handling: If the node cannot find the specified model, it will raise a
ValueError
and log the directories it searched in. Check the ComfyUI console for error messages to diagnose issues. -
Workflow Integration: Use the
BBOX_DETECTOR
andSEGM_DETECTOR
outputs in subsequent nodes to perform object detection and segmentation on images. These outputs will need to be compatible with custom nodes designed to work with these detector types. -
Model Updates: The code updates model paths by checking
folder_paths.models_dir
anddownload_model_base
to ensure it finds all available models. If you add new models, ensure they are placed in these directories or that these directories are correctly configured in your ComfyUI setup.