tensorflow / tensorflow/datasets

`Imagenet2012CorruptedTest.test_download_and_prepare_as_dataset` is broken

Open
#3,673 1 comment 0 reactions 1 assignee View on GitHub

@ndl is already working on this.

Since Jan 17, 2022.

bug
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

Short description

Imagenet2012CorruptedTest.test_download_and_prepare_as_dataset test gives an error FileNotFoundError: [Errno 2] No such file or directory: 'imagemagick' despite ImageMagick being installed. After that particular issue is patched, the next error is AttributeError: module 'cv2' has no attribute 'CVX_8U'.

Environment information

  • Operating Systems: both Ubuntu 22.04 (in docker with virtualenv) and NixOS 21.11 with nixpkgs on 'master'.

  • Python version: 3.9.9

  • tensorflow-datasets/tfds-nightly version: 4.4.0

  • tensorflow/tf-nightly version: 2.7.0

  • Does the issue still exists with the last tfds-nightly package (pip install --upgrade tfds-nightly) ? Yes.

Reproduction instructions

pytest ./tensorflow_datasets/image_classification/imagenet2012_corrupted_test.py

Expected behavior

The test succeeds.

Additional context

There seem to be two problems with the tensorflow_datasets/image_classification/corruptions.py implementation:

  • Most (all?) distributions call ImageMagick binary convert (for v6.x) or magick (but typically with convert as a link to it, for v7.x), I'm not sure which one uses imagemagick binary name => imagemagick should be replaced with convert.
  • The code uses the constant CVX_8U which, I believe, doesn't exist and is a typo? => CVX_8U should be replaced with CV_8U.

When both of these problems are fixed - the tests succeeds. See also the patch pkgs/development/python-modules/tensorflow-datasets/corruptions.patch in https://github.com/NixOS/nixpkgs/pull/154117 LMK if you want me to create a pull request against tensorflow-datasets with this patch applied.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.