clip.report_marsclip_embeddings¶
report_marsclip_embeddings ¶
Generate Stage A embedding sanity artifacts from a trained MarsCLIP MAE.
load_trained_mae_from_checkpoint ¶
load_trained_mae_from_checkpoint(checkpoint_path: Path | str, *, map_location: str | device = 'cpu') -> tuple[torch.nn.Module, dict[str, Any]]
Load a trained Stage A MAE and the associated checkpoint state.
Source code in src/clip/report_marsclip_embeddings.py
collect_mae_embeddings ¶
collect_mae_embeddings(model: Module, dataset: Sequence[dict[str, Any]], *, batch_size: int = 4, device: str | device | None = None, mask_ratio: float = 0.0, max_items: int | None = None) -> tuple[torch.Tensor, list[dict[str, Any]], list[dict[str, Any]]]
Collect pooled Stage A embeddings plus serializable metadata records.
Source code in src/clip/report_marsclip_embeddings.py
compute_topk_neighbors ¶
Return cosine-nearest neighbor indices and scores for each embedding.
Source code in src/clip/report_marsclip_embeddings.py
project_embeddings_pca ¶
Project embeddings to 2D with a lightweight PCA for qualitative inspection.
Source code in src/clip/report_marsclip_embeddings.py
save_embedding_neighbor_gallery ¶
save_embedding_neighbor_gallery(samples: Sequence[dict[str, Any]], neighbor_indices: Tensor, neighbor_scores: Tensor, out_path: Path | str, *, num_queries: int = 4) -> pathlib.Path
Save a query-plus-neighbors gallery from embedding similarity results.
Source code in src/clip/report_marsclip_embeddings.py
save_embedding_scatter ¶
save_embedding_scatter(projection: Tensor, records: Sequence[dict[str, Any]], out_path: Path | str) -> pathlib.Path
Save a simple 2D embedding scatter colored by valid-pixel fraction.
Source code in src/clip/report_marsclip_embeddings.py
save_embedding_report ¶
save_embedding_report(model: Module, dataset: Sequence[dict[str, Any]], out_dir: Path | str, *, checkpoint_path: Path | str | None = None, config: dict[str, Any] | None = None, batch_size: int = 4, top_k: int = 3, num_queries: int = 4, device: str | device | None = None, mask_ratio: float = 0.0, max_items: int | None = None) -> dict[str, Any]
Save Stage A embedding tensors, metadata, gallery, scatter, and summary.