ShanghaiTech-IMPACT / TeethDreamer

[MICCAI 2024] TeethDreamer: 3D Teeth Reconstruction from Five Intra-oral Photographs
MIT License
27 stars 2 forks source link

An error about :"FileNotFoundError: [Errno 2] No such file or directory: './TeethDreamer/test_image/reconstruction/oral_upper_cond_000_000_000_000/transforms_train.json'" #8

Closed YangZiz closed 1 week ago

YangZiz commented 2 weeks ago

I followed your tutorial and did everything except for skipping the fifth step of foreground segmentation (although I don't think the fifth step is related to this error), so where did this file come from? Or is it customized?

Xcf-xcf commented 2 weeks ago

Could you provide more details? such as your file structures, your commands and complete error information.

YangZiz commented 2 weeks ago

你能否介绍有关情况?例如您的文件结构、您的命令和完整的错误信息。

The command I am using is:python run.py --img /yy/code/TeethDreamer/test_image/generate/oral_upper_cond_000_000_000_000.png --cpu 4 --dir /yy/code/TeethDreamer/test_image/reconstruction/ --normal --rembg

and the file structure is: oral 0.jpg 1.jpg ... teeth oral_upper 000.png 001.png ... oral_lower generate oral_lower_cond_000_000_000_000.png oral_upper_cond_000_000_000_000.png

And, my complete error message is: (newTeethDreamer) jianjian08:41 下午1999:/yy/code/TeethDreamer/instant-nsr-pl$python run.py --img /yy/code/TeethDreamer/test_image/generate/oral_upper_cond_000_000_000_000.png --cpu 4 --dir /yy/code/TeethDreamer/test_image/reconstruction/ --normal --rembg Downloading data from 'https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx' to file '/home/jianjian/.u2net/u2net.onnx'. Traceback (most recent call last): File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 803, in urlopen **response_kw, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 492, in _make_request raise new_e File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 468, in _make_request self._validate_conn(conn) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 1097, in _validate_conn conn.connect() File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connection.py", line 658, in connect assert_fingerprint=self.assert_fingerprint, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connection.py", line 793, in _ssl_wrap_socket_and_match_hostname tls_in_tls=tls_intls, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/ssl.py", line 471, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, serverhostname) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/ssl.py", line 515, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 423, in wrap_socket session=session File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 870, in _create self.do_handshake() File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 1139, in do_handshake self._sslobj.do_handshake() OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/adapters.py", line 497, in send chunked=chunked, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 846, in urlopen method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/retry.py", line 470, in increment raise reraise(type(error), error, _stacktrace) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/util.py", line 38, in reraise raise value.with_traceback(tb) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 803, in urlopen **response_kw, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 492, in _make_request raise new_e File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 468, in _make_request self._validate_conn(conn) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connectionpool.py", line 1097, in _validate_conn conn.connect() File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connection.py", line 658, in connect assert_fingerprint=self.assert_fingerprint, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/connection.py", line 793, in _ssl_wrap_socket_and_match_hostname tls_in_tls=tls_intls, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/ssl.py", line 471, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, serverhostname) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/urllib3/util/ssl.py", line 515, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 423, in wrap_socket session=session File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 870, in _create self.do_handshake() File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/ssl.py", line 1139, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(0, 'Error'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools.py", line 155, in image_size = prepare_masked_img(args.input, os.path.join(args.output, 'train'), args.rembg, args.normal, args.real) File "tools.py", line 127, in prepare_masked_img masked_img = remove(rgb) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/rembg/bg.py", line 149, in remove session = new_session("u2net", *args, *kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/rembg/session_factory.py", line 26, in new_session return session_class(model_name, sess_opts, providers, args, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/rembg/sessions/base.py", line 32, in init str(self.class.download_models()), File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/rembg/sessions/u2net.py", line 44, in download_models progressbar=True, File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pooch/core.py", line 239, in retrieve stream_download(url, full_path, known_hash, downloader, pooch=None) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pooch/core.py", line 807, in stream_download downloader(url, tmp, pooch) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pooch/downloaders.py", line 220, in call response = requests.get(url, timeout=timeout, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/requests/adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', OSError(0, 'Error')) Global seed set to 42 Using 16bit None Automatic Mixed Precision (AMP) GPU available: True (cuda), used: True TPU available: False, using: 0 TPU cores IPU available: False, using: 0 IPUs HPU available: False, using: 0 HPUs Trainer(limit_train_batches=1.0) was configured so 100% of the batches per epoch will be used.. Trainer(limit_val_batches=1) was configured so 1 batch will be used. [rank: 0] Global seed set to 42 Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1/1

distributed_backend=nccl All distributed processes registered. Starting with 1 processes

Traceback (most recent call last): File "launch.py", line 129, in main() File "launch.py", line 118, in main trainer.fit(system, datamodule=dm) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 609, in fit self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/call.py", line 36, in _call_and_handle_interrupt return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/strategies/launchers/subprocess_script.py", line 88, in launch return function(*args, *kwargs) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 650, in _fit_impl self._run(model, ckpt_path=self.ckpt_path) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1042, in _run self._call_setup_hook() # allow user to setup lightning_module in accelerator environment File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1289, in _call_setup_hook self._call_lightning_datamodule_hook("setup", stage=fn) File "/home/jianjian/anaconda3/envs/newTeethDreamer/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1366, in _call_lightning_datamodule_hook return fn(args, kwargs) File "/yy/code/TeethDreamer/instant-nsr-pl/datasets/blender.py", line 195, in setup self.train_dataset = BlenderIterableDataset(self.config, self.config.train_split) File "/yy/code/TeethDreamer/instant-nsr-pl/datasets/blender.py", line 180, in init self.setup(config, split) File "/yy/code/TeethDreamer/instant-nsr-pl/datasets/blender.py", line 66, in setup with open(os.path.join(self.config.rootdir, f"transforms{self.split}.json"), 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: '/yy/code/TeethDreamer/test_image/reconstruction/oral_upper_cond_000_000_000_000/transforms_train.json'

Looking forward to your reply, thank you!

Xcf-xcf commented 2 weeks ago

In the file run.py, there are two commands for the dataset preparation and teeth reconstruction. In you case, the problem is likely occur in the former. And I think there are some errors in downloading data from 'https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx' to file '/home/jianjian/.u2net/u2net.onnx' during the initialization of rembg package. You can run the command in the line 24 of run.py to prepare the dataset for teeth reconstruction separately and check if rembg package cannot initialize. If you cannot download models online, I recommand you to download offline manually and you can find some instructions in the github page of rembg.

YangZiz commented 1 week ago

Thank you! My problem has been solved.