Error after labelling frames

Hello everyone

I am working on macOS Catalina using the terminal in DLC-CPU environment with pythonw.

I labelled the extracted frames, and I get as an output in the labeled-data folder two collectedData files (.csv and .h5). So I assume that the labelling worked.

But when I want to check the labels or create a training dataset I get following error:


Creating images with labels by Charis.
Traceback (most recent call last):
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/deeplabcut/gui/label_frames.py", line 94, in check_labelF
    deeplabcut.check_labels(self.config)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/trainingsetmanipulation.py", line 300, in check_labels
    MakeLabeledPlots(folder,DataCombined,cfg,Labels,Colorscheme,cc,scale)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/trainingsetmanipulation.py", line 310, in MakeLabeledPlots
    image = io.imread(os.path.join(cfg['project_path'],imagename))
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/skimage/io/_io.py", line 48, in imread
    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/skimage/io/manage_plugins.py", line 210, in call_plugin
    return func(*args, **kwargs)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/skimage/io/_plugins/imageio_plugin.py", line 10, in imread
    return np.asarray(imageio_imread(*args, **kwargs))
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/imageio/core/functions.py", line 267, in imread
    return reader.get_data(0)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/imageio/core/format.py", line 346, in get_data
    im, meta = self._get_data(index, **kwargs)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/imageio/plugins/pillow.py", line 301, in _get_data
    im, info = PillowFormat.Reader._get_data(self, index)
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/imageio/plugins/pillow.py", line 170, in _get_data
    i = self._im.tell()
  File "/Applications/anaconda3/envs/DLC-CPU/lib/python3.7/site-packages/PIL/PngImagePlugin.py", line 827, in tell
    return self.__frame
AttributeError: 'PngImageFile' object has no attribute '_PngImageFile__frame'

Does someone has any advice what the problem might be?
Thanks you!

hi Sofia, welcome to the forum! Strange error! Could you tell me what version of skimage you have installed?
in the env:
pythonw
import skimage
skimage.__version__

Hi Mackenzie

Thank you for your answer!

I have skimage version 0.16.2

I was getting the same error when refining labels.

I tracked the problem down to Pillow (7.1.0), and is mentioned on their GitHub. They fixed it fairly quickly, so it should only affect people who installed their env within the past week.

To fix an existing env:

conda activate DLC-CPU
pip install Pillow --upgrade

Brandon

2 Likes

Hi Brandon
Thank you for your help! This worked for me.

1 Like