ComfyOnline
UltralyticsDetectorProvider

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 into bbox (bounding box detection) and segm (segmentation) models. The node searches for these models in the ultralytics_bbox and ultralytics_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 the BBOX_DETECTOR, it wraps the YOLO model but is configured for segmentation tasks. If a bounding box model is loaded, this output returns a NO_SEGM_DETECTOR() object, indicating that segmentation is not available.

UltralyticsDetectorProvider Usage Tips

  1. Model Placement: Ensure that your Ultralytics YOLO .pt model files are placed in the correct directories (ultralytics/bbox for bounding box models and ultralytics/segm for segmentation models) within your ComfyUI models directory. The code also checks the 'download_model_base' directory if it exists.

  2. Model Selection: When selecting the model_name, pay attention to the prefix (bbox/ or segm/) to ensure you are loading the correct type of model.

  3. 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.

  4. Workflow Integration: Use the BBOX_DETECTOR and SEGM_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.

  5. Model Updates: The code updates model paths by checking folder_paths.models_dir and download_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.

related extension: