run_demo.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -e
  3. # set -x
  4. if [ ! -f utils.py ]; then
  5. echo "Downloading utils.py from the SuperGlue repo."
  6. echo "We cannot provide this file directly due to its strict licence."
  7. wget https://raw.githubusercontent.com/magicleap/SuperGluePretrainedNetwork/master/models/utils.py
  8. fi
  9. # Use webcam 0 as input source.
  10. input=0
  11. # or use a pre-recorded video given the path.
  12. # input=/home/sunjiaming/Downloads/scannet_test/$scene_name.mp4
  13. # Toggle indoor/outdoor model here.
  14. model_ckpt=../weights/indoor_ds.ckpt
  15. # model_ckpt=../weights/outdoor_ds.ckpt
  16. # Optionally assign the GPU ID.
  17. # export CUDA_VISIBLE_DEVICES=0
  18. echo "Running LoFTR demo.."
  19. eval "$(conda shell.bash hook)"
  20. conda activate loftr
  21. python demo_loftr.py --weight $model_ckpt --input $input
  22. # To save the input video and output match visualizations.
  23. # python demo_loftr.py --weight $model_ckpt --input $input --save_video --save_input
  24. # Running on remote GPU servers with no GUI.
  25. # Save images first.
  26. # python demo_loftr.py --weight $model_ckpt --input $input --no_display --output_dir="./demo_images/"
  27. # Then convert them to a video.
  28. # ffmpeg -framerate 15 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4