Large Model Prompt Segmentation
Function: Uses the Segment Anything model, inputs boxes or points prompts for image segmentation. This model relies on the segment-anything python library. If not installed, it needs to be installed from Qianyi’s pypi source using pip install segment-anything
.
Input Parameters:
Name | Type | Valid Range | Default Value | Meaning |
---|---|---|---|---|
Image |
ColorImage |
None |
None |
Input image, requires a color image with RGB channels. |
List of hint points |
List |
None |
None |
(np.ndarray or None): Nx2 array, each line of the array represents a hint pixel position (X, Y). |
Tooltip list |
List |
None |
None |
(np.ndarray or None): Nx4x2 array, each row of the array represents the coordinates of the four points of a prompt box, and its upper left corner and lower right corner will be calculated according to this calculation. |
Output Parameters:
Name | Type | Valid Range | Default Value | Meaning |
---|---|---|---|---|
Detection results |
DetectInstance |
None |
{} |
Returns bounding boxes, categories, scores and polygon. |
Parameter Settings:
Name | Type | Valid Range | Default Value | Meaning |
---|---|---|---|---|
Weight files |
File |
['.pth'] |
None |
Model file. The model needs to correspond to the model type. The official model download paths are: Base model: http://10.10.10.98:9000/inference/sam/sam_vit_b_01ec64.pth, Large model: http://10.10.10.98:9000/inference/sam/sam_vit_l_0b3195.pth, Huge model: http://10.10.10.98:9000/inference/sam/sam_vit_h_4b8939.pth |
Model type |
String |
['vit_b', 'vit_l', 'vit_h'] |
vit_b |
Model type. |
Enable GPU |
Bool |
None |
False |
Set whether to use the GPU for inference, if it is turned on, the computer needs to have a graphics card environment. |
Confidence threshold |
Float |
[0.0, 1.0] |
0.5 |
Detection threshold. |
Output multiple results |
Bool |
None |
False |
For each prompt, whether to output multiple results, if true, each prompt outputs 3 masks, if false, only one is output. |
Extra class name |
String |
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29'] |
0 |
You can set the category name according to the scene to perform operations such as filtering. |