SYMBOL INDEX (212 symbols across 38 files) FILE: gradio_demo.py function answer_question (line 35) | def answer_question(img, prompt): function extract_floats (line 55) | def extract_floats(text): function extract_bbox (line 65) | def extract_bbox(text): function process_answer (line 73) | def process_answer(img, answer): FILE: moondream/eval/chartqa.py function relaxed_correctness (line 16) | def relaxed_correctness( function eval_chartqa (line 59) | def eval_chartqa(model, debug=False): FILE: moondream/eval/coco_map.py function calculate_iou (line 116) | def calculate_iou( function calculate_map (line 132) | def calculate_map( function get_total_map (line 210) | def get_total_map(results_by_label, frequency_by_label): function eval_coco_map (line 222) | def eval_coco_map(model, iou_threshold=0.5, debug=False): FILE: moondream/eval/countbenchqa.py function eval_countbenchqa (line 14) | def eval_countbenchqa(model, debug=False): FILE: moondream/eval/docvqa.py function get_anls (line 14) | def get_anls(s1, s2): function eval_docvqa (line 22) | def eval_docvqa(model, debug=False): FILE: moondream/eval/eval_all.py function create_model (line 22) | def create_model(ckpt_path): function eval_all (line 30) | def eval_all(model, skip=[]): FILE: moondream/eval/gazefollow.py function eval_gazefollow (line 12) | def eval_gazefollow(model, debug=False): FILE: moondream/eval/mmstar.py function eval_mmstar (line 13) | def eval_mmstar(model, debug=False): FILE: moondream/eval/naturalbench.py function eval_naturalbench (line 10) | def eval_naturalbench(model, debug=False): FILE: moondream/eval/pope.py function evaluate_pope (line 11) | def evaluate_pope(model, debug=False): FILE: moondream/eval/realworldqa.py function eval_realworldqa (line 12) | def eval_realworldqa(model, debug=False): FILE: moondream/eval/tallyqa.py function eval_tallyqa (line 14) | def eval_tallyqa(model, debug=False): FILE: moondream/eval/textvqa.py function eval_textvqa (line 15) | def eval_textvqa(model, debug=False): FILE: moondream/eval/utils.py class VQAScorer (line 5) | class VQAScorer: method __init__ (line 6) | def __init__(self): method process_punctuation (line 175) | def process_punctuation(self, inText: str) -> str: method process_digit_article (line 188) | def process_digit_article(self, inText: str) -> str: method process_answer (line 201) | def process_answer(self, answer): method process_line (line 209) | def process_line(self, prediction: str, gt_answers: List[str]) -> float: method compute_score (line 225) | def compute_score( FILE: moondream/eval/waste_detection.py function iou (line 18) | def iou(a: Box, b: Box) -> float: function match (line 28) | def match(gt: List[Box], pr: List[Box], iou_thr: float) -> Tuple[int, in... class WasteDetection (line 54) | class WasteDetection(torch.utils.data.Dataset): method __init__ (line 55) | def __init__(self, name: str = "moondream/waste_detection", split: str... method __len__ (line 58) | def __len__(self): method __getitem__ (line 61) | def __getitem__(self, idx: int) -> Dict: function evaluate (line 81) | def evaluate( function load_model (line 114) | def load_model(path: str, device: torch.device) -> MoondreamModel: function main (line 123) | def main(): FILE: moondream/torch/config.py class TextMoeConfig (line 6) | class TextMoeConfig: class TextConfig (line 14) | class TextConfig: class VisionConfig (line 28) | class VisionConfig: class RegionConfig (line 43) | class RegionConfig: class TokenizerConfig (line 53) | class TokenizerConfig: class MoondreamConfig (line 77) | class MoondreamConfig: method from_dict (line 84) | def from_dict(cls, config_dict: dict): method to_dict (line 96) | def to_dict(self): FILE: moondream/torch/hf_moondream.py function extract_question (line 18) | def extract_question(text): class HfConfig (line 28) | class HfConfig(PretrainedConfig): method __init__ (line 32) | def __init__(self, **kwargs): class HfMoondream (line 37) | class HfMoondream(PreTrainedModel): method __init__ (line 41) | def __init__(self, config): method _setup_caches (line 48) | def _setup_caches(self): method encode_image (line 54) | def encode_image(self): method query (line 59) | def query(self): method caption (line 64) | def caption(self): method detect (line 69) | def detect(self): method point (line 74) | def point(self): method detect_gaze (line 79) | def detect_gaze(self): method answer_question (line 83) | def answer_question( method batch_answer (line 99) | def batch_answer(self, images, prompts, tokenizer=None, **kwargs): method _unsupported_exception (line 105) | def _unsupported_exception(self): method generate (line 112) | def generate(self, image_embeds, prompt, tokenizer, max_new_tokens=128... method get_input_embeddings (line 142) | def get_input_embeddings(self) -> nn.Embedding: method set_input_embeddings (line 155) | def set_input_embeddings(self, value: Union[nn.Embedding, nn.Module]) ... method input_embeds (line 165) | def input_embeds( FILE: moondream/torch/image_crops.py function select_tiling (line 17) | def select_tiling( class OverlapCropOutput (line 53) | class OverlapCropOutput(TypedDict): function overlap_crop_image (line 58) | def overlap_crop_image( function reconstruct_from_crops (line 170) | def reconstruct_from_crops( FILE: moondream/torch/layers.py function quantize_ (line 13) | def quantize_(model, quant_mode): function int4_weight_only (line 18) | def int4_weight_only(group_size): function gelu_approx (line 24) | def gelu_approx(x): class LinearWeights (line 29) | class LinearWeights: function linear (line 34) | def linear(x: torch.Tensor, w: LinearWeights) -> torch.Tensor: function dequantize_tensor (line 38) | def dequantize_tensor(W_q, scale, zero, orig_shape, dtype=torch.bfloat16): class QuantizedLinear (line 47) | class QuantizedLinear(nn.Module): method __init__ (line 48) | def __init__( method unpack (line 79) | def unpack(self): method forward (line 106) | def forward(self, x: torch.Tensor) -> torch.Tensor: class LayerNormWeights (line 113) | class LayerNormWeights: function layer_norm (line 118) | def layer_norm(x: torch.Tensor, w: LayerNormWeights) -> torch.Tensor: class MLPWeights (line 123) | class MLPWeights: function mlp (line 129) | def mlp(x: torch.Tensor, w: MLPWeights, lora: Optional[dict] = None) -> ... function moe_mlp (line 149) | def moe_mlp( class AttentionWeights (line 218) | class AttentionWeights: function attn (line 223) | def attn(x: torch.Tensor, w: AttentionWeights, n_heads: int) -> torch.Te... FILE: moondream/torch/lora.py function variant_cache_dir (line 11) | def variant_cache_dir(): function cached_variant_path (line 23) | def cached_variant_path(variant_id: str): function nest (line 46) | def nest(flat): function variant_state_dict (line 58) | def variant_state_dict(variant_id: Optional[str] = None, device: str = "... FILE: moondream/torch/moondream.py class EncodedImage (line 58) | class EncodedImage: class KVCache (line 63) | class KVCache(nn.Module): method __init__ (line 65) | def __init__(self, n_heads, n_kv_heads, max_context, dim, device, dtype): method update (line 75) | def update(self, pos_ids, k, v): function causal_mask (line 82) | def causal_mask(b, h, q_idx, kv_idx): function get_mask_mod (line 86) | def get_mask_mod(mask_mod, offset): class MoondreamModel (line 93) | class MoondreamModel(nn.Module): method __init__ (line 95) | def __init__( method causal_block_mask (line 151) | def causal_block_mask(self): method point_gen_indices (line 164) | def point_gen_indices(self): method _setup_caches (line 172) | def _setup_caches(self): method device (line 185) | def device(self): method _vis_enc (line 188) | def _vis_enc(self, x: torch.Tensor): method _vis_proj (line 191) | def _vis_proj(self, g: torch.Tensor, r: torch.Tensor): method _prefill (line 194) | def _prefill( method _decode_one_tok (line 203) | def _decode_one_tok( method compile (line 232) | def compile(self): method _run_vision_encoder (line 272) | def _run_vision_encoder(self, image: Image.Image) -> torch.Tensor: method encode_image (line 296) | def encode_image( method _apply_top_p (line 338) | def _apply_top_p(self, probs: torch.Tensor, top_p: float): method _prefill_prompt (line 348) | def _prefill_prompt( method _generate_reasoning (line 393) | def _generate_reasoning( method _generate_answer (line 506) | def _generate_answer( method query (line 615) | def query( method load_encoded_image (line 691) | def load_encoded_image(self, encoded_image: EncodedImage): method caption (line 696) | def caption( method _generate_points (line 724) | def _generate_points( method detect (line 816) | def detect( method point (line 864) | def point( method _detect_gaze (line 912) | def _detect_gaze( method detect_gaze (line 968) | def detect_gaze( function _is_cjk_char (line 1060) | def _is_cjk_char(cp): FILE: moondream/torch/region.py function fourier_features (line 10) | def fourier_features(x: torch.Tensor, w: torch.Tensor) -> torch.Tensor: function encode_coordinate (line 30) | def encode_coordinate(coord: torch.Tensor, w: nn.Module) -> torch.Tensor: function decode_coordinate (line 44) | def decode_coordinate(hidden_state: torch.Tensor, w: nn.Module) -> torch... function encode_size (line 58) | def encode_size(size: torch.Tensor, w: nn.Module) -> torch.Tensor: function decode_size (line 72) | def decode_size(hidden_state: torch.Tensor, w: nn.Module) -> torch.Tensor: function encode_spatial_refs (line 94) | def encode_spatial_refs(spatial_refs: SpatialRefs, w: nn.Module) -> torc... FILE: moondream/torch/rope.py function precompute_freqs_cis (line 6) | def precompute_freqs_cis( function apply_rotary_emb (line 19) | def apply_rotary_emb( FILE: moondream/torch/text.py function text_encoder (line 13) | def text_encoder(input_ids: torch.Tensor, w: nn.Module): function attn (line 17) | def attn( function text_decoder (line 82) | def text_decoder( function lm_head (line 124) | def lm_head( function build_dense_mlp (line 137) | def build_dense_mlp(d_model, d_ffn, dtype, linear_cls): function build_moe_mlp (line 146) | def build_moe_mlp(d_model, d_ffn, n_experts, dtype): function build_text_model (line 169) | def build_text_model(config: TextConfig, dtype: torch.dtype) -> nn.Module: FILE: moondream/torch/utils.py function remove_outlier_points (line 4) | def remove_outlier_points(points_tuples, k_nearest=2, threshold=2.0): FILE: moondream/torch/vision.py function adaptive_avg_pool2d (line 16) | def adaptive_avg_pool2d(input, output_size): function prepare_crops (line 25) | def prepare_crops( function create_patches (line 44) | def create_patches(x, patch_size): function vision_encoder (line 64) | def vision_encoder(input_BCHW: torch.Tensor, w: nn.Module, config: Visio... function vision_projection (line 77) | def vision_projection( function build_vision_model (line 92) | def build_vision_model(config: VisionConfig, dtype: torch.dtype): FILE: moondream/torch/weights.py function safetensors_open (line 10) | def safetensors_open(safetensors_file: str): function _load_weights (line 30) | def _load_weights(get_tensor: Callable[[str], torch.Tensor], model: nn.M... function load_weights_from_safetensors (line 130) | def load_weights_from_safetensors(weights_file: str, model: nn.Module) -... function load_weights_from_pt (line 150) | def load_weights_from_pt(weights_file: str, model: nn.Module) -> None: function load_weights_into_model (line 166) | def load_weights_into_model(weights_file: str, model: nn.Module) -> None: FILE: recipes/gaze-detection-video/gaze-detection-video.py function initialize_model (line 20) | def initialize_model() -> Optional[AutoModelForCausalLM]: function video_handler (line 56) | def video_handler( function fig2rgb_array (line 81) | def fig2rgb_array(fig: plt.Figure) -> np.ndarray: function visualize_frame (line 91) | def visualize_frame( function process_video (line 200) | def process_video( FILE: recipes/promptable-content-moderation/app.py function process_video_file (line 28) | def process_video_file( function create_visualization_plots (line 119) | def create_visualization_plots(json_path): FILE: recipes/promptable-content-moderation/deep_sort_integration.py class DeepSORTTracker (line 7) | class DeepSORTTracker: method __init__ (line 8) | def __init__(self, max_age=5): method _create_tracker (line 13) | def _create_tracker(self): method reset (line 21) | def reset(self): method update (line 26) | def update(self, frame, detections): FILE: recipes/promptable-content-moderation/main.py function get_sam_model (line 50) | def get_sam_model(slim=False): function load_sam_model (line 72) | def load_sam_model(slim=False): function generate_color_pair (line 77) | def generate_color_pair(): function create_mask_overlay (line 84) | def create_mask_overlay(image, masks, points=None, labels=None): function process_sam_detection (line 153) | def process_sam_detection(image, center_x, center_y, slim=False): function load_moondream (line 184) | def load_moondream(): function get_video_properties (line 193) | def get_video_properties(video_path): function is_valid_bounding_box (line 204) | def is_valid_bounding_box(bounding_box): function split_frame_into_grid (line 221) | def split_frame_into_grid(frame, grid_rows, grid_cols): function convert_tile_coords_to_frame (line 243) | def convert_tile_coords_to_frame(box, tile_pos, frame_shape): function merge_tile_detections (line 273) | def merge_tile_detections(tile_detections, iou_threshold=0.5): function detect_objects_in_frame (line 330) | def detect_objects_in_frame( function detect_objects_in_frame_single (line 376) | def detect_objects_in_frame_single(model, tokenizer, image, target_object): function draw_hitmarker (line 401) | def draw_hitmarker( function draw_ad_boxes (line 501) | def draw_ad_boxes(frame, detected_objects, detect_keyword, model, box_st... function filter_temporal_outliers (line 767) | def filter_temporal_outliers(detections_dict): function describe_frames (line 805) | def describe_frames( function create_detection_video (line 875) | def create_detection_video( function process_video (line 1058) | def process_video( function main (line 1226) | def main(): FILE: recipes/promptable-content-moderation/persistence.py function save_detection_data (line 5) | def save_detection_data(data, output_file): function load_detection_data (line 26) | def load_detection_data(input_file): FILE: recipes/promptable-content-moderation/video_visualization.py function create_frame_data (line 12) | def create_frame_data(json_path): function generate_frame_image (line 64) | def generate_frame_image(df, frame_num, temp_dir, max_y): function generate_gauge_frame (line 124) | def generate_gauge_frame(df, frame_num, temp_dir, detect_keyword="OBJECT"): function create_video_visualization (line 256) | def create_video_visualization(json_path, style="timeline"): FILE: recipes/promptable-content-moderation/visualization.py function visualize_detections (line 7) | def visualize_detections(json_path): function main (line 97) | def main(): FILE: recipes/promptable-video-redaction/app.py function process_video_file (line 22) | def process_video_file( FILE: recipes/promptable-video-redaction/main.py function load_moondream (line 35) | def load_moondream(): function get_video_properties (line 44) | def get_video_properties(video_path): function is_valid_box (line 55) | def is_valid_box(box): function split_frame_into_tiles (line 72) | def split_frame_into_tiles(frame, rows, cols): function convert_tile_coords_to_frame (line 94) | def convert_tile_coords_to_frame(box, tile_pos, frame_shape): function merge_tile_detections (line 124) | def merge_tile_detections(tile_detections, iou_threshold=0.5): function detect_ads_in_frame (line 181) | def detect_ads_in_frame(model, tokenizer, image, detect_keyword, rows=1,... function detect_ads_in_frame_single (line 225) | def detect_ads_in_frame_single(model, tokenizer, image, detect_keyword): function draw_hitmarker (line 250) | def draw_hitmarker( function draw_ad_boxes (line 350) | def draw_ad_boxes(frame, detected_objects, detect_keyword, box_style="ce... function filter_temporal_outliers (line 427) | def filter_temporal_outliers(detections_dict): function describe_frames (line 455) | def describe_frames( function create_detection_video (line 503) | def create_detection_video( function process_video (line 617) | def process_video( function main (line 657) | def main(): FILE: tests/test_image_crops.py function test_overlap_crop_basic (line 6) | def test_overlap_crop_basic(): function test_overlap_crop_small_image (line 21) | def test_overlap_crop_small_image(): function test_reconstruction (line 32) | def test_reconstruction(): FILE: webcam_gradio_demo.py function answer_question (line 33) | def answer_question(img, prompt): function img_change (line 81) | def img_change(img): function prompt_change (line 86) | def prompt_change(prompt): function live_video (line 91) | def live_video():