Commit fb4dd633 authored by Yuxin Wu's avatar Yuxin Wu

make matplotlib optional in tensorpack/

parent 5ab89843
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# File: develop.py # File: develop.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com> # Author: tensorpack contributors
""" Utilities for developers only. """ Utilities for developers only.
......
...@@ -11,11 +11,6 @@ import cv2 ...@@ -11,11 +11,6 @@ import cv2
from .fs import mkdir_p from .fs import mkdir_p
from .argtools import shape2d from .argtools import shape2d
try:
import matplotlib.pyplot as plt
except ImportError:
pass
__all__ = ['pyplot2img', 'interactive_imshow', __all__ = ['pyplot2img', 'interactive_imshow',
'stack_patches', 'gen_stack_patches', 'stack_patches', 'gen_stack_patches',
...@@ -351,6 +346,12 @@ def intensity_to_rgb(intensity, cmap='cubehelix', normalize=False): ...@@ -351,6 +346,12 @@ def intensity_to_rgb(intensity, cmap='cubehelix', normalize=False):
intensity = cmap(intensity)[..., :3] intensity = cmap(intensity)[..., :3]
return intensity.astype('float32') * 255.0 return intensity.astype('float32') * 255.0
from ..utils.develop import create_dummy_func # noqa
try:
import matplotlib.pyplot as plt
except ImportError:
pyplot2img = create_dummy_func('pyplot2img') # noqa
intensity_to_rgb = create_dummy_func('intensity_to_rgb') # noqa
if __name__ == '__main__': if __name__ == '__main__':
if False: if False:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment