Python PIL.__version__() Examples

The following are 30 code examples of PIL.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PIL , or try the search function .
Example #1
Source File: starts.py    From AutoDL-Projects with MIT License 6 votes vote down vote up
def prepare_logger(xargs):
  args = copy.deepcopy( xargs )
  from log_utils import Logger
  logger = Logger(args.save_dir, args.rand_seed)
  logger.log('Main Function with logger : {:}'.format(logger))
  logger.log('Arguments : -------------------------------')
  for name, value in args._get_kwargs():
    logger.log('{:16} : {:}'.format(name, value))
  logger.log("Python  Version  : {:}".format(sys.version.replace('\n', ' ')))
  logger.log("Pillow  Version  : {:}".format(PIL.__version__))
  logger.log("PyTorch Version  : {:}".format(torch.__version__))
  logger.log("cuDNN   Version  : {:}".format(torch.backends.cudnn.version()))
  logger.log("CUDA available   : {:}".format(torch.cuda.is_available()))
  logger.log("CUDA GPU numbers : {:}".format(torch.cuda.device_count()))
  logger.log("CUDA_VISIBLE_DEVICES : {:}".format(os.environ['CUDA_VISIBLE_DEVICES'] if 'CUDA_VISIBLE_DEVICES' in os.environ else 'None'))
  return logger 
Example #2
Source File: window.py    From ImEditor with GNU General Public License v3.0 6 votes vote down vote up
def about(self, *args):
        dialog = Gtk.AboutDialog(transient_for=self)
        dialog.set_logo_icon_name('io.github.ImEditor')
        dialog.set_program_name('ImEditor')
        dialog.set_version('0.9.4')
        dialog.set_website('https://imeditor.github.io')
        dialog.set_authors(['Nathan Seva', 'Hugo Posnic'])
        gtk_version = '{}.{}.{}'.format(Gtk.get_major_version(),
            Gtk.get_minor_version(), Gtk.get_micro_version())
        comment = '{}\n\n'.format(_("Simple & versatile image editor"))
        comment += 'Gtk: {} Pillow: {}'.format(gtk_version, pil_version)
        dialog.set_comments(comment)
        text = _("Distributed under the GNU GPL(v3) license.\n")
        text += 'https://github.com/ImEditor/ImEditor/blob/master/LICENSE\n'
        dialog.set_license(text)
        dialog.run()
        dialog.destroy() 
Example #3
Source File: version_info.py    From nml with GNU General Public License v2.0 6 votes vote down vote up
def get_nml_version():
    # First check if this is a git repository, and use that version if available.
    # (unless this is a released tarball, see below)
    try:
        from nml import version_update
        version = version_update.get_git_version()
        if version:
            return version
    except ImportError:
        # version_update is excluded from release tarballs,
        #  so that the predetermined version is always used.
        pass

    # No repository was found. Return the version which was saved upon build.
    try:
        from nml import __version__
        version = __version__.version
    except ImportError:
        version = 'unknown'
    return version 
Example #4
Source File: version_info.py    From nml with GNU General Public License v2.0 6 votes vote down vote up
def get_lib_versions():
    versions = {}
    #PIL
    try:
        import PIL
        versions["PIL"] = PIL.__version__
    except ImportError:
        versions["PIL"] = "Not found!"

    #PLY
    try:
        from ply import lex
        versions["PLY"] = lex.__version__
    except ImportError:
        versions["PLY"] = "Not found!"

    return versions 
Example #5
Source File: inference.py    From sagemaker-tensorflow-serving-container with Apache License 2.0 6 votes vote down vote up
def handler(data, context):
    """Handle request.

    Args:
        data (obj): the request data
        context (Context): an object containing request and configuration details

    Returns:
        (bytes, string): data to return to client, (optional) response content type
    """

    # use the imported library
    print('pillow: {}\n{}'.format(PIL.__version__, dir(_imaging)))
    processed_input = _process_input(data, context)
    response = requests.post(context.rest_uri, data=processed_input)
    return _process_output(response, context) 
