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.

[BUG]: Cannot decompress jpeg error for SpaceNet Rio imagery

See original GitHub issue

Thank you for helping us improve solaris!

Summary of the bug

I’m receiving ValueError: cannot decompress jpeg after trying to run a command. I’m point the .yml file to 500x500px .tif files. Just as the API Tiling Tutorial.

I’m not sure what should I put as input for this command. TIFF, PNG, JPG images? From which size?

Steps to reproduce the bug

import solaris as sol
config = sol.utils.config.parse('path/to/file.yml')
inferer = sol.nets.infer.Inferer(config)
inference_data = sol.nets.infer.get_infer_df(config)

Steps to reproduce the behavior: Run this on Jupyter after installing solaris.

Buggy behavior and/or error message

Please describe the buggy behavior and/or paste output here.

ValueError                                Traceback (most recent call last)
<ipython-input-7-cd090e093ecc> in <module>
      3 inferer = sol.nets.infer.Inferer(config)
      4 inference_data = sol.nets.infer.get_infer_df(config)
----> 5 inferer(inference_data)

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/solaris/nets/ in __call__(self, infer_df)
     62         for idx, im_path in enumerate(infer_df['image']):
     63             inf_input, idx_refs, (
---> 64                 src_im_height, src_im_width) = inf_tiler(im_path)
     66             if self.framework == 'keras':

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/solaris/nets/ in __call__(self, im)
    259         # read in the image if it's a path
    260         if isinstance(im, str):
--> 261             im = imread(im)
    262         # determine how many samples will be generated with the sliding window
    263         src_im_height = im.shape[0]

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/solaris/utils/ in imread(path, make_8bit, rescale, rescale_min, rescale_max)
     51     """
---> 52     im_arr =
     53     # check dtype for preprocessing
     54     if im_arr.dtype == np.uint8:

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/skimage/io/ in imread(fname, as_gray, plugin, flatten, **plugin_args)
     60     with file_or_url_context(fname) as fname:
---> 61         img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
     63     if not hasattr(img, 'ndim'):

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/skimage/io/ in call_plugin(kind, *args, **kwargs)
    208                                (plugin, kind))
--> 210     return func(*args, **kwargs)

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/skimage/io/_plugins/ in imread(fname, dtype, **kwargs)
     36     # read and return tiff as numpy array
     37     with TiffFile(fname, **kwargs_tiff) as tif:
---> 38         return tif.asarray(**kwargs)

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/skimage/external/tifffile/ in asarray(self, key, series, memmap, tempdir)
   1505                                      colormapped=False, squeeze=False)
   1506         elif len(pages) == 1:
-> 1507             result = pages[0].asarray(memmap=memmap)
   1508         elif self.is_ome:
   1509             assert not self.is_indexed, "color mapping disabled for ome-tiff"

~/miniconda3/envs/project-v1-nogpu/lib/python3.6/site-packages/skimage/external/tifffile/ in asarray(self, squeeze, colormapped, rgbonly, scale_mdgel, memmap, reopen, maxsize)
   2482                 self.sample_format, self.bits_per_sample))
   2483         if self.compression not in TIFF_DECOMPESSORS:
-> 2484             raise ValueError("cannot decompress %s" % self.compression)
   2485         if 'sample_format' in self.tags:
   2486             tag = self.tags['sample_format']

ValueError: cannot decompress jpeg

Environment information

  • OS: Ubuntu 18.10
  • solaris version: 0.1.2
  • python version: 3.7
  • version of any relevant dependencies (optional - we may ask for this information later if not provided)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

nrweircommented, Jul 29, 2019

Thanks @jacquesmats for the clarification and glad it worked.

I’m going to re-name the issue and flag it to help with tracking. My guess is that the issue is related to the formatting of those images being incompatible with scikit-image’s default TIFF loading schema. I’ll try to explore what’s going on if I get around to it, but feel free to explore yourself and drop your findings here.

AH-Meriicommented, Oct 23, 2020

@nrweir I was facing the same issue, in order to resolve it I pip installed imagecodecs. Note: I had to pip install it as it wasn’t being resolved when I attempted to conda install. After installing imagecodecs, everything seemed to work as expected.

I myself am developing using the docker environment that you provided, so in I added this requirement to the Dockerfile by doing the following:

# activate conda environment
SHELL ["conda", "run", "-n", "solaris", "/bin/bash", "-c"]

# pip install imagecodecs in conda environment
RUN pip install imagecodecs
Read more comments on GitHub >

github_iconTop Results From Across the Web

Newest 'jpg' Questions - GIS Stack Exchange
When manually creating a World Image (JPEG) repository in GeoServer 2.15.5-2.21.1, I get an error: Could not list layers for this store, an...
Read more >
Bug #1949063 “Add F81966 watchdog support”
This bug is awaiting verification that the linux/5.11.0-44.48 kernel in -proposed solves the problem. Please test the kernel and update this bug with...
Read more >
Rio de Janeiro - SpaceNet
To download the Source Imagery Mosaic (3-band = 2.3 GB and 8-band = 6.5 GB):. aws s3 cp s3://spacenet-dataset/spacenet/SN1_buildings/tarballs/ ...
Read more >
SpaceNet v1.3 User's Guide - MIT Strategic Engineering
One of the unique features of SpaceNet is that it supports not ... classes of supply, the modeling problem can be reduced to...
Read more >
Machine Learning Datasets | Papers With Code
SpaceNet 2: Building Detection v2 - is a dataset for building footprint detection ... satellite imagery at 0.3m pixel res., across 5 cities...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found