SYMBOL INDEX (574 symbols across 48 files) FILE: assets/crop_faces.py function detect_and_crop_faces (line 6) | def detect_and_crop_faces(input_dir, output_dir): FILE: assets/segmentation.py function merge_instances (line 8) | def merge_instances(orig_img, indices, ins_bboxes, ins_images): function det_seg_img (line 28) | def det_seg_img(image, label): function segment_images_in_folder (line 36) | def segment_images_in_folder(input_folder, output_folder): FILE: eval/grounded_sam/florence2/configuration_florence2.py class Florence2VisionConfig (line 25) | class Florence2VisionConfig(PretrainedConfig): method __init__ (line 83) | def __init__( class Florence2LanguageConfig (line 122) | class Florence2LanguageConfig(PretrainedConfig): method __init__ (line 202) | def __init__( class Florence2Config (line 272) | class Florence2Config(PretrainedConfig): method __init__ (line 317) | def __init__( FILE: eval/grounded_sam/florence2/modeling_florence2.py class LearnedAbsolutePositionEmbedding2D (line 70) | class LearnedAbsolutePositionEmbedding2D(nn.Module): method __init__ (line 75) | def __init__(self, embedding_dim=256, num_pos=50): method forward (line 80) | def forward(self, pixel_values): class PositionalEmbeddingCosine1D (line 103) | class PositionalEmbeddingCosine1D(nn.Module): method __init__ (line 114) | def __init__( method forward (line 137) | def forward(self, seq_embeds: torch.Tensor) -> torch.Tensor: class LearnedAbsolutePositionEmbedding1D (line 161) | class LearnedAbsolutePositionEmbedding1D(nn.Module): method __init__ (line 169) | def __init__( method forward (line 177) | def forward(self, seq_embeds: torch.Tensor) -> torch.Tensor: class MySequential (line 203) | class MySequential(nn.Sequential): method forward (line 204) | def forward(self, *inputs): class PreNorm (line 213) | class PreNorm(nn.Module): method __init__ (line 214) | def __init__(self, norm, fn, drop_path=None): method forward (line 220) | def forward(self, x, *args, **kwargs): class Mlp (line 235) | class Mlp(nn.Module): method __init__ (line 236) | def __init__( method forward (line 252) | def forward(self, x, size): class DepthWiseConv2d (line 256) | class DepthWiseConv2d(nn.Module): method __init__ (line 257) | def __init__( method forward (line 275) | def forward(self, x, size): class ConvEmbed (line 286) | class ConvEmbed(nn.Module): method __init__ (line 290) | def __init__( method forward (line 315) | def forward(self, x, size): class ChannelAttention (line 335) | class ChannelAttention(nn.Module): method __init__ (line 337) | def __init__(self, dim, groups=8, qkv_bias=True): method forward (line 344) | def forward(self, x, size): class ChannelBlock (line 359) | class ChannelBlock(nn.Module): method __init__ (line 361) | def __init__(self, dim, groups, mlp_ratio=4., qkv_bias=True, method forward (line 381) | def forward(self, x, size): function window_partition (line 393) | def window_partition(x, window_size: int): function window_reverse (line 400) | def window_reverse(windows, batch_size: int, window_size: int, H: int, W... class WindowAttention (line 409) | class WindowAttention(nn.Module): method __init__ (line 410) | def __init__(self, dim, num_heads, window_size, qkv_bias=True): method forward (line 424) | def forward(self, x, size): class SpatialBlock (line 469) | class SpatialBlock(nn.Module): method __init__ (line 471) | def __init__(self, dim, num_heads, window_size, method forward (line 491) | def forward(self, x, size): class DaViT (line 502) | class DaViT(nn.Module): method __init__ (line 525) | def __init__( method dim_out (line 616) | def dim_out(self): method _init_weights (line 619) | def _init_weights(self, m): method forward_features_unpool (line 636) | def forward_features_unpool(self, x): method forward_features (line 651) | def forward_features(self, x): method forward (line 662) | def forward(self, x): method from_config (line 668) | def from_config(cls, config): function _get_unpad_data (line 690) | def _get_unpad_data(attention_mask): function shift_tokens_right (line 702) | def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decod... class Florence2LearnedPositionalEmbedding (line 718) | class Florence2LearnedPositionalEmbedding(nn.Embedding): method __init__ (line 723) | def __init__(self, num_embeddings: int, embedding_dim: int): method forward (line 729) | def forward(self, input_ids: torch.Tensor, past_key_values_length: int... class Florence2ScaledWordEmbedding (line 740) | class Florence2ScaledWordEmbedding(nn.Embedding): method __init__ (line 745) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 749) | def forward(self, input_ids: torch.Tensor): class Florence2Attention (line 753) | class Florence2Attention(nn.Module): method __init__ (line 756) | def __init__( method _shape (line 787) | def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 790) | def forward( class Florence2FlashAttention2 (line 911) | class Florence2FlashAttention2(Florence2Attention): method __init__ (line 919) | def __init__(self, *args, **kwargs): method _reshape (line 927) | def _reshape(self, tensor: torch.Tensor, seq_len: int, bsz: int): method forward (line 930) | def forward( method _flash_attention_forward (line 1031) | def _flash_attention_forward( method _upad_input (line 1091) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... class Florence2SdpaAttention (line 1130) | class Florence2SdpaAttention(Florence2Attention): method forward (line 1131) | def forward( class Florence2EncoderLayer (line 1243) | class Florence2EncoderLayer(nn.Module): method __init__ (line 1244) | def __init__(self, config: Florence2LanguageConfig): method forward (line 1262) | def forward( class Florence2DecoderLayer (line 1313) | class Florence2DecoderLayer(nn.Module): method __init__ (line 1314) | def __init__(self, config: Florence2LanguageConfig): method forward (line 1343) | def forward( class Florence2LanguagePreTrainedModel (line 1434) | class Florence2LanguagePreTrainedModel(PreTrainedModel): method _init_weights (line 1444) | def _init_weights(self, module): method dummy_inputs (line 1456) | def dummy_inputs(self): class Florence2Encoder (line 1466) | class Florence2Encoder(Florence2LanguagePreTrainedModel): method __init__ (line 1476) | def __init__(self, config: Florence2LanguageConfig, embed_tokens: Opti... method get_input_embeddings (line 1507) | def get_input_embeddings(self): method set_input_embeddings (line 1510) | def set_input_embeddings(self, value): method forward (line 1513) | def forward( class Florence2Decoder (line 1654) | class Florence2Decoder(Florence2LanguagePreTrainedModel): method __init__ (line 1663) | def __init__(self, config: Florence2LanguageConfig, embed_tokens: Opti... method get_input_embeddings (line 1692) | def get_input_embeddings(self): method set_input_embeddings (line 1695) | def set_input_embeddings(self, value): method forward (line 1698) | def forward( class Florence2LanguageModel (line 1941) | class Florence2LanguageModel(Florence2LanguagePreTrainedModel): method __init__ (line 1944) | def __init__(self, config: Florence2LanguageConfig): method _tie_weights (line 1956) | def _tie_weights(self): method get_input_embeddings (line 1961) | def get_input_embeddings(self): method set_input_embeddings (line 1964) | def set_input_embeddings(self, value): method get_encoder (line 1969) | def get_encoder(self): method get_decoder (line 1972) | def get_decoder(self): method forward (line 1975) | def forward( class Florence2LanguageForConditionalGeneration (line 2063) | class Florence2LanguageForConditionalGeneration(Florence2LanguagePreTrai... method __init__ (line 2068) | def __init__(self, config: Florence2LanguageConfig): method get_encoder (line 2077) | def get_encoder(self): method get_decoder (line 2080) | def get_decoder(self): method resize_token_embeddings (line 2083) | def resize_token_embeddings(self, new_num_tokens: int, pad_to_multiple... method _resize_final_logits_bias (line 2088) | def _resize_final_logits_bias(self, new_num_tokens: int) -> None: method get_output_embeddings (line 2097) | def get_output_embeddings(self): method set_output_embeddings (line 2100) | def set_output_embeddings(self, new_embeddings): method forward (line 2103) | def forward( method prepare_inputs_for_generation (line 2184) | def prepare_inputs_for_generation( method prepare_decoder_input_ids_from_labels (line 2223) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method _reorder_cache (line 2227) | def _reorder_cache(past_key_values, beam_idx): class Florence2Seq2SeqLMOutput (line 2238) | class Florence2Seq2SeqLMOutput(ModelOutput): class Florence2PreTrainedModel (line 2330) | class Florence2PreTrainedModel(PreTrainedModel): method _supports_flash_attn_2 (line 2337) | def _supports_flash_attn_2(self): method _supports_sdpa (line 2345) | def _supports_sdpa(self): class Florence2VisionModel (line 2422) | class Florence2VisionModel(Florence2PreTrainedModel): method __init__ (line 2423) | def __init__(self, config: Florence2VisionConfig): method forward (line 2430) | def forward(self, pixel_values): class Florence2VisionModelWithProjection (line 2442) | class Florence2VisionModelWithProjection(Florence2PreTrainedModel): method __init__ (line 2443) | def __init__(self, config: Florence2VisionConfig): method _build_image_projection_layers (line 2452) | def _build_image_projection_layers(self, config): method forward (line 2480) | def forward(self, pixel_values): class Florence2ForConditionalGeneration (line 2533) | class Florence2ForConditionalGeneration(Florence2PreTrainedModel): method __init__ (line 2534) | def __init__(self, config: Florence2Config): method _build_image_projection_layers (line 2555) | def _build_image_projection_layers(self, config): method get_encoder (line 2583) | def get_encoder(self): method get_decoder (line 2586) | def get_decoder(self): method get_input_embeddings (line 2589) | def get_input_embeddings(self): method resize_token_embeddings (line 2592) | def resize_token_embeddings(self, new_num_tokens: Optional[int] = None... method _encode_image (line 2600) | def _encode_image(self, pixel_values): method _merge_input_ids_with_image_features (line 2646) | def _merge_input_ids_with_image_features( method forward (line 2673) | def forward( method generate (line 2780) | def generate( method prepare_inputs_for_generation (line 2803) | def prepare_inputs_for_generation( method prepare_decoder_input_ids_from_labels (line 2844) | def prepare_decoder_input_ids_from_labels(self, labels: torch.Tensor): method _reorder_cache (line 2847) | def _reorder_cache(self, *args, **kwargs): FILE: eval/grounded_sam/florence2/processing_florence2.py function is_url (line 43) | def is_url(val) -> bool: function is_image_or_image_url (line 47) | def is_image_or_image_url(elem): function _is_str_or_image (line 51) | def _is_str_or_image(elem): class Florence2Processor (line 55) | class Florence2Processor(ProcessorMixin): method __init__ (line 73) | def __init__( method _construct_prompts (line 140) | def _construct_prompts(self, text): method __call__ (line 158) | def __call__( method batch_decode (line 287) | def batch_decode(self, *args, **kwargs): method decode (line 295) | def decode(self, *args, **kwargs): method model_input_names (line 304) | def model_input_names(self): method post_process_generation (line 309) | def post_process_generation(self, text=None, sequence=None, transition... class BoxQuantizer (line 384) | class BoxQuantizer(object): method __init__ (line 385) | def __init__(self, mode, bins): method quantize (line 389) | def quantize(self, boxes: torch.Tensor, size): method dequantize (line 418) | def dequantize(self, boxes: torch.Tensor, size): class CoordinatesQuantizer (line 446) | class CoordinatesQuantizer(object): method __init__ (line 451) | def __init__(self, mode, bins): method quantize (line 455) | def quantize(self, coordinates: torch.Tensor, size): method dequantize (line 479) | def dequantize(self, coordinates: torch.Tensor, size): class Florence2PostProcesser (line 505) | class Florence2PostProcesser(object): method __init__ (line 532) | def __init__( method _create_black_list_of_phrase_grounding (line 554) | def _create_black_list_of_phrase_grounding(self): method _create_default_config (line 590) | def _create_default_config(self): method init_quantizers (line 637) | def init_quantizers(self): method decode_with_spans (line 655) | def decode_with_spans(self, tokenizer, token_ids): method parse_od_from_text_and_spans (line 678) | def parse_od_from_text_and_spans( method parse_ocr_from_text_and_spans (line 709) | def parse_ocr_from_text_and_spans(self, method parse_phrase_grounding_from_text_and_spans (line 750) | def parse_phrase_grounding_from_text_and_spans(self, text, pattern, im... method parse_description_with_bboxes_from_text_and_spans (line 814) | def parse_description_with_bboxes_from_text_and_spans( method parse_description_with_polygons_from_text_and_spans (line 922) | def parse_description_with_polygons_from_text_and_spans(self, text, pa... method __call__ (line 1033) | def __call__( FILE: eval/grounded_sam/grounded_sam2_florence2_autolabel_pipeline.py class FlorenceSAM (line 17) | class FlorenceSAM: method __init__ (line 39) | def __init__(self, device): method __str__ (line 76) | def __str__(self): method run_florence2 (line 81) | def run_florence2(self, task_prompt, text_input, image): method caption (line 120) | def caption(self, image, caption_task_prompt=''): method segmentation (line 128) | def segmentation(self, image, input_boxes, seg_model="sam"): method post_process_results (line 148) | def post_process_results(self, image, caption, labels, detections, out... method caption_phrase_grounding_and_segmentation (line 205) | def caption_phrase_grounding_and_segmentation( method od_grounding_and_segmentation (line 245) | def od_grounding_and_segmentation( method od_grounding (line 277) | def od_grounding( method phrase_grounding_and_segmentation (line 302) | def phrase_grounding_and_segmentation( FILE: eval/grounded_sam/sam2/automatic_mask_generator.py class SAM2AutomaticMaskGenerator (line 36) | class SAM2AutomaticMaskGenerator: method __init__ (line 37) | def __init__( method from_pretrained (line 153) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2AutomaticMas... method generate (line 170) | def generate(self, image: np.ndarray) -> List[Dict[str, Any]]: method _generate_masks (line 224) | def _generate_masks(self, image: np.ndarray) -> MaskData: method _process_crop (line 251) | def _process_crop( method _process_batch (line 294) | def _process_batch( method postprocess_small_regions (line 387) | def postprocess_small_regions( method refine_with_m2m (line 437) | def refine_with_m2m(self, points, point_labels, low_res_masks, points_... FILE: eval/grounded_sam/sam2/build_sam.py function build_sam2 (line 76) | def build_sam2( function build_sam2_video_predictor (line 105) | def build_sam2_video_predictor( function _hf_download (line 142) | def _hf_download(model_id): function build_sam2_hf (line 150) | def build_sam2_hf(model_id, **kwargs): function build_sam2_video_predictor_hf (line 155) | def build_sam2_video_predictor_hf(model_id, **kwargs): function _load_checkpoint (line 162) | def _load_checkpoint(model, ckpt_path): FILE: eval/grounded_sam/sam2/modeling/backbones/hieradet.py function do_pool (line 25) | def do_pool(x: torch.Tensor, pool: nn.Module, norm: nn.Module = None) ->... class MultiScaleAttention (line 39) | class MultiScaleAttention(nn.Module): method __init__ (line 40) | def __init__( method forward (line 56) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MultiScaleBlock (line 84) | class MultiScaleBlock(nn.Module): method __init__ (line 85) | def __init__( method forward (line 134) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Hiera (line 169) | class Hiera(nn.Module): method __init__ (line 174) | def __init__( method _get_pos_embed (line 273) | def _get_pos_embed(self, hw: Tuple[int, int]) -> torch.Tensor: method forward (line 283) | def forward(self, x: torch.Tensor) -> List[torch.Tensor]: method get_layer_id (line 301) | def get_layer_id(self, layer_name): method get_num_layers (line 316) | def get_num_layers(self) -> int: FILE: eval/grounded_sam/sam2/modeling/backbones/image_encoder.py class ImageEncoder (line 14) | class ImageEncoder(nn.Module): method __init__ (line 15) | def __init__( method forward (line 29) | def forward(self, sample: torch.Tensor): class FpnNeck (line 45) | class FpnNeck(nn.Module): method __init__ (line 52) | def __init__( method forward (line 102) | def forward(self, xs: List[torch.Tensor]): FILE: eval/grounded_sam/sam2/modeling/backbones/utils.py function window_partition (line 16) | def window_partition(x, window_size): function window_unpartition (line 41) | def window_unpartition(windows, window_size, pad_hw, hw): class PatchEmbed (line 65) | class PatchEmbed(nn.Module): method __init__ (line 70) | def __init__( method forward (line 91) | def forward(self, x: torch.Tensor) -> torch.Tensor: FILE: eval/grounded_sam/sam2/modeling/memory_attention.py class MemoryAttentionLayer (line 17) | class MemoryAttentionLayer(nn.Module): method __init__ (line 19) | def __init__( method _forward_sa (line 58) | def _forward_sa(self, tgt, query_pos): method _forward_ca (line 66) | def _forward_ca(self, tgt, memory, query_pos, pos, num_k_exclude_rope=0): method forward (line 83) | def forward( class MemoryAttention (line 102) | class MemoryAttention(nn.Module): method __init__ (line 103) | def __init__( method forward (line 119) | def forward( FILE: eval/grounded_sam/sam2/modeling/memory_encoder.py class MaskDownSampler (line 17) | class MaskDownSampler(nn.Module): method __init__ (line 26) | def __init__( method forward (line 57) | def forward(self, x): class CXBlock (line 62) | class CXBlock(nn.Module): method __init__ (line 74) | def __init__( method forward (line 104) | def forward(self, x): class Fuser (line 120) | class Fuser(nn.Module): method __init__ (line 121) | def __init__(self, layer, num_layers, dim=None, input_projection=False): method forward (line 130) | def forward(self, x): class MemoryEncoder (line 138) | class MemoryEncoder(nn.Module): method __init__ (line 139) | def __init__( method forward (line 158) | def forward( FILE: eval/grounded_sam/sam2/modeling/position_encoding.py class PositionEmbeddingSine (line 16) | class PositionEmbeddingSine(nn.Module): method __init__ (line 22) | def __init__( method _encode_xy (line 42) | def _encode_xy(self, x, y): method encode_boxes (line 62) | def encode_boxes(self, x, y, w, h): method encode_points (line 70) | def encode_points(self, x, y, labels): method forward (line 79) | def forward(self, x: torch.Tensor): class PositionEmbeddingRandom (line 115) | class PositionEmbeddingRandom(nn.Module): method __init__ (line 120) | def __init__(self, num_pos_feats: int = 64, scale: Optional[float] = N... method _pe_encoding (line 129) | def _pe_encoding(self, coords: torch.Tensor) -> torch.Tensor: method forward (line 138) | def forward(self, size: Tuple[int, int]) -> torch.Tensor: method forward_with_coords (line 151) | def forward_with_coords( function init_t_xy (line 167) | def init_t_xy(end_x: int, end_y: int): function compute_axial_cis (line 174) | def compute_axial_cis(dim: int, end_x: int, end_y: int, theta: float = 1... function reshape_for_broadcast (line 186) | def reshape_for_broadcast(freqs_cis: torch.Tensor, x: torch.Tensor): function apply_rotary_enc (line 194) | def apply_rotary_enc( FILE: eval/grounded_sam/sam2/modeling/sam/mask_decoder.py class MaskDecoder (line 15) | class MaskDecoder(nn.Module): method __init__ (line 16) | def __init__( method forward (line 110) | def forward( method predict_masks (line 168) | def predict_masks( method _get_stability_scores (line 247) | def _get_stability_scores(self, mask_logits): method _dynamic_multimask_via_stability (line 259) | def _dynamic_multimask_via_stability(self, all_mask_logits, all_iou_sc... FILE: eval/grounded_sam/sam2/modeling/sam/prompt_encoder.py class PromptEncoder (line 17) | class PromptEncoder(nn.Module): method __init__ (line 18) | def __init__( method get_dense_pe (line 68) | def get_dense_pe(self) -> torch.Tensor: method _embed_points (line 79) | def _embed_points( method _embed_boxes (line 103) | def _embed_boxes(self, boxes: torch.Tensor) -> torch.Tensor: method _embed_masks (line 114) | def _embed_masks(self, masks: torch.Tensor) -> torch.Tensor: method _get_batch_size (line 119) | def _get_batch_size( method _get_device (line 137) | def _get_device(self) -> torch.device: method forward (line 140) | def forward( FILE: eval/grounded_sam/sam2/modeling/sam/transformer.py function sdp_kernel_context (line 28) | def sdp_kernel_context(dropout_p): class TwoWayTransformer (line 44) | class TwoWayTransformer(nn.Module): method __init__ (line 45) | def __init__( method forward (line 90) | def forward( class TwoWayAttentionBlock (line 137) | class TwoWayAttentionBlock(nn.Module): method __init__ (line 138) | def __init__( method forward (line 181) | def forward( class Attention (line 215) | class Attention(nn.Module): method __init__ (line 221) | def __init__( method _separate_heads (line 245) | def _separate_heads(self, x: Tensor, num_heads: int) -> Tensor: method _recombine_heads (line 250) | def _recombine_heads(self, x: Tensor) -> Tensor: method forward (line 255) | def forward(self, q: Tensor, k: Tensor, v: Tensor) -> Tensor: class RoPEAttention (line 289) | class RoPEAttention(Attention): method __init__ (line 292) | def __init__( method forward (line 311) | def forward( FILE: eval/grounded_sam/sam2/modeling/sam2_base.py class SAM2Base (line 22) | class SAM2Base(torch.nn.Module): method __init__ (line 23) | def __init__( method device (line 198) | def device(self): method forward (line 201) | def forward(self, *args, **kwargs): method _build_sam_heads (line 207) | def _build_sam_heads(self): method _forward_sam_heads (line 257) | def _forward_sam_heads( method _use_mask_as_output (line 415) | def _use_mask_as_output(self, backbone_features, high_res_features, ma... method forward_image (line 467) | def forward_image(self, img_batch: torch.Tensor): method _prepare_backbone_features (line 482) | def _prepare_backbone_features(self, backbone_out): method _prepare_memory_conditioned_features (line 498) | def _prepare_memory_conditioned_features( method _encode_new_memory (line 677) | def _encode_new_memory( method _track_step (line 727) | def _track_step( method _encode_memory_in_output (line 788) | def _encode_memory_in_output( method track_step (line 813) | def track_step( method _use_multimask (line 880) | def _use_multimask(self, is_init_cond_frame, point_inputs): method _apply_non_overlapping_constraints (line 890) | def _apply_non_overlapping_constraints(self, pred_masks): FILE: eval/grounded_sam/sam2/modeling/sam2_utils.py function select_closest_cond_frames (line 19) | def select_closest_cond_frames(frame_idx, cond_frame_outputs, max_cond_f... function get_1d_sine_pe (line 64) | def get_1d_sine_pe(pos_inds, dim, temperature=10000): function get_activation_fn (line 77) | def get_activation_fn(activation): function get_clones (line 88) | def get_clones(module, N): class DropPath (line 92) | class DropPath(nn.Module): method __init__ (line 94) | def __init__(self, drop_prob=0.0, scale_by_keep=True): method forward (line 99) | def forward(self, x): class MLP (line 112) | class MLP(nn.Module): method __init__ (line 113) | def __init__( method forward (line 131) | def forward(self, x): class LayerNorm2d (line 141) | class LayerNorm2d(nn.Module): method __init__ (line 142) | def __init__(self, num_channels: int, eps: float = 1e-6) -> None: method forward (line 148) | def forward(self, x: torch.Tensor) -> torch.Tensor: function sample_box_points (line 156) | def sample_box_points( function sample_random_points_from_errors (line 202) | def sample_random_points_from_errors(gt_masks, pred_masks, num_pt=1): function sample_one_point_from_error_center (line 252) | def sample_one_point_from_error_center(gt_masks, pred_masks, padding=True): function get_next_point (line 317) | def get_next_point(gt_masks, pred_masks, method): FILE: eval/grounded_sam/sam2/sam2_image_predictor.py class SAM2ImagePredictor (line 19) | class SAM2ImagePredictor: method __init__ (line 20) | def __init__( method from_pretrained (line 68) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2ImagePredict... method set_image (line 85) | def set_image( method set_image_batch (line 131) | def set_image_batch( method predict_batch (line 174) | def predict_batch( method predict (line 236) | def predict( method _prep_prompts (line 304) | def _prep_prompts( method _predict (line 336) | def _predict( method get_image_embedding (line 439) | def get_image_embedding(self) -> torch.Tensor: method device (line 455) | def device(self) -> torch.device: method reset_predictor (line 458) | def reset_predictor(self) -> None: FILE: eval/grounded_sam/sam2/sam2_video_predictor.py class SAM2VideoPredictor (line 18) | class SAM2VideoPredictor(SAM2Base): method __init__ (line 21) | def __init__( method init_state (line 44) | def init_state( method from_pretrained (line 114) | def from_pretrained(cls, model_id: str, **kwargs) -> "SAM2VideoPredict... method _obj_id_to_idx (line 130) | def _obj_id_to_idx(self, inference_state, obj_id): method _obj_idx_to_id (line 164) | def _obj_idx_to_id(self, inference_state, obj_idx): method _get_obj_num (line 168) | def _get_obj_num(self, inference_state): method add_new_points_or_box (line 173) | def add_new_points_or_box( method add_new_points (line 316) | def add_new_points(self, *args, **kwargs): method add_new_mask (line 321) | def add_new_mask( method _get_orig_video_res_output (line 404) | def _get_orig_video_res_output(self, inference_state, any_res_masks): method _consolidate_temp_output_across_obj (line 426) | def _consolidate_temp_output_across_obj( method _get_empty_mask_ptr (line 556) | def _get_empty_mask_ptr(self, inference_state, frame_idx): method propagate_in_video_preflight (line 593) | def propagate_in_video_preflight(self, inference_state): method propagate_in_video (line 663) | def propagate_in_video( method _add_output_per_object (line 747) | def _add_output_per_object( method clear_all_prompts_in_frame (line 777) | def clear_all_prompts_in_frame( method reset_state (line 848) | def reset_state(self, inference_state): method _reset_tracking_results (line 860) | def _reset_tracking_results(self, inference_state): method _get_image_feature (line 879) | def _get_image_feature(self, inference_state, frame_idx, batch_size): method _run_single_frame_inference (line 912) | def _run_single_frame_inference( method _run_memory_encoder (line 980) | def _run_memory_encoder( method _get_maskmem_pos_enc (line 1016) | def _get_maskmem_pos_enc(self, inference_state, current_out): method remove_object (line 1042) | def remove_object(self, inference_state, obj_id, strict=False, need_ou... method _clear_non_cond_mem_around_input (line 1155) | def _clear_non_cond_mem_around_input(self, inference_state, frame_idx): FILE: eval/grounded_sam/sam2/utils/amg.py class MaskData (line 18) | class MaskData: method __init__ (line 24) | def __init__(self, **kwargs) -> None: method __setitem__ (line 31) | def __setitem__(self, key: str, item: Any) -> None: method __delitem__ (line 37) | def __delitem__(self, key: str) -> None: method __getitem__ (line 40) | def __getitem__(self, key: str) -> Any: method items (line 43) | def items(self) -> ItemsView[str, Any]: method filter (line 46) | def filter(self, keep: torch.Tensor) -> None: method cat (line 61) | def cat(self, new_stats: "MaskData") -> None: method to_numpy (line 74) | def to_numpy(self) -> None: function is_box_near_crop_edge (line 80) | def is_box_near_crop_edge( function box_xyxy_to_xywh (line 93) | def box_xyxy_to_xywh(box_xyxy: torch.Tensor) -> torch.Tensor: function batch_iterator (line 100) | def batch_iterator(batch_size: int, *args) -> Generator[List[Any], None,... function mask_to_rle_pytorch (line 109) | def mask_to_rle_pytorch(tensor: torch.Tensor) -> List[Dict[str, Any]]: function rle_to_mask (line 140) | def rle_to_mask(rle: Dict[str, Any]) -> np.ndarray: function area_from_rle (line 154) | def area_from_rle(rle: Dict[str, Any]) -> int: function calculate_stability_score (line 158) | def calculate_stability_score( function build_point_grid (line 181) | def build_point_grid(n_per_side: int) -> np.ndarray: function build_all_layer_point_grids (line 191) | def build_all_layer_point_grids( function generate_crop_boxes (line 202) | def generate_crop_boxes( function uncrop_boxes_xyxy (line 239) | def uncrop_boxes_xyxy(boxes: torch.Tensor, crop_box: List[int]) -> torch... function uncrop_points (line 248) | def uncrop_points(points: torch.Tensor, crop_box: List[int]) -> torch.Te... function uncrop_masks (line 257) | def uncrop_masks( function remove_small_regions (line 269) | def remove_small_regions( function coco_encode_rle (line 296) | def coco_encode_rle(uncompressed_rle: Dict[str, Any]) -> Dict[str, Any]: function batched_mask_to_box (line 305) | def batched_mask_to_box(masks: torch.Tensor) -> torch.Tensor: FILE: eval/grounded_sam/sam2/utils/misc.py function get_sdpa_settings (line 17) | def get_sdpa_settings(): function get_connected_components (line 47) | def get_connected_components(mask): function mask_to_box (line 66) | def mask_to_box(masks: torch.Tensor): function _load_img_as_tensor (line 92) | def _load_img_as_tensor(img_path, image_size): class AsyncVideoFrameLoader (line 104) | class AsyncVideoFrameLoader: method __init__ (line 109) | def __init__( method __getitem__ (line 147) | def __getitem__(self, index): method __len__ (line 168) | def __len__(self): function load_video_frames (line 172) | def load_video_frames( function load_video_frames_from_jpg_images (line 213) | def load_video_frames_from_jpg_images( function load_video_frames_from_video_file (line 280) | def load_video_frames_from_video_file( function fill_holes_in_mask_scores (line 312) | def fill_holes_in_mask_scores(mask, max_area): function concat_points (line 341) | def concat_points(old_point_inputs, new_points, new_labels): FILE: eval/grounded_sam/sam2/utils/transforms.py class SAM2Transforms (line 15) | class SAM2Transforms(nn.Module): method __init__ (line 16) | def __init__( method __call__ (line 37) | def __call__(self, x): method forward_batch (line 41) | def forward_batch(self, img_list): method transform_coords (line 46) | def transform_coords( method transform_boxes (line 66) | def transform_boxes( method postprocess_masks (line 76) | def postprocess_masks(self, masks: torch.Tensor, orig_hw) -> torch.Ten... FILE: eval/tools/dino.py class DINOScore (line 23) | class DINOScore: method __init__ (line 25) | def __init__(self, device, use_center_crop=True): method __call__ (line 49) | def __call__(self, image_x, image_y, similarity_type="class"): method avg_similairty (line 62) | def avg_similairty(self, x, y): method cls_similarity (line 65) | def cls_similarity(self, x, y): FILE: eval/tools/dpg_score.py class MPLUG (line 22) | class MPLUG(torch.nn.Module): method __init__ (line 23) | def __init__(self, ckpt='damo/mplug_visual-question-answering_coco_lar... method vqa (line 29) | def vqa(self, image, question): class DPGScore (line 35) | class DPGScore: method __init__ (line 36) | def __init__(self, device): method __call__ (line 42) | def __call__(self, image, q_dict): function prepare_dpg_data (line 89) | def prepare_dpg_data(csv_path): function parse_args (line 136) | def parse_args(): FILE: eval/tools/face_id.py function expand_bounding_box (line 26) | def expand_bounding_box(x_min, y_min, x_max, y_max, factor=1.3): class FaceID (line 47) | class FaceID: method __init__ (line 48) | def __init__(self, device): method detect (line 61) | def detect(self, image, expand_scale=1.3): method __call__ (line 68) | def __call__(self, image_x, image_y, normalize=False): FILE: eval/tools/face_utils/face.py function resize_image (line 29) | def resize_image(image, max_size=1024): function open_and_resize_image (line 41) | def open_and_resize_image(image_file, max_size=1024, return_type='numpy'): function loose_warp_face (line 75) | def loose_warp_face(input_image, face_detector, face_target_shape=(512, ... function tight_warp_face (line 207) | def tight_warp_face(input_image, face_detector, face_parser=None, device... FILE: eval/tools/face_utils/face_recg.py class Flatten (line 22) | class Flatten(Module): method forward (line 23) | def forward(self, input): function l2_norm (line 26) | def l2_norm(input,axis=1): class SEModule (line 31) | class SEModule(Module): method __init__ (line 32) | def __init__(self, channels, reduction): method forward (line 42) | def forward(self, x): class bottleneck_IR (line 51) | class bottleneck_IR(Module): method __init__ (line 52) | def __init__(self, in_channel, depth, stride): method forward (line 64) | def forward(self, x): class bottleneck_IR_SE (line 69) | class bottleneck_IR_SE(Module): method __init__ (line 70) | def __init__(self, in_channel, depth, stride): method forward (line 86) | def forward(self,x): class Bottleneck (line 91) | class Bottleneck(namedtuple('Block', ['in_channel', 'depth', 'stride'])): function get_block (line 94) | def get_block(in_channel, depth, num_units, stride = 2): function get_blocks (line 97) | def get_blocks(num_layers): class Backbone (line 121) | class Backbone(Module): method __init__ (line 122) | def __init__(self, num_layers, drop_ratio, mode='ir'): method forward (line 148) | def forward(self,x): FILE: eval/tools/florence_sam.py class ObjectDetector (line 22) | class ObjectDetector: method __init__ (line 23) | def __init__(self, device): method get_instances (line 27) | def get_instances(self, gen_image, label, min_size=64): method get_multiple_instances (line 46) | def get_multiple_instances(self, gen_image, label, min_size=64): FILE: eval/tools/idip_aes_score.py function parse_args (line 33) | def parse_args(): function main (line 41) | def main(): FILE: eval/tools/idip_dpg_score.py function parse_args (line 36) | def parse_args(): function main (line 44) | def main(): FILE: eval/tools/idip_face_score.py function parse_args (line 37) | def parse_args(): function main (line 45) | def main(): FILE: eval/tools/idip_gen_split_idip.py function parse_args (line 33) | def parse_args(): function main (line 44) | def main(): FILE: eval/tools/idip_sam-dino_score.py function parse_args (line 37) | def parse_args(): function main (line 44) | def main(): FILE: eval/tools/log_scores.py function parse_args (line 25) | def parse_args(): function read_txt_first_line (line 32) | def read_txt_first_line(file_path): function read_txt_second_line (line 36) | def read_txt_second_line(file_path): FILE: inference_single_sample.py function generate_image (line 42) | def generate_image(model, prompt, cond_size, target_height, target_width... function main (line 168) | def main(): FILE: run_gradio.py function clear_images (line 122) | def clear_images(): function det_seg_img (line 125) | def det_seg_img(image, label): function crop_face_img (line 133) | def crop_face_img(image): function vlm_img_caption (line 145) | def vlm_img_caption(image): function generate_random_string (line 166) | def generate_random_string(length=4): function resize_keep_aspect_ratio (line 171) | def resize_keep_aspect_ratio(pil_image, target_size=1024): function open_accordion_on_example_selection (line 190) | def open_accordion_on_example_selection(*args): function generate_image (line 204) | def generate_image( function create_image_input (line 367) | def create_image_input(index, open=True, indexs_state=None): function merge_instances (line 391) | def merge_instances(orig_img, indices, ins_bboxes, ins_images): function change_accordion (line 409) | def change_accordion(at: bool, index: int, state: list): function update_inputs (line 424) | def update_inputs(is_open, index, state: list): FILE: src/adapters/mod_adapters.py class SquaredReLU (line 36) | class SquaredReLU(nn.Module): method forward (line 37) | def forward(self, x: torch.Tensor): class AdaLayerNorm (line 40) | class AdaLayerNorm(nn.Module): method __init__ (line 41) | def __init__(self, embedding_dim: int, time_embedding_dim: Optional[in... method forward (line 54) | def forward( class PerceiverAttentionBlock (line 62) | class PerceiverAttentionBlock(nn.Module): method __init__ (line 63) | def __init__( method attention (line 86) | def attention(self, q: torch.Tensor, kv: torch.Tensor, attn_mask: torc... method forward (line 90) | def forward( class CLIPModAdapter (line 117) | class CLIPModAdapter(ModelMixin, ConfigMixin): method __init__ (line 119) | def __init__( method enable_gradient_checkpointing (line 153) | def enable_gradient_checkpointing(self): method forward (line 159) | def forward(self, t_emb, llm_hidden_states, clip_outputs): class TextImageResampler (line 176) | class TextImageResampler(nn.Module): method __init__ (line 177) | def __init__( method enable_gradient_checkpointing (line 211) | def enable_gradient_checkpointing(self): method forward (line 215) | def forward( FILE: src/flux/block.py function scaled_dot_product_attention (line 25) | def scaled_dot_product_attention(query, key, value, attn_mask=None, drop... function attn_forward (line 49) | def attn_forward( function set_delta_by_start_end (line 363) | def set_delta_by_start_end( function norm1_context_forward (line 376) | def norm1_context_forward( function norm1_forward (line 415) | def norm1_forward( function block_forward (line 452) | def block_forward( function single_norm_forward (line 670) | def single_norm_forward( function single_block_forward (line 707) | def single_block_forward( FILE: src/flux/condition.py class Condition (line 37) | class Condition(object): method __init__ (line 38) | def __init__( method get_condition (line 56) | def get_condition( method type_id (line 94) | def type_id(self) -> int: method get_type_id (line 101) | def get_type_id(cls, condition_type: str) -> int: method encode (line 107) | def encode(self, pipe: FluxPipeline) -> Tuple[torch.Tensor, torch.Tens... FILE: src/flux/generate.py function get_config (line 40) | def get_config(config_path: str = None): function prepare_params (line 49) | def prepare_params( function seed_everything (line 94) | def seed_everything(seed: int = 42): function generate (line 101) | def generate( function generate_from_test_sample (line 519) | def generate_from_test_sample( FILE: src/flux/lora_controller.py class enable_lora (line 20) | class enable_lora: method __init__ (line 21) | def __init__(self, lora_modules: List[BaseTunerLayer], dit_activated: ... method __enter__ (line 40) | def __enter__(self) -> None: method __exit__ (line 57) | def __exit__( class set_lora_scale (line 69) | class set_lora_scale: method __init__ (line 70) | def __init__(self, lora_modules: List[BaseTunerLayer], scale: float) -... method __enter__ (line 83) | def __enter__(self) -> None: method __exit__ (line 89) | def __exit__( FILE: src/flux/pipeline_tools.py function encode_vae_images (line 57) | def encode_vae_images(pipeline: FluxPipeline, images: Tensor): function decode_vae_images (line 82) | def decode_vae_images(pipeline: FluxPipeline, latents: Tensor, height, w... function _get_clip_prompt_embeds (line 89) | def _get_clip_prompt_embeds( function encode_prompt_with_clip_t5 (line 127) | def encode_prompt_with_clip_t5( function prepare_text_input (line 213) | def prepare_text_input( function prepare_t5_input (line 239) | def prepare_t5_input( function tokenize_t5_prompt (line 265) | def tokenize_t5_prompt(pipe, input_prompt, max_length, **kargs): function clear_attn_maps (line 277) | def clear_attn_maps(transformer): function gather_attn_maps (line 286) | def gather_attn_maps(transformer, clear=False): function process_token (line 315) | def process_token(token, startofword): function save_attention_image (line 331) | def save_attention_image(attn_map, tokens, batch_dir, to_pil): function save_attention_maps (line 342) | def save_attention_maps(attn_maps, pipe, prompts, base_dir='attn_maps'): function gather_cond2latents (line 389) | def gather_cond2latents(transformer, clear=False): function save_cond2latent_image (line 415) | def save_cond2latent_image(attn_map, batch_dir, to_pil): function save_cond2latent (line 421) | def save_cond2latent(attn_maps, base_dir='attn_maps'): function quantization (line 463) | def quantization(pipe, qtype, t5_only=False): class CustomFluxPipeline (line 519) | class CustomFluxPipeline: method __init__ (line 520) | def __init__( method add_modulation_adapter (line 583) | def add_modulation_adapter(self, modulation_adapter): method clear_modulation_adapters (line 587) | def clear_modulation_adapters(self): function load_clip (line 592) | def load_clip(pipeline, config, torch_dtype, device, ckpt_dir=None, is_t... function load_dit_lora (line 599) | def load_dit_lora(pipeline, pipe, config, torch_dtype, device, ckpt_dir=... function load_modulation_adapter (line 670) | def load_modulation_adapter(pipeline, config, torch_dtype, device, ckpt_... function load_ckpt (line 722) | def load_ckpt(pipeline, ckpt_dir, is_training=False): FILE: src/flux/transformer.py function prepare_params (line 38) | def prepare_params( function transformer_forward (line 67) | def transformer_forward( FILE: src/utils/data_utils.py function get_rank_and_worldsize (line 29) | def get_rank_and_worldsize(): function get_train_config (line 40) | def get_train_config(config_path=None): function calculate_aspect_ratios (line 48) | def calculate_aspect_ratios(resolution): function get_closest_ratio (line 81) | def get_closest_ratio(height: float, width: float, ratios: dict): function _aspect_ratio_batched (line 87) | def _aspect_ratio_batched( function apply_aspect_ratio_batched (line 154) | def apply_aspect_ratio_batched(dataset, batchsize, aspect_ratios, batch_... function get_aspect_ratios (line 165) | def get_aspect_ratios(enable_aspect_ratio, resolution): function bbox_to_grid (line 187) | def bbox_to_grid(bbox, image_size, output_size=(224, 224)): function random_crop_instance (line 214) | def random_crop_instance(instance, min_crop_ratio): function compute_psnr (line 236) | def compute_psnr(x, y): function replace_first_occurrence (line 243) | def replace_first_occurrence(sentence, word_or_phrase, replace_with): function decode_base64_to_image (line 264) | def decode_base64_to_image(base64_str): function jpeg_compression (line 273) | def jpeg_compression(pil_image, quality): function pad_to_square (line 278) | def pad_to_square(pil_image): function pad_to_target (line 286) | def pad_to_target(pil_image, target_size): function image_grid (line 310) | def image_grid(imgs, rows, cols): function split_grid (line 323) | def split_grid(image): function add_border (line 340) | def add_border(img, border_color, border_thickness): function merge_bboxes (line 357) | def merge_bboxes(bboxes): function flip_bbox_left_right (line 377) | def flip_bbox_left_right(bbox, image_width): function json_load (line 394) | def json_load(path, encoding='ascii'): function json_dump (line 398) | def json_dump(obj, path, encoding='ascii', indent=4, create_dir=True, ve... FILE: src/utils/gpu_momory_utils.py class ForwardHookManager (line 5) | class ForwardHookManager: method __init__ (line 6) | def __init__(self, threshold_mem = 8 * 1024 * 1024 * 1024, use_lower_v... method _get_available_memory (line 13) | def _get_available_memory(self): method _free_up_memory (line 18) | def _free_up_memory(self, required_mem, cache_model = None): method model_to_cuda (line 37) | def model_to_cuda(self, model): method _register (line 88) | def _register(self, model): method replace_module_children (line 147) | def replace_module_children(self, model, deep = 0): method register (line 161) | def register(self, model): method revert (line 172) | def revert(self): FILE: src/utils/modulation_utils.py function unpad_input_ids (line 19) | def unpad_input_ids(input_ids, attention_mask): function get_word_index (line 22) | def get_word_index(pipe, prompt, input_ids, word, word_count=1, max_leng...