mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-03-12 12:25:32 +08:00
feat: initialize project with Python 3.10 and feature retrieval module
This commit is contained in:
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.10
|
||||||
@@ -39,9 +39,7 @@ in {
|
|||||||
|
|
||||||
# https://devenv.sh/basics/
|
# https://devenv.sh/basics/
|
||||||
enterShell = ''
|
enterShell = ''
|
||||||
eval "$(micromamba shell hook --shell bash)"
|
source ./.venv/bin/activate
|
||||||
micromamba activate ./.venv
|
|
||||||
export PATH=$PATH:/home/sikongjueluo/Projects/Mini-Nav
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# https://devenv.sh/tasks/
|
# https://devenv.sh/tasks/
|
||||||
|
|||||||
6
main.py
Normal file
6
main.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
def main():
|
||||||
|
print("Hello from mini-nav!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
37
mini-nav/feature_retrieval.py
Normal file
37
mini-nav/feature_retrieval.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from typing import cast
|
||||||
|
import torch
|
||||||
|
from tqdm.auto import tqdm
|
||||||
|
from datasets import Dataset, load_dataset
|
||||||
|
from transformers import AutoImageProcessor, AutoModel
|
||||||
|
|
||||||
|
|
||||||
|
@torch.no_grad()
|
||||||
|
def establish_database(processor, model, images, batch_size=64):
|
||||||
|
device = model.device
|
||||||
|
model.eval()
|
||||||
|
|
||||||
|
for i in tqdm(range(0, len(images), batch_size)):
|
||||||
|
batch = images[i : i + batch_size]
|
||||||
|
|
||||||
|
inputs = processor(images=batch, return_tensors="pt")
|
||||||
|
|
||||||
|
# 迁移数据到GPU
|
||||||
|
inputs.to(device, non_blocking=True)
|
||||||
|
|
||||||
|
outputs = model(**inputs)
|
||||||
|
feats = outputs.last_hidden_state # [B, N, D]
|
||||||
|
# 后处理 / 存库
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
train_dataset = load_dataset("uoft-cs/cifar10", split="train")
|
||||||
|
train_dataset = cast(Dataset, train_dataset)
|
||||||
|
|
||||||
|
processor = AutoImageProcessor.from_pretrained(
|
||||||
|
"facebook/dinov2-large", device_map="cuda"
|
||||||
|
)
|
||||||
|
model = AutoModel.from_pretrained("facebook/dinov2-large", device_map="cuda")
|
||||||
|
|
||||||
|
establish_database(processor, model, train_dataset["img"])
|
||||||
34
pyproject.toml
Normal file
34
pyproject.toml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[project]
|
||||||
|
name = "mini-nav"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
dependencies = [
|
||||||
|
"accelerate>=1.12.0",
|
||||||
|
"datasets>=4.5.0",
|
||||||
|
"h5py>=3.15.1",
|
||||||
|
"httpx[socks]>=0.28.1",
|
||||||
|
"torch>=2.10.0",
|
||||||
|
"torchvision>=0.25.0",
|
||||||
|
"transformers>=5.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"pytest>=9.0.2",
|
||||||
|
"pytest-mpi>=0.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[tool.uv.index]]
|
||||||
|
name = "pytorch-cu130"
|
||||||
|
url = "https://download.pytorch.org/whl/cu130"
|
||||||
|
explicit = true
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
torch = [
|
||||||
|
{ index = "pytorch-cu130", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
torchvision = [
|
||||||
|
{ index = "pytorch-cu130", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
321
venv.yaml
321
venv.yaml
@@ -1,321 +0,0 @@
|
|||||||
name:
|
|
||||||
channels:
|
|
||||||
- aihabitat
|
|
||||||
- conda-forge
|
|
||||||
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
|
|
||||||
dependencies:
|
|
||||||
- _libgcc_mutex=0.1
|
|
||||||
- _openmp_mutex=4.5
|
|
||||||
- aiodns=3.5.0
|
|
||||||
- aiohappyeyeballs=2.6.1
|
|
||||||
- aiohttp=3.12.15
|
|
||||||
- aiosignal=1.4.0
|
|
||||||
- alsa-lib=1.2.15.3
|
|
||||||
- aom=3.9.1
|
|
||||||
- arrow-cpp=19.0.0
|
|
||||||
- async-timeout=5.0.1
|
|
||||||
- attrs=25.3.0
|
|
||||||
- aws-c-auth=0.8.5
|
|
||||||
- aws-c-cal=0.8.5
|
|
||||||
- aws-c-common=0.11.1
|
|
||||||
- aws-c-compression=0.3.1
|
|
||||||
- aws-c-event-stream=0.5.4
|
|
||||||
- aws-c-http=0.9.3
|
|
||||||
- aws-c-io=0.17.0
|
|
||||||
- aws-c-mqtt=0.12.2
|
|
||||||
- aws-c-s3=0.7.11
|
|
||||||
- aws-c-sdkutils=0.2.3
|
|
||||||
- aws-checksums=0.2.3
|
|
||||||
- aws-crt-cpp=0.31.0
|
|
||||||
- aws-sdk-cpp=1.11.528
|
|
||||||
- brotli=1.0.9
|
|
||||||
- brotli-bin=1.0.9
|
|
||||||
- brotlicffi=1.0.9.2
|
|
||||||
- bzip2=1.0.8
|
|
||||||
- c-ares=1.34.6
|
|
||||||
- ca-certificates=2026.1.4
|
|
||||||
- cairo=1.18.4
|
|
||||||
- certifi=2025.8.3
|
|
||||||
- cffi=2.0.0
|
|
||||||
- charset-normalizer=3.4.4
|
|
||||||
- cmake=3.14.0
|
|
||||||
- colorama=0.4.6
|
|
||||||
- contourpy=1.3.0
|
|
||||||
- curl=8.8.0
|
|
||||||
- cycler=0.12.1
|
|
||||||
- cyrus-sasl=2.1.28
|
|
||||||
- datasets=3.3.2
|
|
||||||
- dav1d=1.2.1
|
|
||||||
- dbus=1.16.2
|
|
||||||
- dill=0.3.8
|
|
||||||
- expat=2.7.3
|
|
||||||
- filelock=3.17.0
|
|
||||||
- fontconfig=2.14.2
|
|
||||||
- fonttools=4.59.1
|
|
||||||
- freetype=2.13.3
|
|
||||||
- fribidi=1.0.16
|
|
||||||
- frozenlist=1.8.0
|
|
||||||
- fsspec=2024.12.0
|
|
||||||
- gflags=2.2.2
|
|
||||||
- gitdb=4.0.12
|
|
||||||
- gitpython=3.1.45
|
|
||||||
- glog=0.5.0
|
|
||||||
- graphite2=1.3.14
|
|
||||||
- habitat-sim=0.3.3
|
|
||||||
- habitat-sim-mutex=1.0
|
|
||||||
- harfbuzz=10.2.0
|
|
||||||
- hf-xet=1.1.8
|
|
||||||
- huggingface_hub=0.34.4
|
|
||||||
- icu=73.2
|
|
||||||
- idna=3.11
|
|
||||||
- imageio=2.37.0
|
|
||||||
- importlib-resources=6.5.2
|
|
||||||
- importlib_resources=6.5.2
|
|
||||||
- jpeg=9e
|
|
||||||
- keyutils=1.6.3
|
|
||||||
- kiwisolver=1.4.7
|
|
||||||
- krb5=1.21.3
|
|
||||||
- lcms2=2.17
|
|
||||||
- ld_impl_linux-64=2.45
|
|
||||||
- lerc=4.0.0
|
|
||||||
- libabseil=20250127.0
|
|
||||||
- libavif=1.3.0
|
|
||||||
- libavif16=1.3.0
|
|
||||||
- libblas=3.11.0
|
|
||||||
- libbrotlicommon=1.0.9
|
|
||||||
- libbrotlidec=1.0.9
|
|
||||||
- libbrotlienc=1.0.9
|
|
||||||
- libcblas=3.11.0
|
|
||||||
- libclang13=21.1.8
|
|
||||||
- libcups=2.4.15
|
|
||||||
- libcurl=8.8.0
|
|
||||||
- libdeflate=1.22
|
|
||||||
- libdrm=2.4.125
|
|
||||||
- libedit=3.1.20250104
|
|
||||||
- libegl=1.7.0
|
|
||||||
- libev=4.33
|
|
||||||
- libevent=2.1.12
|
|
||||||
- libexpat=2.7.3
|
|
||||||
- libffi=3.5.2
|
|
||||||
- libgcc=15.2.0
|
|
||||||
- libgcc-ng=15.2.0
|
|
||||||
- libgfortran=15.2.0
|
|
||||||
- libgfortran-ng=15.2.0
|
|
||||||
- libgfortran5=15.2.0
|
|
||||||
- libgl=1.7.0
|
|
||||||
- libglib=2.84.2
|
|
||||||
- libglvnd=1.7.0
|
|
||||||
- libglx=1.7.0
|
|
||||||
- libgomp=15.2.0
|
|
||||||
- libgrpc=1.71.0
|
|
||||||
- libiconv=1.18
|
|
||||||
- libkrb5=1.21.3
|
|
||||||
- liblapack=3.11.0
|
|
||||||
- libllvm14=14.0.6
|
|
||||||
- libllvm15=15.0.7
|
|
||||||
- libllvm21=21.1.8
|
|
||||||
- liblzma=5.8.2
|
|
||||||
- liblzma-devel=5.8.2
|
|
||||||
- libnghttp2=1.58.0
|
|
||||||
- libnsl=2.0.1
|
|
||||||
- libntlm=1.8
|
|
||||||
- libopenblas=0.3.30
|
|
||||||
- libopus=1.6.1
|
|
||||||
- libpciaccess=0.18
|
|
||||||
- libpng=1.6.43
|
|
||||||
- libpq=17.6
|
|
||||||
- libprotobuf=5.29.3
|
|
||||||
- libre2-11=2024.07.02
|
|
||||||
- libsqlite=3.46.0
|
|
||||||
- libssh2=1.11.0
|
|
||||||
- libstdcxx=15.2.0
|
|
||||||
- libstdcxx-ng=15.2.0
|
|
||||||
- libthrift=0.15.0
|
|
||||||
- libtiff=4.7.1
|
|
||||||
- libuuid=2.41.3
|
|
||||||
- libuv=1.51.0
|
|
||||||
- libvpx=1.13.1
|
|
||||||
- libwebp-base=1.6.0
|
|
||||||
- libxcb=1.17.0
|
|
||||||
- libxcrypt=4.4.36
|
|
||||||
- libxkbcommon=1.11.0
|
|
||||||
- libxkbfile=1.1.0
|
|
||||||
- libxml2=2.13.9
|
|
||||||
- libxslt=1.1.43
|
|
||||||
- libzlib=1.2.13
|
|
||||||
- llvmlite=0.43.0
|
|
||||||
- lmdb=0.9.31
|
|
||||||
- lz4-c=1.9.4
|
|
||||||
- matplotlib=3.9.4
|
|
||||||
- matplotlib-base=3.9.4
|
|
||||||
- mesalib=25.1.5
|
|
||||||
- multidict=6.7.0
|
|
||||||
- multiprocess=0.70.15
|
|
||||||
- munkres=1.1.4
|
|
||||||
- mysql-common=9.3.0
|
|
||||||
- mysql-libs=9.3.0
|
|
||||||
- ncurses=6.5
|
|
||||||
- nspr=4.38
|
|
||||||
- nss=3.100
|
|
||||||
- numba=0.60.0
|
|
||||||
- numpy=1.26.4
|
|
||||||
- openjpeg=2.5.2
|
|
||||||
- openldap=2.6.10
|
|
||||||
- openssl=3.6.0
|
|
||||||
- orc=2.1.1
|
|
||||||
- packaging=26.0
|
|
||||||
- pandas=1.2.4
|
|
||||||
- pcre2=10.42
|
|
||||||
- pillow=11.3.0
|
|
||||||
- pip=25.2
|
|
||||||
- pixman=0.46.4
|
|
||||||
- propcache=0.3.1
|
|
||||||
- protobuf=5.29.3
|
|
||||||
- pthread-stubs=0.4
|
|
||||||
- pyarrow=19.0.0
|
|
||||||
- pycares=4.10.0
|
|
||||||
- pycparser=2.23
|
|
||||||
- pyparsing=3.2.3
|
|
||||||
- pyside6=6.9.2
|
|
||||||
- pysocks=1.7.1
|
|
||||||
- python=3.9.19
|
|
||||||
- python-dateutil=2.9.0.post0
|
|
||||||
- python-xxhash=3.5.0
|
|
||||||
- python_abi=3.9
|
|
||||||
- pytz=2025.2
|
|
||||||
- pyyaml=6.0.2
|
|
||||||
- qhull=2020.2
|
|
||||||
- qtbase=6.9.2
|
|
||||||
- qtdeclarative=6.9.2
|
|
||||||
- qtshadertools=6.9.2
|
|
||||||
- qtsvg=6.9.2
|
|
||||||
- qttools=6.9.2
|
|
||||||
- qtwebchannel=6.9.2
|
|
||||||
- qtwebengine=6.9.1
|
|
||||||
- qtwebsockets=6.9.2
|
|
||||||
- quaternion=2023.0.4
|
|
||||||
- rav1e=0.7.1
|
|
||||||
- re2=2024.07.02
|
|
||||||
- readline=8.3
|
|
||||||
- regex=2025.9.1
|
|
||||||
- requests=2.32.5
|
|
||||||
- rhash=1.4.3
|
|
||||||
- s2n=1.5.14
|
|
||||||
- safetensors=0.5.3
|
|
||||||
- scipy=1.13.1
|
|
||||||
- setuptools=80.9.0
|
|
||||||
- six=1.17.0
|
|
||||||
- smmap=3.0.5
|
|
||||||
- snappy=1.2.2
|
|
||||||
- spirv-tools=2025.4
|
|
||||||
- sqlite=3.51.1
|
|
||||||
- svt-av1=3.1.2
|
|
||||||
- tk=8.6.13
|
|
||||||
- tokenizers=0.21.0
|
|
||||||
- tornado=6.5.2
|
|
||||||
- tqdm=4.67.1
|
|
||||||
- transformers=4.49.0
|
|
||||||
- typing-extensions=4.15.0
|
|
||||||
- typing_extensions=4.15.0
|
|
||||||
- tzdata=2025c
|
|
||||||
- unicodedata2=16.0.0
|
|
||||||
- urllib3=2.5.0
|
|
||||||
- utf8proc=2.6.1
|
|
||||||
- uvloop=0.22.1
|
|
||||||
- wheel=0.45.1
|
|
||||||
- withbullet=2.0
|
|
||||||
- xcb-util=0.4.1
|
|
||||||
- xcb-util-cursor=0.1.6
|
|
||||||
- xcb-util-image=0.4.0
|
|
||||||
- xcb-util-keysyms=0.4.1
|
|
||||||
- xcb-util-renderutil=0.3.10
|
|
||||||
- xcb-util-wm=0.4.2
|
|
||||||
- xkeyboard-config=2.46
|
|
||||||
- xorg-libice=1.1.2
|
|
||||||
- xorg-libsm=1.2.6
|
|
||||||
- xorg-libx11=1.8.12
|
|
||||||
- xorg-libxau=1.0.12
|
|
||||||
- xorg-libxcomposite=0.4.6
|
|
||||||
- xorg-libxcursor=1.2.3
|
|
||||||
- xorg-libxdamage=1.1.6
|
|
||||||
- xorg-libxdmcp=1.1.5
|
|
||||||
- xorg-libxext=1.3.6
|
|
||||||
- xorg-libxfixes=6.0.2
|
|
||||||
- xorg-libxi=1.8.2
|
|
||||||
- xorg-libxinerama=1.1.5
|
|
||||||
- xorg-libxrandr=1.5.4
|
|
||||||
- xorg-libxrender=0.9.12
|
|
||||||
- xorg-libxshmfence=1.3.3
|
|
||||||
- xorg-libxtst=1.2.5
|
|
||||||
- xorg-libxxf86vm=1.1.6
|
|
||||||
- xxhash=0.8.0
|
|
||||||
- xz=5.8.2
|
|
||||||
- xz-gpl-tools=5.8.2
|
|
||||||
- xz-tools=5.8.2
|
|
||||||
- yaml=0.2.5
|
|
||||||
- yarl=1.18.0
|
|
||||||
- zipp=3.23.0
|
|
||||||
- zlib=1.2.13
|
|
||||||
- zstd=1.5.6
|
|
||||||
- pip:
|
|
||||||
- Jinja2==3.1.6
|
|
||||||
- Markdown==3.9
|
|
||||||
- MarkupSafe==3.0.3
|
|
||||||
- Pygments==2.19.2
|
|
||||||
- Werkzeug==3.1.5
|
|
||||||
- absl-py==2.3.1
|
|
||||||
- antlr4-python3-runtime==4.9.3
|
|
||||||
- braceexpand==0.1.7
|
|
||||||
- click==8.1.8
|
|
||||||
- cloudpickle==3.1.2
|
|
||||||
- decorator==5.2.1
|
|
||||||
- faster-fifo==1.5.2
|
|
||||||
- grpcio==1.76.0
|
|
||||||
- gym==0.23.0
|
|
||||||
- gym-notices==0.1.0
|
|
||||||
- habitat-baselines==0.3.320250127
|
|
||||||
- habitat-lab==0.3.320250127
|
|
||||||
- hydra-core==1.3.2
|
|
||||||
- ifcfg==0.24
|
|
||||||
- imageio-ffmpeg==0.6.0
|
|
||||||
- importlib_metadata==8.7.1
|
|
||||||
- lmdb==1.7.5
|
|
||||||
- markdown-it-py==3.0.0
|
|
||||||
- mdurl==0.1.2
|
|
||||||
- moviepy==2.2.1
|
|
||||||
- mpmath==1.3.0
|
|
||||||
- msgpack==1.1.2
|
|
||||||
- networkx==3.2.1
|
|
||||||
- nvidia-cublas-cu12==12.8.4.1
|
|
||||||
- nvidia-cuda-cupti-cu12==12.8.90
|
|
||||||
- nvidia-cuda-nvrtc-cu12==12.8.93
|
|
||||||
- nvidia-cuda-runtime-cu12==12.8.90
|
|
||||||
- nvidia-cudnn-cu12==9.10.2.21
|
|
||||||
- nvidia-cufft-cu12==11.3.3.83
|
|
||||||
- nvidia-cufile-cu12==1.13.1.3
|
|
||||||
- nvidia-curand-cu12==10.3.9.90
|
|
||||||
- nvidia-cusolver-cu12==11.7.3.90
|
|
||||||
- nvidia-cusparse-cu12==12.5.8.93
|
|
||||||
- nvidia-cusparselt-cu12==0.7.1
|
|
||||||
- nvidia-nccl-cu12==2.27.3
|
|
||||||
- nvidia-nvjitlink-cu12==12.8.93
|
|
||||||
- nvidia-nvtx-cu12==12.8.90
|
|
||||||
- objectio==0.2.29
|
|
||||||
- omegaconf==2.3.0
|
|
||||||
- opencv-python==4.11.0.86
|
|
||||||
- pillow==10.4.0
|
|
||||||
- proglog==0.1.12
|
|
||||||
- python-dotenv==1.2.1
|
|
||||||
- rich==14.3.1
|
|
||||||
- shellingham==1.5.4
|
|
||||||
- simplejson==3.20.2
|
|
||||||
- sympy==1.14.0
|
|
||||||
- tensorboard==2.20.0
|
|
||||||
- tensorboard-data-server==0.7.2
|
|
||||||
- threadpoolctl==3.6.0
|
|
||||||
- torch==2.8.0
|
|
||||||
- torchvision==0.23.0
|
|
||||||
- triton==3.4.0
|
|
||||||
- typer==0.21.1
|
|
||||||
- webdataset==0.1.40
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user