nerfstudio-pixel-nerf
Unofficial pixelNeRF integration for Nerfstudio. A framework for training and rendering few-shot Neural Radiance Fields using image-conditioned feature extraction.
Install
uv pip install -e .
Verify method registration
ns-train --help | grep -i pixel-nerf
Dataset Format
This integration uses a custom pipeline to inject source views dynamically into the RayBundle metadata. It is compatible with the standard NerfstudioDataParserConfig. Point the dataparser to a scene root containing a valid transforms.json.
Test-Time Adaptation & Fine-Tuning Taxonomy
PixelNeRF supports formal test-time adaptation (TTA) strategies across Full Fine-Tuning (FFT), Partial Fine-Tuning (PFT), and Parameter-Efficient Fine-Tuning (PEFT/LoRA) via --pipeline.model.adaptation_strategy:
| Strategy | Flag (--pipeline.model.adaptation_strategy) |
Trainable Parameters | Description |
|---|---|---|---|
| Zero-Shot | zero-shot |
0% (0 params) | Pure generalization without updating any weights at test time. |
| Full Fine-Tuning (FFT) | full-ft |
100% (~21.5M params) | All 2D ResNet encoder and NeRF synthesis MLP weights receive gradients. |
| PFT (Decoder-Only) | pft-decoder |
~0.77% (~165k params) | Freezes the 2D ResNet encoder; optimizes only the synthesis MLPs (mlp_coarse / mlp_fine). |
| PFT (Backbone-Only) | pft-backbone |
~99.23% (~21.3M params) | Adapts 2D feature extraction to novel image distributions while keeping synthesis MLPs frozen. |
| BitFit | bitfit |
~0.04% (~9.4k params) | Freezes all weight matrices $W$ and trains only additive bias vectors $b$. |
| PEFT (LoRA) | peft-lora |
~0.07% (~14.4k params) | Keeps 100% of base weights frozen; injects low-rank adapters ($W = W_0 + \frac{\alpha}{r} BA$) into target linear layers. |
1. Zero-Shot Generalization (Default)
Runs test-time evaluation without updating model weights:
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy zero-shot
2. Full Fine-Tuning (FFT)
Updates both the ResNet encoder and NeRF MLPs:
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy full-ft \
--optimizers.encoder.optimizer.lr 1e-5 \
--optimizers.nerf.optimizer.lr 1e-4
3. Partial Fine-Tuning (PFT)
PFT-Decoder (Freeze 2D Feature Extractor)
Keeps the 2D ResNet encoder frozen and adapts only the neural synthesis MLPs:
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy pft-decoder
PFT-Backbone (Freeze Neural Renderer)
Optimizes the 2D feature extractor for distinct domain shifts (e.g. histopathology, microscopy) while freezing synthesis MLPs:
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy pft-backbone
BitFit (Bias-Only Fine-Tuning)
Freezes all weight matrices and updates only additive bias terms:
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy bitfit
4. Parameter-Efficient Fine-Tuning (PEFT with LoRA)
Injects low-rank trainable decomposition matrices $A$ and $B$ into the synthesis MLP layers while keeping base weights 100% frozen:
$$W = W_0 + \frac{\alpha}{r} (B \cdot A)$$
ns-train pixel-nerf \
--data /path/to/scene_root \
--pipeline.model.transfer_learning True \
--pipeline.model.pretrained_ckpt_path /path/to/pixelnerf_pretrained.pth \
--pipeline.model.adaptation_strategy peft-lora \
--pipeline.model.lora_rank 4 \
--pipeline.model.lora_alpha 8.0 \
--pipeline.model.lora_target_modules '["q_proj", "v_proj", "fc"]'
Zero-Overhead Inference (Weight Merging)
Before evaluation or deployment, call model.merge_lora_weights() to fold the adapter update directly into the base weights ($W_0 \leftarrow W_0 + \Delta W$). This guarantees zero FPS overhead during rendering. To resume fine-tuning, call model.unmerge_lora_weights().
# In Python
model.merge_lora_weights() # Merges delta W into base weights (zero runtime overhead)
# ... run high-FPS inference ...
model.unmerge_lora_weights() # Restores separate adapters if continuing training
Console Diagnostic Logs
When initializing any adaptation strategy, PixelNeRF logs precise parameter accounting to the console:
==============================================================================
[Few-Shot NeRF] Adaptation & Fine-Tuning Configuration
==============================================================================
Model: PixelNeRFModel
Strategy: PEFT-LORA (peft-lora)
Total Parameters: 21,464,433
Trainable Parameters:14,376
Trainable Ratio: 0.0670% (peft-lora: 0.07% trainable)
Configuration: PEFT-LoRA (rank=4, alpha=8.0, targets=['q_proj', 'v_proj', 'fc']): 16 linear layers adapted.
==============================================================================
Smoke Check
python test.py
Metadata
Release files for nerfstudio-pixelnerf 0.0.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nerfstudio_pixelnerf-0.0.22.tar.gz | 1.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nerfstudio_pixelnerf-0.0.22-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.9 MB
Release files / nerfstudio_pixelnerf-0.0.22.tar.gz
| Download URL | nerfstudio_pixelnerf-0.0.22.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cf35b162d65128001594fbf8ba10aa9376299850b231c9056586fae85c7c669
|
|
BLAKE2b-256 checksum How to use checksums |
c981fea02c6d5877772a12f3c921f1280089288d86f9a27389f84bdedaf8629e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nerfstudio_pixelnerf-0.0.22-py3-none-any.whl
| Download URL | nerfstudio_pixelnerf-0.0.22-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c3ee87374dcd547e7a1c2f539c62bbf808b265507460f2c348c325a92d99868
|
|
BLAKE2b-256 checksum How to use checksums |
43501e9dcd8b980c06b7a880067931776ef3cb5cc54cba29b8a56a2c2c36422d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|