Ruyi-Zha/naf_cbct

ValueError raised by caculating SSIM at the end of the first epoch

Closed this issue · 2 comments

Here is the backtrace

(naf) ➜  naf_cbct git:(main) python train.py --config ./config/chest_50.yaml

/environment/miniconda3/envs/naf/lib/python3.9/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2228.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
[Start] exp: chest_50, net: Basic network
epoch=0/1500, loss=0.000609, lr=0.001: :  98% 49/50 [00:00<00:00, 84.86it/s]Traceback (most recent call last):
  File "/home/featurize/work/Reconstruction/naf_cbct/train.py", line 100, in <module>
    trainer.start()
  File "/home/featurize/work/Reconstruction/naf_cbct/src/trainer.py", line 108, in start
    loss_test = self.eval_step(global_step=self.global_step)
  File "/home/featurize/work/Reconstruction/naf_cbct/train.py", line 76, in eval_step
    'ssim_3d': get_ssim_3d(image_pred, image),
  File "/home/featurize/work/Reconstruction/naf_cbct/src/util/util.py", line 85, in get_ssim_3d
    ssim = structural_similarity(arr1_d[i], arr2_d[i])
  File "/environment/miniconda3/envs/naf/lib/python3.9/site-packages/skimage/metrics/_structural_similarity.py", line 194, in structural_similarity
    raise ValueError(
ValueError: Since image dtype is floating point, you must specify the data_range parameter. Please read the documentation carefully (including the note). It is recommended that you always specify the data_range anyway.

Well, I find this issue is caused by this commit of scikit-image
To fix the problem, use python package scikit-image<=0.19

Thanks a lot for your help. I have specified versions of all the packages to avoid possible conflicts.

Ruyi