Example #6
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def check6_bsddb3(self):
        '''bsddb3 - Python Bindings for Oracle Berkeley DB

        requires Berkeley DB

        PY_BSDDB3_VER_MIN = (6, 0, 1) # 6.x series at least
        '''
        self.append_text("\n")
        # Start check

        try:
            import bsddb3 as bsddb
            bsddb_str = bsddb.__version__  # Python adaptation layer
            # Underlying DB library
            bsddb_db_str = str(bsddb.db.version()).replace(', ', '.')\
                .replace('(', '').replace(')', '')
        except ImportError:
            bsddb_str = 'not found'
            bsddb_db_str = 'not found'

        result = ("* Berkeley Database library (bsddb3: " + bsddb_db_str +
                  ") (Python-bsddb3 : " + bsddb_str + ")")
        # End check
        self.append_text(result) 
Example #7
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def check_fontconfig(self):
        ''' The python-fontconfig library is used to support the Genealogical
        Symbols tab of the Preferences.  Without it Genealogical Symbols don't
        work '''
        try:
            import fontconfig
            vers = fontconfig.__version__
            if vers.startswith("0.5."):
                result = ("* python-fontconfig " + vers +
                          " (Success version 0.5.x is installed.)")
            else:
                result = ("* python-fontconfig " + vers +
                          " (Requires version 0.5.x)")
        except ImportError:
            result = "* python-fontconfig Not found, (Requires version 0.5.x)"
        # End check
        self.append_text(result)

    #Optional 
Example #8
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def check23_pedigreechart(self):
        '''PedigreeChart - Can optionally use - NumPy if installed

        https://github.com/gramps-project/addons-source/blob/master/PedigreeChart/PedigreeChart.py
        '''
        self.append_text("\n")
        self.render_text("""<b>03. <a href="https://gramps-project.org/wiki"""
                         """/index.php?title=PedigreeChart">"""
                         """Addon:PedigreeChart</a> :</b> """)
        # Start check

        try:
            import numpy
            numpy_ver = str(numpy.__version__)
            #print("numpy.__version__ :" + numpy_ver )
            # NUMPY_check = True
        except ImportError:
            numpy_ver = "Not found"
            # NUMPY_check = False

        result = "(NumPy : " + numpy_ver + " )"
        # End check
        self.append_text(result)
        #self.append_text("\n") 
Example #9
Source File: transforms.py    From landmark-detection with MIT License 6 votes vote down vote up
def __call__(self, imgs, point_meta):
    """
    Args:
      img (PIL.Image): Image to be cropped.
      point_meta : Point_Meta
    Returns:
      PIL.Image: Rotated image.
    """
    point_meta = point_meta.copy()
    if isinstance(imgs, list): is_list = True
    else:                      is_list, imgs = False, [imgs]

    degree = (random.random() - 0.5) * 2 * self.max_rotate_degree
    center = (imgs[0].size[0] / 2, imgs[0].size[1] / 2)
    if PIL.__version__[0] == '4':
      imgs = [ img.rotate(degree, center=center) for img in imgs ]
    else:
      imgs = [ img.rotate(degree) for img in imgs ]

    point_meta.apply_rotate(center, degree)
    point_meta.apply_bound(imgs[0].size[0], imgs[0].size[1])

    if is_list == False: imgs = imgs[0]

    return imgs, point_meta 
Example #10
Source File: transforms.py    From landmark-detection with MIT License 6 votes vote down vote up
def __call__(self, imgs, point_meta):
    """
    Args:
      img (PIL.Image): Image to be cropped.
      point_meta : Point_Meta
    Returns:
      PIL.Image: Rotated image.
    """
    point_meta = point_meta.copy()
    if isinstance(imgs, list): is_list = True
    else:                      is_list, imgs = False, [imgs]

    degree = (random.random() - 0.5) * 2 * self.max_rotate_degree
    center = (imgs[0].size[0] / 2, imgs[0].size[1] / 2)
    if PIL.__version__[0] == '4':
      imgs = [ img.rotate(degree, center=center) for img in imgs ]
    else:
      imgs = [ img.rotate(degree) for img in imgs ]

    point_meta.apply_rotate(center, degree)
    point_meta.apply_bound(imgs[0].size[0], imgs[0].size[1])

    if is_list == False: imgs = imgs[0]

    return imgs, point_meta 
