Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] Add windows powershell scripts #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ data/*.MOV
data/*.mp4
data/colmap_text
data/transforms.json
lightning_logs
*.zip
external
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Place your video in `data` folder and pass the video path to the script. There a
./scripts/train_from_video.sh -v {your_video_name} -s {scale} -f {video_fps}
```

Nerf use colmap to get the posture of the camera, so you need to download the colmap from [here](https://github.com/colmap/colmap/releases), and rename the directory to "colmap" and put it in the "external" directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only true for windows?

Copy link
Author

@chunleili chunleili Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only true for windows?

It should be true for any platform. But I only test it on Win10 for now. If you are not certain, please delete this passage.


## [Preview] Mobile Deployment

Using [Taichi AOT](https://docs.taichi-lang.org/docs/tutorial), you can easily deploy a NeRF rendering pipeline on any mobile devices!
Expand Down
2 changes: 1 addition & 1 deletion data/colmap2nerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def run_colmap(args):

# On Windows, if FFmpeg isn't found, try automatically downloading it from the internet
if os.name == "nt" and os.system(f"where {colmap_binary} >nul 2>nul") != 0:
colmap_glob = os.path.join(ROOT_DIR, "external", "colmap", "*", "COLMAP.bat")
colmap_glob = os.path.join(ROOT_DIR, "external", "colmap", "COLMAP.bat")
candidates = glob(colmap_glob)
if not candidates:
print("COLMAP not found. Attempting to download COLMAP from the internet.")
Expand Down
1 change: 1 addition & 0 deletions scripts/train_360_v2_garden.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python train.py --root_dir ./360_v2/garden --dataset_name colmap --exp_name garden --downsample 0.25 --no_save_test --num_epochs 20 --scale 16.0 --gui
20 changes: 20 additions & 0 deletions scripts/train_from_video.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Put your video in data/ folder and update filename VIDEO_FILE
# SCALE choose from 1, 4, 8, 16, 64; 16 is recommended for a real screne
# VIDEO_FPS = 2 is suitable for a one minute video
set VIDEO_FILE 'video.mp4'
set SCALE 16
set VIDEO_FPS 2

echo "video path $VIDEO_FILE"
echo "scale $SCALE"
echo "video fps $VIDEO_FPS"

cd "data"

python colmap2nerf.py --video_in $VIDEO_FILE --video_fps $VIDEO_FPS --run_colmap --aabb_scale $SCALE --images images

Move-Item colmap_sparse sparse
cd ..


python train.py --root_dir data --dataset_name colmap --exp_name custom --downsample 0.25 --num_epochs 20 --scale $SCALE --gui
1 change: 1 addition & 0 deletions scripts/train_nsvf_lego.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python train.py --root_dir "./Synthetic_NeRF/Lego" --exp_name Lego --perf --num_epochs 20 --batch_size 8192 --lr 1e-2 --no_save_test --gui --ckpt_path=./ckpts/nsvf/Lego/epoch=19-v2.ckpt --val_only