From 690e0839ebba613083828e06ebb2a8019119ba13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net>
Date: Mon, 23 Jan 2023 15:13:27 +0100
Subject: [PATCH] `colmap2nerf.py --mask_categories`: error if PyTorch is not
 installed

---
 scripts/colmap2nerf.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/colmap2nerf.py b/scripts/colmap2nerf.py
index c624cb5..88ba5e6 100755
--- a/scripts/colmap2nerf.py
+++ b/scripts/colmap2nerf.py
@@ -396,6 +396,12 @@ if __name__ == "__main__":
 		try:
 			import detectron2
 		except ModuleNotFoundError:
+			try:
+				import torch
+			except ModuleNotFoundError:
+				print("PyTorch is not installed. For automatic masking, install PyTorch from https://pytorch.org/")
+				sys.exit(1)
+
 			input("Detectron2 is not installed. Press enter to install it.")
 			import subprocess
 			package = 'git+https://github.com/facebookresearch/detectron2.git'
-- 
GitLab