YoungJoongUNC / Neural_Human_Performer

Other
125 stars 14 forks source link

FileNotFoundError in can_smpl.py #7

Closed markomih closed 2 years ago

markomih commented 2 years ago

Hi, seems that there is a bug in lib/datasets/light_stage/can_smpl.py (for CoreView_313 and CoreView_315) that is related to differences in file names. I simply tried to run the training script:

# training
CUDA_VISIBLE_DEVICES=0 python train_net.py --cfg_file configs/train_or_eval.yaml virt_data_root data/zju_mocap rasterize_root data/zju_rasterization ratio 0.5 H 1024 W 1024 run_mode train jitter True exp_name nhp resume True gpus "0,"
YoungJoongUNC commented 2 years ago

Hello, could you provide the error message?

markomih commented 2 years ago

Sure. The error does not occur If I remove CoreView_313 and CoreView_315 from the training split in get_human_info.py.

(nhp) marko@marko:~/projects/nhp_fork$ CUDA_VISIBLE_DEVICES=0 python train_net.py --cfg_file configs/train_or_eval.yaml virt_data_root data/zju_mocap rasterize_root data/zju_rasterization ratio 0.5 H 1024 W 1024 run_mode train jitter True exp_name nhp resume True gpus "0,"
Using torchvision resnet18 encoder
Pretrained: True
the results are saved at data/result/if_nerf/nhp/epoch_-1/debug
eta: 0:12:24  epoch: 0  step: 1  img_loss: 0.1742  loss: 0.1742  data: 0.6247  batch: 1.4920  lr: 0.000500  max_mem: 5596
eta: 0:07:58  epoch: 0  step: 2  img_loss: 0.1836  loss: 0.1836  data: 0.3125  batch: 0.9616  lr: 0.000500  max_mem: 5668
Traceback (most recent call last):
  File "train_net.py", line 116, in <module>
    main()
  File "train_net.py", line 112, in main
    train(cfg, network)
  File "train_net.py", line 47, in train
    trainer.train(epoch, train_loader, optimizer, recorder)
  File "/home/marko/projects/nhp_fork/lib/train/trainers/trainer.py", line 43, in train
    for iteration, batch in enumerate(data_loader):
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1183, in _next_data
    return self._process_data(data)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/_utils.py", line 434, in reraise
    raise exception
FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 2.
Original Traceback (most recent call last):
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "lib/datasets/light_stage/can_smpl.py", line 330, in __getitem__
    img = imageio.imread(img_path)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/imageio/__init__.py", line 86, in imread
    return imread_v2(uri, format=format, **kwargs)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/imageio/v2.py", line 159, in imread
    with imopen(uri, "ri", plugin=format) as file:
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/imageio/core/imopen.py", line 162, in imopen
    request = Request(uri, io_mode, format_hint=format_hint)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/imageio/core/request.py", line 248, in __init__
    self._parse_uri(uri)
  File "/home/marko/anaconda3/envs/nhp/lib/python3.8/site-packages/imageio/core/request.py", line 388, in _parse_uri
    raise FileNotFoundError("No such file: '%s'" % fn)
FileNotFoundError: No such file: '/home/marko/projects/nhp_fork/data/zju_mocap/CoreView_315/Camera (2)/0283.jpg'
YoungJoongUNC commented 2 years ago

Subject 313 and 315 of the original Neural Body dataset have different rgb and mask file name format. So you need to first change the rgb and mask file name format of subject 313 and 315.

I have uploaded the script for modifying the file name format for subject 313 and 315. You can run it using the following command:

python lib/utils/modify_313_315_filename.py

Thank you for reporting this issue! :)