MouseBrain-2dto3d / config.py
FrankHUP's picture
query augmentation model index and ui update
2577d37
from __future__ import annotations
import os
from pathlib import Path
APP_DIR = Path(__file__).resolve().parent
CACHE_DIR = Path(os.getenv("MOUSE_DEMO_CACHE", APP_DIR / ".cache"))
CACHE_DIR.mkdir(parents=True, exist_ok=True)
GCS_BASE = os.getenv(
"GCS_BASE",
"https://storage.googleapis.com/mouse-rag/demo/v3",
).rstrip("/")
FAISS_URL = f"{GCS_BASE}/patch_index.faiss"
MANIFEST_URL = f"{GCS_BASE}/patch_manifest.parquet"
VECTORS_URL = f"{GCS_BASE}/patch_vectors.npy"
PATCH_PNG_BASE = f"{GCS_BASE}/patch_png"
RERANKER_REPO_ID = os.getenv("RERANKER_REPO_ID", "FrankHUP/mousebrain-reranker")
RERANKER_FILENAME = os.getenv("RERANKER_FILENAME", "reranker_listwise.pt")
DINO_MODEL_ID = os.getenv("DINO_MODEL_ID", "facebook/dinov3-vitb16-pretrain-lvd1689m")
DINO_MODEL_LABEL = "DINOv3 ViT-B/16"
DINO_MODEL_URL = f"https://huggingface.co/{DINO_MODEL_ID}"
RERANKER_MODEL_LABEL = "MouseBrain reranker"
RERANKER_MODEL_URL = f"https://huggingface.co/{RERANKER_REPO_ID}"
# Index hyperparameters used to build the deployed index
MOUSE_BRAIN_RESOLUTION=25
K_NORMALS = 64
PATCH_SCALES = (1, 2, 4)
FIXED_STEP_VOX = 2.0
PATCH_OVERLAP = 0.25
# Display metadata for the current deployed index
INDEX_NUM_SLICES = 197869
INDEX_NUM_SLICES_TRIES = 625590
INDEX_SEARCH_BACKEND = "FlatIP"
PROJECT_GITHUB_URL = "https://github.com/linum-uqam/sbh-mouse-rag"
PAPER_URL = None # coming soon
FAISS_LOCAL = CACHE_DIR / "patch_index.faiss"
MANIFEST_LOCAL = CACHE_DIR / "patch_manifest.parquet"
VECTORS_LOCAL = CACHE_DIR / "patch_vectors.npy"
TOPK_DEFAULT = int(os.getenv("TOPK_DEFAULT", "12"))
K_PER_ANGLE_DEFAULT = int(os.getenv("K_PER_ANGLE_DEFAULT", "100"))
IDLE_UNLOAD_SECONDS = int(os.getenv("IDLE_UNLOAD_SECONDS", "120"))
DEFAULT_ANGLES = (0.0, 90.0, 180.0, 270.0)
ROTATION_PRESET_CHOICES = [0, 1, 2, 4, 8, 16]
DEFAULT_ROTATION_PRESET = int(os.getenv("DEFAULT_ROTATION_PRESET", "4"))
DEFAULT_FLIP_X = os.getenv("DEFAULT_FLIP_X", "true").strip().lower() in {"1", "true", "yes", "on"}
DEFAULT_FLIP_Y = os.getenv("DEFAULT_FLIP_Y", "true").strip().lower() in {"1", "true", "yes", "on"}
DEFAULT_RERANK_TOPK = 100
DEFAULT_RERANK_ALPHA = 0.5