DAI-Lab / SteganoGAN

SteganoGAN is a tool for creating steganographic images using adversarial training.
MIT License
305 stars 85 forks source link

AttributeError:'PngImageFile' issue encoding and decoding image #59

Closed SINDHUN97 closed 4 years ago

SINDHUN97 commented 4 years ago

Description

I am not able to encode or decode images(format .png). Error encountered:

AttributeError: 'PngImageFile' object has no attribute '_PngImageFile__frame'

What I Did

Tried encoding and decoding both the ways mentioned in SteganoGAN github page
1.Using command line and 2.Python interaction

1.Using Command Line
steganogan encode path/to/cover/image.png "Message to hide"
steganogan decode path/to/generated/image.png

2.Python
>>> from steganogan import SteganoGAN
>>> steganogan = SteganoGAN.load('steganogan/pretrained/dense.steg')

>>>steganogan.encode('research/input.png', 'research/output.png', 'This is a super secret message!')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "..\Python\Python37\lib\site-packages\steganogan\models.py", line 295, in encode
    cover = imread(cover, pilmode='RGB') / 127.5 - 1.0
  File "..\Python\Python37\lib\site-packages\imageio\core\functions.py", line 267, in imread
    return reader.get_data(0)
  File "..\Python\Python37\lib\site-packages\imageio\core\format.py", line 346, in get_data
    im, meta = self._get_data(index, **kwargs)
  File "..\Python\Python37\lib\site-packages\imageio\plugins\pillow.py", line 301, in _get_data
    im, info = PillowFormat.Reader._get_data(self, index)
  File "..\Python\Python37\lib\site-packages\imageio\plugins\pillow.py", line 170, in _get_data
    i = self._im.tell()
  File "..\Python\Python37\lib\site-packages\PIL\PngImagePlugin.py", line 827, in tell
    return self.__frame
AttributeError: 'PngImageFile' object has no attribute '_PngImageFile__frame'
pvk-developer commented 4 years ago

Hello @SINDHUN97, we have made a new release that may solve the issue that you are facing.

Can you try to install it again and run the example in the README. If you are using pip make sure to use: pip install steganogan=0.1.3, this will install force to install the latest version. I would recommend you to use a new virtualenv this way it will install everything from scratch.

If your problem persists:

Let us know if you were able to solve it or not.

SINDHUN97 commented 4 years ago

Hi @pvk-developer , Thanks for the response and this new release is working.

jatindarkumar12 commented 11 months ago

hello sir sir we train this model on DIV2k dataset on 100 epocs and encoding is also done perfectly but in decoding it says failed to find message why?