However, I encountered an error with the following traceback:
==> use shapenet dataset
==> ERROR!!!! THIS SHOULD ONLY HAPPEN WHEN USING INFERENCE
==> use image path: ./tmp, num images: 1234
dataset = <training.dataset.ImageFolderDataset object at 0x7f6aaedb1640>
len(dataset) = 1234
==> preparing the cache for fid scores
{'class_name': 'training.dataset.ImageFolderDataset', 'path': './tmp', 'use_labels': False, 'max_size': None, 'xflip': False, 'resolution': 1024, 'data_camera_mode': 'shapenet_car', 'add_camera_cond': True, 'camera_path': './tmp', 'split': 'test', 'random_seed': 0}
0%| | 0/20 [00:00<?, ?it/s]_metric_dict = {'fid50k_full': <function fid50k_full at 0x7fbaa173be50>, 'kid50k_full': <function kid50k_full at 0x7fbaa173bee0>, 'pr50k3_full': <function pr50k3_full at 0x7fbaa173bf70>, 'ppl2_wend': <function ppl2_wend at 0x7fbaa1745040>, 'eqt50k_int': <function eqt50k_int at 0x7fbaa17450d0>, 'eqt50k_frac': <function eqt50k_frac at 0x7fbaa1745160>, 'eqr50k': <function eqr50k at 0x7fbaa17451f0>, 'fid50k': <function fid50k at 0x7fbaa1745280>, 'kid50k': <function kid50k at 0x7fbaa1745310>, 'pr50k3': <function pr50k3 at 0x7fbaa17453a0>, 'is50k': <function is50k at 0x7fbaa1745430>}
_metric_dict = {'fid50k_full': <function fid50k_full at 0x7f3c04a6ce50>, 'kid50k_full': <function kid50k_full at 0x7f3c04a6cee0>, 'pr50k3_full': <function pr50k3_full at 0x7f3c04a6cf70>, 'ppl2_wend': <function ppl2_wend at 0x7f3c04a73040>, 'eqt50k_int': <function eqt50k_int at 0x7f3c04a730d0>, 'eqt50k_frac': <function eqt50k_frac at 0x7f3c04a73160>, 'eqr50k': <function eqr50k at 0x7f3c04a731f0>, 'fid50k': <function fid50k at 0x7f3c04a73280>, 'kid50k': <function kid50k at 0x7f3c04a73310>, 'pr50k3': <function pr50k3 at 0x7f3c04a733a0>, 'is50k': <function is50k at 0x7f3c04a73430>}
_metric_dict = {'fid50k_full': <function fid50k_full at 0x7f86a96b0e50>, 'kid50k_full': <function kid50k_full at 0x7f86a96b0ee0>, 'pr50k3_full': <function pr50k3_full at 0x7f86a96b0f70>, 'ppl2_wend': <function ppl2_wend at 0x7f86a96af040>, 'eqt50k_int': <function eqt50k_int at 0x7f86a96af0d0>, 'eqt50k_frac': <function eqt50k_frac at 0x7f86a96af160>, 'eqr50k': <function eqr50k at 0x7f86a96af1f0>, 'fid50k': <function fid50k at 0x7f86a96af280>, 'kid50k': <function kid50k at 0x7f86a96af310>, 'pr50k3': <function pr50k3 at 0x7f86a96af3a0>, 'is50k': <function is50k at 0x7f86a96af430>}
0%| | 0/20 [00:02<?, ?it/s]
Traceback (most recent call last):
File "train_3d.py", line 398, in <module>
main() # pylint: disable=no-value-for-parameter
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/conda/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "train_3d.py", line 391, in main
launch_training(c=c, desc=desc, outdir=opts.outdir, dry_run=opts.dry_run)
File "train_3d.py", line 124, in launch_training
subprocess_fn(rank=0, c=c, temp_dir=temp_dir)
File "train_3d.py", line 48, in subprocess_fn
inference_3d.inference(rank=rank, **c)
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/training/inference_3d.py", line 138, in inference
result_dict = metric_main.calc_metric(metric=metric,
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/metrics/metric_main.py", line 66, in calc_metric
results = _metric_dict[metric](opts)
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/metrics/metric_main.py", line 184, in fid50k
fid = frechet_inception_distance.compute_fid(opts, max_real=50000, num_gen=50000)
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/metrics/frechet_inception_distance.py", line 44, in compute_fid
mu_real, sigma_real = metric_utils.compute_feature_stats_for_dataset(opts=opts,
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/metrics/metric_utils.py", line 304, in compute_feature_stats_for_dataset
for images, _labels, _masks in tqdm(
File "/opt/conda/lib/python3.8/site-packages/tqdm/std.py", line 1185, in __iter__
for obj in iterable:
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
data = self._next_data()
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/opt/conda/lib/python3.8/site-packages/torch/_utils.py", line 425, in reraise
raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/qing/Project_13_Mesh_Generation/2_GET3D/training/dataset.py", line 292, in __getitem__
img = ori_img[:, :, :3][..., ::-1]
TypeError: 'NoneType' object is not subscriptable
It appears that the error is related to the --inference_compute_fid 1 flag. Any guidance or suggestions on how to resolve this issue would be greatly appreciated.
Hi, sir. I followed your instructions to calculate the FID score, and I was able to successfully run the following command:
python train_3d.py --outdir=save_inference_results/shapenet_car-exp3 --gpus=1 --batch=4 --gamma=40 --data_camera_mode shapenet_car --dmtet_scale 1.0 --use_shapenet_split 1 --one_3d_generator 1 --fp32 0 --inference_vis 1 --resume_pretrain /home/qing/Project_13_Mesh_Generation/2_GET3D/pretrained_model/shapenet_car.pt --inference_to_generate_textured_mesh 1 --inference_save_interpolation 1
Now, I want to include the --inference_compute_fid 1 flag at the end of the command to calculate the FID score:
python train_3d.py --outdir=save_inference_results/shapenet_car-exp4 --gpus=1 --batch=4 --gamma=40 --data_camera_mode shapenet_car --dmtet_scale 1.0 --use_shapenet_split 1 --one_3d_generator 1 --fp32 0 --inference_vis 1 --resume_pretrain /home/qing/Project_13_Mesh_Generation/2_GET3D/pretrained_model/shapenet_car.pt --inference_to_generate_textured_mesh 1 --inference_save_interpolation 1 --inference_compute_fid 1
However, I encountered an error with the following traceback:
It appears that the error is related to the --inference_compute_fid 1 flag. Any guidance or suggestions on how to resolve this issue would be greatly appreciated.
Thank you!