MCPcopy Create free account

hub / github.com/PeterYYZhang/few-shot-self-prompt-SAM / functions

Functions116 in github.com/PeterYYZhang/few-shot-self-prompt-SAM

↓ 11 callersMethodcat
(self, new_stats: "MaskData")
segment_anything/utils/amg.py:59
↓ 8 callersFunctiondice_coef
(groundtruth_mask, pred_mask)
utils/utils.py:47
↓ 8 callersMethodpredict
Predict masks for the given input prompts, using the currently set image. Arguments: point_coords (np.ndarray or None): A
segment_anything/predictor.py:92
↓ 6 callersMethodfilter
(self, keep: torch.Tensor)
segment_anything/utils/amg.py:44
↓ 4 callersFunctionget_embedding
(img, predictor)
main.py:18
↓ 4 callersMethodget_preprocess_shape
Compute the output size given input size and target long side length.
segment_anything/utils/transforms.py:94
↓ 4 callersMethodset_image
Calculates the image embeddings for the provided image, allowing masks to be predicted with the 'predict' method. Arguments:
segment_anything/predictor.py:34
↓ 3 callersMethod__init__
Args: dim (int): Number of input channels. num_heads (int): Number of attention heads in each ViT block.
segment_anything/modeling/image_encoder.py:122
↓ 3 callersFunction_build_sam
( encoder_embed_dim, encoder_depth, encoder_num_heads, encoder_global_attn_indexes, checkp
segment_anything/build_sam.py:55
↓ 3 callersMethod_pe_encoding
Positionally encode points that are normalized to [0,1].
segment_anything/modeling/prompt_encoder.py:185
↓ 3 callersMethod_separate_heads
(self, x: Tensor, num_heads: int)
segment_anything/modeling/transformer.py:208
↓ 3 callersMethodapply_coords
Expects a numpy array of length 2 in the final dimension. Requires the original image size in (H, W) format.
segment_anything/utils/transforms.py:33
↓ 3 callersFunctioncalculate_stability_score
Computes the stability score for a batch of masks. The stability score is the IoU between the binary masks obtained by thresholding the p
segment_anything/utils/amg.py:156
↓ 3 callersMethodget_dense_pe
Returns the positional encoding used to encode point prompts, applied to a dense set of points the shape of the image encoding.
segment_anything/modeling/prompt_encoder.py:62
↓ 3 callersMethoditems
(self)
segment_anything/utils/amg.py:41
↓ 3 callersMethodreset_image
Resets the currently set image.
segment_anything/predictor.py:262
↓ 2 callersMethod__init__
( self, embedding_dim: int, num_heads: int, downsample_rate: int = 1, )
segment_anything/modeling/transformer.py:191
↓ 2 callersFunctionbatched_mask_to_box
Calculates boxes in XYXY format around masks. Return [0,0,0,0] for an empty mask. For input shape C1xC2x...xHxW, the output shape is C1xC2x..
segment_anything/utils/amg.py:303
↓ 2 callersFunctionbox_xyxy_to_xywh
(box_xyxy: torch.Tensor)
segment_anything/utils/amg.py:91
↓ 2 callersFunctioncrop_len
(orig_len, n_crops, overlap)
segment_anything/utils/amg.py:215
↓ 2 callersMethodforward_with_coords
Positionally encode points that are not normalized to [0,1].
segment_anything/modeling/prompt_encoder.py:207
↓ 2 callersFunctionget_max_dist_point
(mask)
utils/utils.py:60
↓ 2 callersFunctionget_rel_pos
Get relative positional embeddings according to the relative positions of query and key sizes. Args: q_size (int): size of qu
segment_anything/modeling/image_encoder.py:292
↓ 2 callersFunctionmask_to_rle_pytorch
Encodes masks to an uncompressed RLE, in the format expected by pycoco tools.
segment_anything/utils/amg.py:107
↓ 2 callersMethodpostprocess_masks
Remove padding and upscale masks to the original image size. Arguments: masks (torch.Tensor): Batched masks from the mask_
segment_anything/modeling/sam.py:133
↓ 2 callersMethodpredict_masks
Predicts masks. See 'forward' for more details.
segment_anything/modeling/mask_decoder.py:112
↓ 2 callersMethodpredict_torch
Predict masks for the given input prompts, using the currently set image. Input prompts are batched torch tensors and are expected to
segment_anything/predictor.py:169
↓ 2 callersMethodpreprocess
Normalize pixel values and pad to a square input.
segment_anything/modeling/sam.py:164
↓ 2 callersFunctionremove_small_regions
Removes small disconnected regions and holes in a mask. Returns the mask and an indicator of if the mask has been modified.
segment_anything/utils/amg.py:267
↓ 2 callersFunctionrle_to_mask
Compute a binary mask from an uncompressed RLE.
segment_anything/utils/amg.py:138
↓ 2 callersFunctionshow_box
(box, ax)
utils/utils.py:25
↓ 2 callersFunctionuncrop_boxes_xyxy
(boxes: torch.Tensor, crop_box: List[int])
segment_anything/utils/amg.py:237
↓ 1 callersMethod__init__
( self, input_dim: int, hidden_dim: int, output_dim: int, num_layers:
segment_anything/modeling/mask_decoder.py:155
↓ 1 callersMethod__init__
( self, embedding_dim: int, mlp_dim: int, act: Type[nn.Module] = nn.GELU,
segment_anything/modeling/common.py:14
↓ 1 callersMethod__init__
Encodes prompts for input to SAM's mask decoder. Arguments: embed_dim (int): The prompts' embedding dimension im
segment_anything/modeling/prompt_encoder.py:17
↓ 1 callersMethod_embed_boxes
Embeds box prompts.
segment_anything/modeling/prompt_encoder.py:93
↓ 1 callersMethod_embed_masks
Embeds mask inputs.
segment_anything/modeling/prompt_encoder.py:102
↓ 1 callersMethod_embed_masks
(self, input_mask: torch.Tensor, has_mask_input: torch.Tensor)
segment_anything/utils/onnx.py:69
↓ 1 callersMethod_embed_points
Embeds point prompts.
segment_anything/modeling/prompt_encoder.py:73
↓ 1 callersMethod_embed_points
(self, point_coords: torch.Tensor, point_labels: torch.Tensor)
segment_anything/utils/onnx.py:51
↓ 1 callersMethod_generate_masks
(self, image: np.ndarray)
segment_anything/automatic_mask_generator.py:197
↓ 1 callersMethod_get_batch_size
Gets the batch size of the output given the batch size of the input prompts.
segment_anything/modeling/prompt_encoder.py:107
↓ 1 callersMethod_get_device
(self)
segment_anything/modeling/prompt_encoder.py:125
↓ 1 callersMethod_process_batch
( self, points: np.ndarray, im_size: Tuple[int, ...], crop_box: List[int],
segment_anything/automatic_mask_generator.py:266
↓ 1 callersMethod_process_crop
( self, image: np.ndarray, crop_box: List[int], crop_layer_idx: int, o
segment_anything/automatic_mask_generator.py:225
↓ 1 callersMethod_recombine_heads
(self, x: Tensor)
segment_anything/modeling/transformer.py:213
↓ 1 callersFunctionadd_decomposed_rel_pos
Calculate decomposed Relative Positional Embeddings from :paper:`mvitv2`. https://github.com/facebookresearch/mvit/blob/19786631e330df9f3622e
segment_anything/modeling/image_encoder.py:325
↓ 1 callersMethodapply_boxes
Expects a numpy array shape Bx4. Requires the original image size in (H, W) format.
segment_anything/utils/transforms.py:47
↓ 1 callersMethodapply_coords_torch
Expects a torch tensor with length 2 in the last dimension. Requires the original image size in (H, W) format.
segment_anything/utils/transforms.py:67
↓ 1 callersMethodapply_image
Expects a numpy array with shape HxWxC in uint8 format.
segment_anything/utils/transforms.py:26
↓ 1 callersFunctionarea_from_rle
(rle: Dict[str, Any])
segment_anything/utils/amg.py:152
↓ 1 callersFunctionbatch_iterator
(batch_size: int, *args)
segment_anything/utils/amg.py:98
↓ 1 callersFunctionbuild_all_layer_point_grids
Generates point grids for all crop layers.
segment_anything/utils/amg.py:189
↓ 1 callersFunctionbuild_point_grid
Generates a 2D grid of points evenly spaced in [0,1]x[0,1].
segment_anything/utils/amg.py:179
↓ 1 callersFunctioncoco_encode_rle
(uncompressed_rle: Dict[str, Any])
segment_anything/utils/amg.py:294
↓ 1 callersFunctiongenerate_crop_boxes
Generates a list of crop boxes of different sizes. Each layer has (2**i)**2 boxes for the ith layer.
segment_anything/utils/amg.py:200
↓ 1 callersMethodget_image_embedding
Returns the image embeddings for the currently set image, with shape 1xCxHxW, where C is the embedding dimension and (H,W) are
segment_anything/predictor.py:245
↓ 1 callersFunctionis_box_near_crop_edge
Filter masks at the edge of a crop, but not at the edge of the original image.
segment_anything/utils/amg.py:78
↓ 1 callersFunctionmain
()
main.py:325
↓ 1 callersMethodmask_postprocessing
(self, masks: torch.Tensor, orig_im_size: torch.Tensor)
segment_anything/utils/onnx.py:76
↓ 1 callersMethodpostprocess_small_regions
Removes small disconnected regions and holes in masks, then reruns box NMS to remove any new duplicates. Edits mask_data in
segment_anything/automatic_mask_generator.py:324
↓ 1 callersMethodresize_longest_image_size
( input_image_size: torch.Tensor, longest_side: int )
segment_anything/utils/onnx.py:42
↓ 1 callersMethodselect_masks
( self, masks: torch.Tensor, iou_preds: torch.Tensor, num_points: int )
segment_anything/utils/onnx.py:92
↓ 1 callersMethodset_torch_image
Calculates the image embeddings for the provided image, allowing masks to be predicted with the 'predict' method. Expects the input
segment_anything/predictor.py:63
↓ 1 callersFunctiontest
(args, predictor)
main.py:195
↓ 1 callersFunctiontest_visualize
(args, model, predictor)
main.py:69
↓ 1 callersMethodto_numpy
(self)
segment_anything/utils/amg.py:72
↓ 1 callersFunctiontrain
(args, predictor)
main.py:24
↓ 1 callersFunctionuncrop_masks
( masks: torch.Tensor, crop_box: List[int], orig_h: int, orig_w: int )
segment_anything/utils/amg.py:255
↓ 1 callersFunctionuncrop_points
(points: torch.Tensor, crop_box: List[int])
segment_anything/utils/amg.py:246
↓ 1 callersFunctionwindow_partition
Partition into non-overlapping windows with padding if needed. Args: x (tensor): input tokens with [B, H, W, C]. window_size
segment_anything/modeling/image_encoder.py:243
↓ 1 callersFunctionwindow_unpartition
Window unpartition into original sequences and removing padding. Args: windows (tensor): input tokens with [B * num_windows, window_s
segment_anything/modeling/image_encoder.py:267
Method__delitem__
(self, key: str)
segment_anything/utils/amg.py:35
Method__getitem__
(self, key: str)
segment_anything/utils/amg.py:38
Method__init__
Uses SAM to calculate the image embedding for an image, and then allow repeated, efficient mask prediction given prompts. Ar
segment_anything/predictor.py:18
Method__init__
Using a SAM model, generates masks for the entire image. Generates a grid of point prompts over the image, then filters low q
segment_anything/automatic_mask_generator.py:36
Method__init__
Predicts masks given an image and prompt embeddings, using a transformer architecture. Arguments: transformer_dim
segment_anything/modeling/mask_decoder.py:17
Method__init__
Args: img_size (int): Input image size. patch_size (int): Patch size. in_chans (int): Number of input ima
segment_anything/modeling/image_encoder.py:18
Method__init__
Args: dim (int): Number of input channels. num_heads (int): Number of attention heads. qkv_bias (bool):
segment_anything/modeling/image_encoder.py:188
Method__init__
Args: kernel_size (Tuple): kernel size of the projection layer. stride (Tuple): stride of the projection layer.
segment_anything/modeling/image_encoder.py:369
Method__init__
(self, num_channels: int, eps: float = 1e-6)
segment_anything/modeling/common.py:32
Method__init__
A transformer decoder that attends to an input image using queries whose positional embedding is supplied. Args: d
segment_anything/modeling/transformer.py:17
Method__init__
A transformer block with four layers: (1) self-attention of sparse inputs, (2) cross attention of sparse inputs to dense inputs, (3)
segment_anything/modeling/transformer.py:110
Method__init__
SAM predicts object masks from an image and input prompts. Arguments: image_encoder (ImageEncoderViT): The backbone used t
segment_anything/modeling/sam.py:22
Method__init__
(self, num_pos_feats: int = 64, scale: Optional[float] = None)
segment_anything/modeling/prompt_encoder.py:176
Method__init__
(self, target_length: int)
segment_anything/utils/transforms.py:23
Method__init__
( self, model: Sam, return_single_mask: bool, use_stability_score: bool = Fals
segment_anything/utils/onnx.py:25
Method__init__
(self, **kwargs)
segment_anything/utils/amg.py:22
Method__setitem__
(self, key: str, item: Any)
segment_anything/utils/amg.py:29
Methodapply_boxes_torch
Expects a torch tensor with shape Bx4. Requires the original image size in (H, W) format.
segment_anything/utils/transforms.py:83
Methodapply_image_torch
Expects batched images with shape BxCxHxW and float format. This transformation may not exactly match apply_image. apply_image is
segment_anything/utils/transforms.py:55
Functionbuild_sam_vit_b
(checkpoint=None)
segment_anything/build_sam.py:37
Functionbuild_sam_vit_h
(checkpoint=None)
segment_anything/build_sam.py:14
Functionbuild_sam_vit_l
(checkpoint=None)
segment_anything/build_sam.py:27
Methoddevice
(self)
segment_anything/predictor.py:259
Methoddevice
(self)
segment_anything/modeling/sam.py:50
Methodforward
Predict masks given image and prompt embeddings. Arguments: image_embeddings (torch.Tensor): the embeddings from the image
segment_anything/modeling/mask_decoder.py:71
Methodforward
(self, x)
segment_anything/modeling/mask_decoder.py:171
Methodforward
(self, x: torch.Tensor)
segment_anything/modeling/image_encoder.py:106
Methodforward
(self, x: torch.Tensor)
segment_anything/modeling/image_encoder.py:166
next →1–100 of 116, ranked by callers