MCPcopy Create free account

hub / github.com/NVIDIA-AI-IOT/nanosam / functions

Functions234 in github.com/NVIDIA-AI-IOT/nanosam

↓ 11 callersMethod__init__
(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.)
nanosam/mobile_sam/modeling/tiny_vit_sam.py:190
↓ 9 callersMethodcat
(self, new_stats: "MaskData")
nanosam/mobile_sam/utils/amg.py:59
↓ 9 callersFunctionpose_to_sam_points
(pose, fg_kps, bg_kps)
nanosam/utils/trt_pose.py:105
↓ 9 callersMethodpredict
(self, image: PIL.Image.Image, texts: Sequence[str])
nanosam/utils/owlvit.py:33
↓ 7 callersMethodset_image
(self, image)
nanosam/utils/tracker.py:77
↓ 4 callersMethodfilter
(self, keep: torch.Tensor)
nanosam/mobile_sam/utils/amg.py:44
↓ 4 callersMethodget_preprocess_shape
Compute the output size given input size and target long side length.
nanosam/mobile_sam/utils/transforms.py:94
↓ 4 callersMethoditems
(self)
nanosam/mobile_sam/utils/amg.py:41
↓ 3 callersMethod__init__
Args: dim (int): Number of input channels. num_heads (int): Number of attention heads in each ViT block.
nanosam/mobile_sam/modeling/image_encoder.py:122
↓ 3 callersFunction_build_sam
( encoder_embed_dim, encoder_depth, encoder_num_heads, encoder_global_attn_indexes, checkp
nanosam/mobile_sam/build_sam.py:105
↓ 3 callersMethod_pe_encoding
Positionally encode points that are normalized to [0,1].
nanosam/mobile_sam/modeling/prompt_encoder.py:185
↓ 3 callersMethodapply_coords
Expects a numpy array of length 2 in the final dimension. Requires the original image size in (H, W) format.
nanosam/mobile_sam/utils/transforms.py:33
↓ 3 callersFunctionbbox2points
(box)
nanosam/utils/tracker_online_learning.py:26
↓ 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.
nanosam/mobile_sam/modeling/prompt_encoder.py:62
↓ 3 callersMethodreset_image
Resets the currently set image.
nanosam/mobile_sam/predictor.py:264
↓ 3 callersFunctionupscale_mask
(mask, image_shape, size=256)
nanosam/utils/predictor.py:124
↓ 2 callersMethod__init__
( self, embedding_dim: int, num_heads: int, downsample_rate: int = 1, )
nanosam/mobile_sam/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..
nanosam/mobile_sam/utils/amg.py:303
↓ 2 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
nanosam/mobile_sam/utils/amg.py:156
↓ 2 callersFunctioncreate_model
(name: str)
nanosam/models/registry.py:27
↓ 2 callersMethodfit_model
(self, target, iters)
nanosam/utils/tracker_online_learning.py:178
↓ 2 callersMethodfit_token
Finds token that when dot-producted with features minimizes MSE with low resolution masks. Args: features (Nx25
nanosam/utils/tracker.py:93
↓ 2 callersMethodforward_with_coords
Positionally encode points that are not normalized to [0,1].
nanosam/mobile_sam/modeling/prompt_encoder.py:207
↓ 2 callersFunctionload_image_encoder_engine
(path: str)
nanosam/utils/predictor.py:49
↓ 2 callersFunctionmask_to_rle_pytorch
Encodes masks to an uncompressed RLE, in the format expected by pycoco tools.
nanosam/mobile_sam/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_
nanosam/mobile_sam/modeling/sam.py:134
↓ 2 callersMethodpredict_mask
(self, points=None, point_labels=None, box=None, mask_input=None)
nanosam/utils/tracker_online_learning.py:112
↓ 2 callersMethodpredict_mask
(self, points=None, point_labels=None, box=None, mask_input=None)
nanosam/utils/tracker.py:80
↓ 2 callersMethodpredict_masks
Predicts masks. See 'forward' for more details.
nanosam/mobile_sam/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
nanosam/mobile_sam/predictor.py:170
↓ 2 callersMethodpreprocess
Normalize pixel values and pad to a square input.
nanosam/mobile_sam/modeling/sam.py:165
↓ 2 callersFunctionrle_to_mask
Compute a binary mask from an uncompressed RLE.
nanosam/mobile_sam/utils/amg.py:138
↓ 2 callersMethodset_image
(self, image)
nanosam/utils/tracker_online_learning.py:109
↓ 2 callersFunctionuncrop_boxes_xyxy
(boxes: torch.Tensor, crop_box: List[int])
nanosam/mobile_sam/utils/amg.py:237
↓ 1 callersMethod__init__
( self, input_dim: int, hidden_dim: int, output_dim: int, num_layers:
nanosam/mobile_sam/modeling/mask_decoder.py:156
↓ 1 callersMethod__init__
( self, embedding_dim: int, mlp_dim: int, act: Type[nn.Module] = nn.GELU,
nanosam/mobile_sam/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
nanosam/mobile_sam/modeling/prompt_encoder.py:17
↓ 1 callersMethod_embed_boxes
Embeds box prompts.
nanosam/mobile_sam/modeling/prompt_encoder.py:93
↓ 1 callersMethod_embed_masks
Embeds mask inputs.
nanosam/mobile_sam/modeling/prompt_encoder.py:102
↓ 1 callersMethod_embed_masks
(self, input_mask: torch.Tensor, has_mask_input: torch.Tensor)
nanosam/mobile_sam/utils/onnx.py:69
↓ 1 callersMethod_embed_points
Embeds point prompts.
nanosam/mobile_sam/modeling/prompt_encoder.py:73
↓ 1 callersMethod_embed_points
(self, point_coords: torch.Tensor, point_labels: torch.Tensor)
nanosam/mobile_sam/utils/onnx.py:51
↓ 1 callersMethod_generate_masks
(self, image: np.ndarray)
nanosam/mobile_sam/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.
nanosam/mobile_sam/modeling/prompt_encoder.py:107
↓ 1 callersMethod_get_device
(self)
nanosam/mobile_sam/modeling/prompt_encoder.py:125
↓ 1 callersMethod_process_batch
( self, points: np.ndarray, im_size: Tuple[int, ...], crop_box: List[int],
nanosam/mobile_sam/automatic_mask_generator.py:266
↓ 1 callersMethod_process_crop
( self, image: np.ndarray, crop_box: List[int], crop_layer_idx: int, o
nanosam/mobile_sam/automatic_mask_generator.py:225
↓ 1 callersMethod_recombine_heads
(self, x: Tensor)
nanosam/mobile_sam/modeling/transformer.py:213
↓ 1 callersMethod_separate_heads
(self, x: Tensor, num_heads: int)
nanosam/mobile_sam/modeling/transformer.py:208
↓ 1 callersFunctionadd_decomposed_rel_pos
Calculate decomposed Relative Positional Embeddings from :paper:`mvitv2`. https://github.com/facebookresearch/mvit/blob/19786631e330df9f3622e
nanosam/mobile_sam/modeling/image_encoder.py:325
↓ 1 callersMethodapply_boxes
Expects a numpy array shape Bx4. Requires the original image size in (H, W) format.
nanosam/mobile_sam/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.
nanosam/mobile_sam/utils/transforms.py:67
↓ 1 callersMethodapply_image
Expects a numpy array with shape HxWxC in uint8 format.
nanosam/mobile_sam/utils/transforms.py:26
↓ 1 callersMethodapply_token
(self, features, token)
nanosam/utils/tracker.py:111
↓ 1 callersFunctionarea_from_rle
(rle: Dict[str, Any])
nanosam/mobile_sam/utils/amg.py:152
↓ 1 callersFunctionbatch_iterator
(batch_size: int, *args)
nanosam/mobile_sam/utils/amg.py:98
↓ 1 callersFunctionbbox2points
(box)
nanosam/utils/tracker.py:27
↓ 1 callersFunctionbbox2points
(bbox)
examples/segment_from_owl.py:34
↓ 1 callersFunctionbox_xywh_to_xyxy
(box)
nanosam/tools/eval_coco.py:47
↓ 1 callersFunctionbox_xyxy_to_xywh
(box_xyxy: torch.Tensor)
nanosam/mobile_sam/utils/amg.py:91
↓ 1 callersFunctionbuild_all_layer_point_grids
Generates point grids for all crop layers.
nanosam/mobile_sam/utils/amg.py:189
↓ 1 callersFunctionbuild_point_grid
Generates a 2D grid of points evenly spaced in [0,1]x[0,1].
nanosam/mobile_sam/utils/amg.py:179
↓ 1 callersFunctioncoco_encode_rle
(uncompressed_rle: Dict[str, Any])
nanosam/mobile_sam/utils/amg.py:294
↓ 1 callersFunctioncrop_len
(orig_len, n_crops, overlap)
nanosam/mobile_sam/utils/amg.py:215
↓ 1 callersFunctioncv2_to_pil
(image)
examples/demo_pose_tshirt.py:35
↓ 1 callersFunctioncv2_to_pil
(image)
examples/demo_click_segment_track.py:28
↓ 1 callersFunctiondefault_transform
()
nanosam/datasets/image_folder.py:23
↓ 1 callersFunctiondown_to_64
(x)
nanosam/utils/tracker_online_learning.py:30
↓ 1 callersFunctiondown_to_64
(x)
nanosam/utils/tracker.py:31
↓ 1 callersFunctiondraw_bbox
(bbox)
examples/segment_from_owl.py:44
↓ 1 callersFunctiondraw_detection
(index)
examples/segment_from_owl.py:70
↓ 1 callersFunctionfilter_results_by_area
(results, min=None, max=None)
nanosam/tools/compute_eval_coco_metrics.py:21
↓ 1 callersFunctionfilter_results_by_category_id
(results, category_id)
nanosam/tools/compute_eval_coco_metrics.py:32
↓ 1 callersMethodforward_features
(self, x)
nanosam/mobile_sam/modeling/tiny_vit_sam.py:600
↓ 1 callersFunctiongenerate_crop_boxes
Generates a list of crop boxes of different sizes. Each layer has (2**i)**2 boxes for the ith layer.
nanosam/mobile_sam/utils/amg.py:200
↓ 1 callersFunctionget_pants_points
(pose)
examples/segment_from_pose.py:35
↓ 1 callersFunctionget_rel_pos
Get relative positional embeddings according to the relative positions of query and key sizes. Args: q_size (int): size of qu
nanosam/mobile_sam/modeling/image_encoder.py:292
↓ 1 callersFunctionget_torso_points
(pose)
examples/demo_pose_tshirt.py:28
↓ 1 callersMethodinit
(self, image, point=None, box=None)
nanosam/utils/tracker.py:115
↓ 1 callersFunctioniou
(mask_a, mask_b)
nanosam/tools/eval_coco.py:57
↓ 1 callersFunctionis_box_near_crop_edge
Filter masks at the edge of a crop, but not at the edge of the original image.
nanosam/mobile_sam/utils/amg.py:78
↓ 1 callersFunctionlist_models
()
nanosam/models/registry.py:31
↓ 1 callersFunctionload_mask_decoder_engine
(path: str)
nanosam/utils/predictor.py:24
↓ 1 callersFunctionmask_to_box
(mask)
nanosam/utils/tracker_online_learning.py:37
↓ 1 callersFunctionmask_to_centroid
(mask)
nanosam/utils/tracker.py:49
↓ 1 callersMethodpostprocess
(self, image_shape, cmap, paf)
nanosam/utils/trt_pose.py:65
↓ 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
nanosam/mobile_sam/automatic_mask_generator.py:324
↓ 1 callersFunctionpredict_and_show
(N, index, pose, fg_points, bg_points)
examples/segment_from_pose.py:96
↓ 1 callersFunctionpredict_box
(predictor, image, box, set_image=True)
nanosam/tools/eval_coco.py:26
↓ 1 callersMethodpreprocess
(self, image)
nanosam/utils/trt_pose.py:59
↓ 1 callersFunctionpreprocess_image
(image, size: int = 512)
nanosam/utils/predictor.py:65
↓ 1 callersFunctionpreprocess_points
(points, image_size, size: int = 1024)
nanosam/utils/predictor.py:92
↓ 1 callersFunctionregister_model
(name: str)
nanosam/models/registry.py:20
↓ 1 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.
nanosam/mobile_sam/utils/amg.py:267
↓ 1 callersMethodreset
(self)
nanosam/utils/tracker.py:126
↓ 1 callersMethodresize_longest_image_size
( input_image_size: torch.Tensor, longest_side: int )
nanosam/mobile_sam/utils/onnx.py:42
↓ 1 callersFunctionrun_export
( model_type: str, checkpoint: str, output: str, opset: int, return_single_mask: bool,
nanosam/tools/export_sam_mask_decoder_onnx.py:101
↓ 1 callersFunctionrun_mask_decoder
(mask_decoder_engine, features, points=None, point_labels=None, mask_input=None)
nanosam/utils/predictor.py:98
↓ 1 callersMethodselect_masks
( self, masks: torch.Tensor, iou_preds: torch.Tensor, num_points: int )
nanosam/mobile_sam/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:
nanosam/mobile_sam/predictor.py:34
next →1–100 of 234, ranked by callers