SAM3 BBox Collector 📦:
The SAM3BBoxCollector is an interactive node designed to facilitate the collection and normalization of bounding boxes for image segmentation tasks within the SAM3 framework. This node allows you to visually interact with an image canvas, enabling the addition of both positive and negative bounding boxes through intuitive mouse actions. Positive bounding boxes, which are drawn with a left-click and drag, are represented by cyan rectangles, while negative bounding boxes, created with a Shift+Left-click or Right-click and drag, appear as red rectangles. The primary function of this node is to convert these user-defined bounding boxes into a format suitable for further processing by the SAM3Segmentation node. By normalizing the bounding box coordinates to the image dimensions and converting them into a center-based format, the SAM3BBoxCollector ensures that the bounding boxes are ready for accurate segmentation tasks. This node is particularly beneficial for AI artists and developers who require a straightforward method to define areas of interest or exclusion within an image, enhancing the precision and effectiveness of segmentation models.
SAM3 BBox Collector 📦 Input Parameters:
image
The image parameter is the visual canvas on which you can interactively draw bounding boxes. It serves as the backdrop for defining areas of interest or exclusion. The image should be in a format that can be displayed on the interactive canvas, allowing you to click and drag to create bounding boxes. This parameter is crucial as it provides the context for the bounding boxes and determines the dimensions for normalizing the coordinates. There are no specific minimum or maximum values for this parameter, but it should be a valid image file that can be processed by the node.
bboxes
The bboxes parameter is a string that contains a JSON array of positive bounding boxes. These are the areas you want to highlight or include in the segmentation process. The parameter accepts a JSON-formatted string, with each bounding box defined by its coordinates. The default value is an empty array ([]), indicating no initial bounding boxes. This parameter impacts the node's execution by determining which areas of the image are considered positive examples for segmentation.
neg_bboxes
The neg_bboxes parameter is similar to bboxes but is used for defining negative bounding boxes. These are areas you want to exclude from the segmentation process. Like bboxes, this parameter accepts a JSON-formatted string, with each bounding box defined by its coordinates. The default value is also an empty array ([]). This parameter is essential for refining the segmentation process by specifying areas that should not be included in the final output.
SAM3 BBox Collector 📦 Output Parameters:
positive_bboxes
The positive_bboxes output parameter provides a structured representation of the positive bounding boxes collected from the image. It outputs a dictionary in the SAM3_BOXES_PROMPT format, containing normalized coordinates and labels for each positive bounding box. This output is crucial for the segmentation process, as it defines the areas of interest that the SAM3Segmentation node will focus on.
negative_bboxes
The negative_bboxes output parameter offers a similar structured representation for the negative bounding boxes. It outputs a dictionary in the SAM3_BOXES_PROMPT format, containing normalized coordinates and labels for each negative bounding box. This output is important for excluding specific areas from the segmentation process, ensuring that the final segmentation results are accurate and aligned with your intentions.
SAM3 BBox Collector 📦 Usage Tips:
- Ensure that the image provided is of high quality and clearly represents the areas you wish to segment, as this will improve the accuracy of the bounding boxes you draw.
- Use the interactive canvas to carefully define positive and negative bounding boxes, as precise bounding box placement will lead to better segmentation results.
- Regularly check the console output for messages about the number of bounding boxes collected to verify that your interactions are being correctly registered.
SAM3 BBox Collector 📦 Common Errors and Solutions:
JSONDecodeError
- Explanation: This error occurs when the
bboxesorneg_bboxesparameters contain invalid JSON strings that cannot be parsed. - Solution: Ensure that the input strings for
bboxesandneg_bboxesare correctly formatted JSON arrays. Use a JSON validator to check the syntax if necessary.
Image Dimension Error
- Explanation: This error might occur if the image dimensions cannot be determined, possibly due to an invalid image format.
- Solution: Verify that the image provided is in a supported format and can be processed by the node. Convert the image to a standard format like JPEG or PNG if needed.
