IBM / MAX-Image-Resolution-Enhancer

Upscale an image by a factor of 4, while generating photo-realistic details.
https://developer.ibm.com/exchanges/models/all/max-image-resolution-enhancer/
Apache License 2.0
985 stars 155 forks source link

Create powerai-based dockerfile, powerai builds for x86/ppc #16

Open mattborgard opened 4 years ago

mattborgard commented 4 years ago

It looks like there's an actual functional error:

Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/anaconda3/lib/python3.6/site-packages/flask_restplus/api.py", line 319, in wrapper
    resp = resource(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.6/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/workspace/api/predict.py", line 51, in post
    return send_file(self.model_wrapper.write_image(output_image), mimetype='image/png', attachment_filename='result.png')
  File "/workspace/core/model.py", line 103, in write_image
    skimage.io.imsave(stream, image)
  File "/opt/anaconda3/lib/python3.6/site-packages/skimage/io/_io.py", line 144, in imsave
    return call_plugin('imsave', fname, arr, plugin=plugin, **plugin_args)
  File "/opt/anaconda3/lib/python3.6/site-packages/skimage/io/manage_plugins.py", line 210, in call_plugin
    return func(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.6/site-packages/imageio/core/functions.py", line 259, in imwrite
    writer = get_writer(uri, format, "i", **kwargs)
  File "/opt/anaconda3/lib/python3.6/site-packages/imageio/core/functions.py", line 183, in get_writer
    "Could not find a format to write the specified file " "in mode %r" % mode
ValueError: Could not find a format to write the specified file in mode 'i'
mattborgard commented 4 years ago

@splovyt If you have any insight on the imagio error, I'd appreciate it! I'll try upgrading Flask from 1.0.1 back to 1.1.1 (not a trivial change on the powerai image, but if it's required, we can make it work) to see if it makes any difference here.

splovyt commented 4 years ago

Hi @mattborgard, thanks for your PR! Would it be possible to specify the library versions in your requirements file? That way, we know for sure that we are on the same page there.

Your current requirements-pai.txt:

Pillow
tensorflow
scikit-image
imageio

Aligning this with the requirements.txt file, this can be changed to:

Pillow==5.4.1
tensorflow==1.12.2
scikit-image==0.14.2
imageio==2.5.0

Feel free to change the tensorflow version if you cannot set it to 1.12.2, the problem is likely not there anyways. If the issue persists, I'll take a deeper look! Thank you!

mattborgard commented 4 years ago

One of the issues with a powerai base is that most of the packages are pinned to very specific versions. Some of these can be updated to different versions, but this causes a downgrade to tensorflow which defeats the purpose of our conda install (this specific install through powerai's channel means we don't have to worry about license issues, etc).

This package versions can likely be changed if necessary with the powerai team, but we will probably need to identify exactly where the issue lies. I can list what is currently installed in the image:

pillow 6.1.0 tensorflow 1.14.0 scikit-image 0.15.0 imageio 2.5.0