Views
No views yet
| Path | Description |
|---|---|
faiss/index.faiss | Pre-built FAISS index containing BioCLIP feature vectors |
faiss/id_map.json | Mapping between FAISS internal IDs and dataset image IDs |
metadata/metadata.jsonl | Rich metadata for each indexed image (species, location, capture info) |
faiss-cpu or faiss-gpu.1import faiss
2import json
3import jsonlines
4
5index = faiss.read_index("faiss/index.faiss")
6with open("faiss/id_map.json", "r") as f:
7 id_map = json.load(f)
8
9# Query vector must match the embedding dimension of the index
10query_vector = ... # Shape: (1, dim), dtype: float32
11D, I = index.search(query_vector, k=5)
12
13# Retrieve metadata
14with jsonlines.open("metadata/metadata.jsonl") as reader:
15 metadata = {obj["id"]: obj for obj in reader}
16
17for idx in I[0]:
18 img_id = id_map[str(idx)]
19 print(metadata.get(img_id, "Not found"))