Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: read() got an unexpected keyword argument 'ignoregamma' (Solution Provided) #140

Open
JY251 opened this issue Jul 11, 2024 · 1 comment

Comments

@JY251
Copy link

JY251 commented Jul 11, 2024

I have encountered the following error. I have found a solution so I will share with you.

python run_nerf.py --config configs/fern.txt
Traceback (most recent call last):
  File "run_nerf.py", line 878, in <module>
    train()
  File "run_nerf.py", line 542, in train
    images, poses, bds, render_poses, i_test = load_llff_data(args.datadir, args.factor,
  File "/nerf-pytorch/load_llff.py", line 246, in load_llff_data
    poses, bds, imgs = _load_data(basedir, factor=factor) # factor=8 downsamples original imgs by 8x
  File "/nerf-pytorch/load_llff.py", line 114, in _load_data
    imgs = imgs = [imread(f)[...,:3]/255. for f in imgfiles]
  File "/nerf-pytorch/load_llff.py", line 114, in <listcomp>
    imgs = imgs = [imread(f)[...,:3]/255. for f in imgfiles]
  File "/nerf-pytorch/load_llff.py", line 110, in imread
    return imageio.imread(f, ignoregamma=True)
  File "/usr/local/lib/python3.8/dist-packages/imageio/__init__.py", line 97, in imread
    return imread_v2(uri, format=format, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/imageio/v2.py", line 360, in imread
    result = file.read(index=0, **kwargs)
TypeError: read() got an unexpected keyword argument 'ignoregamma'

This issue is similar to Issue #190 in the original bmild/nerf repository, which is implemented based on Tensorflow (but not PyTorch).
Similar with this, to resolve it, update line 110 of load_llff.py as follows:

            return imageio.imread(f, apply_gamma=True)

I hope this helps!

@ash0923
Copy link

ash0923 commented Oct 14, 2024

Updating the version of imageio to 2.9.0 also resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants