MCPcopy Create free account

hub / github.com/LiuTingWed/SAM-Not-Perfect / functions

Functions134 in github.com/LiuTingWed/SAM-Not-Perfect

↓ 11 callersMethodcat
(self, new_stats: "MaskData")
segment_anything/utils/amg.py:59
↓ 6 callersMethodfilter
(self, keep: torch.Tensor)
segment_anything/utils/amg.py:44
↓ 5 callersMethoditems
(self)
segment_anything/utils/amg.py:41
↓ 4 callersMethodget_preprocess_shape
Compute the output size given input size and target long side length.
segment_anything/utils/transforms.py:94
↓ 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 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 callersFunctionbinary_loader
(path)
scripts/other_methods_dice_mae.py:9
↓ 2 callersFunctionbinary_loader
(path)
scripts/sam_f1_dice_mae.py:69
↓ 2 callersFunctionbinary_loader
(path)
scripts/sam_dice_f1_mae.py:69
↓ 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_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 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 callersFunctioncalculate_f_measure
(prediction, ground_truth, beta=1)
scripts/other_methods_dice_mae.py:40
↓ 1 callersFunctioncalculate_f_measure
(prediction, ground_truth, beta=1)
scripts/sam_f1_dice_mae.py:53
↓ 1 callersFunctioncalculate_f_measure
(prediction, ground_truth, beta=1)
scripts/sam_dice_f1_mae.py:53
↓ 1 callersFunctioncoco_encode_rle
(uncompressed_rle: Dict[str, Any])
segment_anything/utils/amg.py:294
↓ 1 callersFunctioncreate_exp_dir
(path, scripts_to_save=None)
scripts/sam_f1_dice_mae.py:26
↓ 1 callersFunctioncreate_exp_dir
(path, scripts_to_save=None)
scripts/sam_dice_f1_mae.py:26
↓ 1 callersFunctiondice_coefficient
(gt, pred)
scripts/other_methods_dice_mae.py:34
↓ 1 callersFunctiondice_coefficient
(gt, pred)
scripts/sam_f1_dice_mae.py:88
↓ 1 callersFunctiondice_coefficient
(gt, pred)
scripts/sam_dice_f1_mae.py:88
↓ 1 callersFunctionfind_best_F1
(prediction_folder, ground_truth_file, folder)
scripts/sam_f1_dice_mae.py:106
↓ 1 callersFunctionfind_best_dice
(prediction_folder, ground_truth_file, folder)
scripts/sam_dice_f1_mae.py:106
↓ 1 callersMethodgenerate
Generates masks for the given image. Arguments: image (np.ndarray): The image to generate masks for, in HWC uint8 format.
segment_anything/automatic_mask_generator.py:137
↓ 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 callersFunctionget_amg_kwargs
(args)
scripts/amg.py:190
↓ 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
(ground_truth_folder, prediction_folder, results_file)
scripts/other_methods_dice_mae.py:60
↓ 1 callersFunctionmain
()
scripts/sam_f1_dice_mae.py:142
↓ 1 callersFunctionmain
()
scripts/sam_dice_f1_mae.py:141
↓ 1 callersFunctionmain
(args: argparse.Namespace)
scripts/amg.py:208
↓ 1 callersMethodmask_postprocessing
(self, masks: torch.Tensor, orig_im_size: torch.Tensor)
segment_anything/utils/onnx.py:76
↓ 1 callersFunctionmean_absolute_error
(gt, pred)
scripts/other_methods_dice_mae.py:55
↓ 1 callersFunctionmean_absolute_error
(gt, pred)
scripts/sam_f1_dice_mae.py:100
↓ 1 callersFunctionmean_absolute_error
(gt, pred)
scripts/sam_dice_f1_mae.py:100
↓ 1 callersFunctionnormalize_pil
(pre, gt)
scripts/other_methods_dice_mae.py:15
↓ 1 callersFunctionnormalize_pil
(pre, gt)
scripts/sam_f1_dice_mae.py:75
↓ 1 callersFunctionnormalize_pil
(pre, gt)
scripts/sam_dice_f1_mae.py:75
↓ 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 callersFunctionrun_export
( model_type: str, checkpoint: str, output: str, opset: int, return_single_mask: bool,
scripts/export_onnx_model.py:97
↓ 1 callersMethodselect_masks
( self, masks: torch.Tensor, iou_preds: torch.Tensor, num_points: int )
segment_anything/utils/onnx.py:92
↓ 1 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
↓ 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 callersFunctionto_numpy
(tensor)
scripts/export_onnx_model.py:168
↓ 1 callersMethodto_numpy
(self)
segment_anything/utils/amg.py:72
↓ 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
↓ 1 callersFunctionwrite_masks_to_folder
(masks: List[Dict[str, Any]], path: str)
scripts/amg.py:165
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
next →1–100 of 134, ranked by callers