question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: _open() got an unexpected keyword argument 'as_gray'

See original GitHub issue

Describe the bug I pretty much followed the classification tutorial and changed the dataset to my own dataset and I receive an imread error of similar nature to a very old issue #472

TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.6/dist-packages/catalyst/data/dataset.py", line 50, in __getitem__
    dict_ = self.open_fn(item)
  File "/usr/local/lib/python3.6/dist-packages/catalyst/data/reader.py", line 251, in __call__
    for fn in self.readers:
  File "/usr/local/lib/python3.6/dist-packages/catalyst/data/reader.py", line 79, in __call__
    img = imread(
  File "/usr/local/lib/python3.6/dist-packages/catalyst/contrib/utils/image.py", line 73, in imread
    # @TODO: add tiff support, currently – jpg and png
  File "/usr/local/lib/python3.6/dist-packages/imageio/core/functions.py", line 221, in imread
    reader = read(uri, format, "i", **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/imageio/core/functions.py", line 143, in get_reader
    return format.get_reader(request)
  File "/usr/local/lib/python3.6/dist-packages/imageio/core/format.py", line 174, in get_reader
    return self.Reader(self, request)
  File "/usr/local/lib/python3.6/dist-packages/imageio/core/format.py", line 224, in __init__
    self._open(**self.request.kwargs.copy())
TypeError: _open() got an unexpected keyword argument 'as_gray'

To Reproduce I have cloned notebook which should download my dataset here and should replicate the issue.

Expected behavior It should start outputting the Epoch’s Accuracies etc just like example Artist dataset should.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
andrew12678commented, Apr 18, 2020

@Scitator I’ve checked all the images using ImageMagick by converting everything to JPG if they weren’t already JPG

@YaLTeR Unfortunately I still get the error in the notebook with that particular change

0reactions
Scitatorcommented, Jun 25, 2020

@lokeshkvn yup, utils.imread is mostly focused on typical image formats, like .jpg, .png etc. For .tiff, .gif - you can try to use utils.mimread instead 😃 Nevertheless, PR with appropriate docs (that you find clear to use and read) would be really welcome, thanks in advance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: self._open() got an unexpected keyword argument ...
As skimage moved forward in versions, they decided to rename some function argument from as_grey to as_gray .
Read more >
TypeError: _open() got an unexpected keyword argument ...
TypeError : _open() got an unexpected keyword argument 'as_grey' As I am new to scikit-image, I am unable to understand what went wrong...
Read more >
Python error TypeError encoding is an invalid keyword ...
I have a tine code snippet and it gives me the following error: TypeError: 'encoding' is an invalid keyword argument for this function....
Read more >
Solved: Why am I getting error "'newline' is an invalid ke...
Why am I getting error "'newline' is an invalid keyword argument" using the ... with open(FILENAME, 'w', newline='') as csvfile: TypeError: 'newline' is...
Read more >
TypeError: uploadFile() got an unexpected keyword argument ...
Problem. Error message: TypeError: uploadFile() got an unexpected keyword argument 'createVersion'. 4.0 - Collaboration and Deployment services ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found