Example #11
Source File: test_pyroma.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def test_pyroma(self):
        # Arrange
        data = pyroma.projectdata.get_data(".")

        # Act
        rating = pyroma.ratings.rate(data)

        # Assert
        if "rc" in __version__:
            # Pyroma needs to chill about RC versions and not kill all our tests.
            self.assertEqual(
                rating,
                (9, ["The package's version number does not comply with PEP-386."]),
            )

        else:
            # Should have a near-perfect score
            self.assertEqual(rating, (9, ["Your package does not have license data."])) 
Example #12
Source File: collect_env.py    From training with Apache License 2.0 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #13
Source File: starts.py    From AutoDL-Projects with MIT License 5 votes vote down vote up
def get_machine_info():
  info = "Python  Version  : {:}".format(sys.version.replace('\n', ' '))
  info+= "\nPillow  Version  : {:}".format(PIL.__version__)
  info+= "\nPyTorch Version  : {:}".format(torch.__version__)
  info+= "\ncuDNN   Version  : {:}".format(torch.backends.cudnn.version())
  info+= "\nCUDA available   : {:}".format(torch.cuda.is_available())
  info+= "\nCUDA GPU numbers : {:}".format(torch.cuda.device_count())
  if 'CUDA_VISIBLE_DEVICES' in os.environ:
    info+= "\nCUDA_VISIBLE_DEVICES={:}".format(os.environ['CUDA_VISIBLE_DEVICES'])
  else:
    info+= "\nDoes not set CUDA_VISIBLE_DEVICES"
  return info 
Example #14
Source File: collect_env.py    From FreeAnchor with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #15
Source File: osutils.py    From Relation-Aware-Global-Attention-Networks with MIT License 5 votes vote down vote up
def collect_env_info():
    """Returns env info as a string.
    Code source: github.com/facebookresearch/maskrcnn-benchmark
    """
    from torch.utils.collect_env import get_pretty_env_info
    env_str = get_pretty_env_info()
    env_str += '\n        Pillow ({})'.format(PIL.__version__)
    return env_str 
Example #16
Source File: collect_env.py    From retinamask with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #17
Source File: image_pyfunc.py    From models with Apache License 2.0 5 votes vote down vote up
def log_model(keras_model, artifact_path, image_dims, domain):
    """
    Log a KerasImageClassifierPyfunc model as an MLflow artifact for the current run.

    :param keras_model: Keras model to be saved.
    :param artifact_path: Run-relative artifact path this model is to be saved to.
    :param image_dims: Image dimensions the Keras model expects.
    :param domain: Labels for the classes this model can predict.
    """

    with TempDir() as tmp:
        data_path = tmp.path("image_model")
        os.mkdir(data_path)
        conf = {
            "image_dims": "/".join(map(str, image_dims)),
            "domain": "/".join(map(str, domain))
        }
        with open(os.path.join(data_path, "conf.yaml"), "w") as f:
            yaml.safe_dump(conf, stream=f)
        keras_path = os.path.join(data_path, "keras_model")
        mlflow.keras.save_model(keras_model, path=keras_path)
        conda_env = tmp.path("conda_env.yaml")
        with open(conda_env, "w") as f:
            f.write(conda_env_template.format(python_version=PYTHON_VERSION,
                                              keras_version=keras.__version__,
                                              tf_name=tf.__name__,  # can have optional -gpu suffix
                                              tf_version=tf.__version__,
                                              pillow_version=PIL.__version__))

        mlflow.pyfunc.log_model(artifact_path=artifact_path,
                                loader_module=__name__,
                                code_path=[__file__],
                                data_path=data_path,
                                conda_env=conda_env) 
Example #18
Source File: image_pyfunc.py    From models with Apache License 2.0 5 votes vote down vote up
def log_model(keras_model, artifact_path, image_dims, domain):
    """
    Log a KerasImageClassifierPyfunc model as an MLflow artifact for the current run.

    :param keras_model: Keras model to be saved.
    :param artifact_path: Run-relative artifact path this model is to be saved to.
    :param image_dims: Image dimensions the Keras model expects.
    :param domain: Labels for the classes this model can predict.
    """

    with TempDir() as tmp:
        data_path = tmp.path("image_model")
        os.mkdir(data_path)
        conf = {
            "image_dims": "/".join(map(str, image_dims)),
            "domain": "/".join(map(str, domain))
        }
        with open(os.path.join(data_path, "conf.yaml"), "w") as f:
            yaml.safe_dump(conf, stream=f)
        keras_path = os.path.join(data_path, "keras_model")
        mlflow.keras.save_model(keras_model, path=keras_path)
        conda_env = tmp.path("conda_env.yaml")
        with open(conda_env, "w") as f:
            f.write(conda_env_template.format(python_version=PYTHON_VERSION,
                                              keras_version=keras.__version__,
                                              tf_name=tf.__name__,  # can have optional -gpu suffix
                                              tf_version=tf.__version__,
                                              pillow_version=PIL.__version__))

        mlflow.pyfunc.log_model(artifact_path=artifact_path,
                                loader_module=__name__,
                                code_path=[__file__],
                                data_path=data_path,
                                conda_env=conda_env) 
Example #19
Source File: collect_env.py    From Det3D with Apache License 2.0 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #20
Source File: image_pyfunc.py    From mlflow with Apache License 2.0 5 votes vote down vote up
def log_model(keras_model, artifact_path, image_dims, domain):
    """
    Log a KerasImageClassifierPyfunc model as an MLflow artifact for the current run.

    :param keras_model: Keras model to be saved.
    :param artifact_path: Run-relative artifact path this model is to be saved to.
    :param image_dims: Image dimensions the Keras model expects.
    :param domain: Labels for the classes this model can predict.
    """

    with TempDir() as tmp:
        data_path = tmp.path("image_model")
        os.mkdir(data_path)
        conf = {
            "image_dims": "/".join(map(str, image_dims)),
            "domain": "/".join(map(str, domain))
        }
        with open(os.path.join(data_path, "conf.yaml"), "w") as f:
            yaml.safe_dump(conf, stream=f)
        keras_path = os.path.join(data_path, "keras_model")
        mlflow.keras.save_model(keras_model, path=keras_path)
        conda_env = tmp.path("conda_env.yaml")
        with open(conda_env, "w") as f:
            f.write(conda_env_template.format(python_version=PYTHON_VERSION,
                                              keras_version=keras.__version__,
                                              tf_name=tf.__name__,  # can have optional -gpu suffix
                                              tf_version=tf.__version__,
                                              pip_version=pip.__version__,
                                              pillow_version=PIL.__version__))

        mlflow.pyfunc.log_model(artifact_path=artifact_path,
                                loader_module=__name__,
                                code_path=[__file__],
                                data_path=data_path,
                                conda_env=conda_env) 
Example #21
Source File: collect_env.py    From NAS-FCOS with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #22
Source File: collect_env.py    From RRPN_pytorch with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #23
Source File: collect_env.py    From DF-Traffic-Sign-Identification with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #24
Source File: collect_env.py    From maskscoring_rcnn with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #25
Source File: collect_env.py    From TinyBenchmark with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #26
Source File: collect_env.py    From Res2Net-maskrcnn with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #27
Source File: collect_env.py    From EmbedMask with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #28
Source File: collect_env.py    From maskrcnn-benchmark with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__) 
Example #29
Source File: tools.py    From deep-person-reid with MIT License 5 votes vote down vote up
def collect_env_info():
    """Returns env info as a string.

    Code source: github.com/facebookresearch/maskrcnn-benchmark
    """
    from torch.utils.collect_env import get_pretty_env_info
    env_str = get_pretty_env_info()
    env_str += '\n        Pillow ({})'.format(PIL.__version__)
    return env_str 
Example #30
Source File: collect_env.py    From HRNet-MaskRCNN-Benchmark with MIT License 5 votes vote down vote up
def get_pil_version():
    return "\n        Pillow ({})".format(PIL.__version__)