class_docstr: The ``Logger`` class is the ClearML console log and metric statistics interface, and contains methods for explicit
  reporting.
  
  Explicit reporting extends ClearML automagical capturing of inputs and output. Explicit reporting
  methods include scalar plots, line plots, histograms, confusion matrices, 2D and 3D scatter
  diagrams, text logging, tables, and image uploading and reporting.
  
  In the **ClearML Web-App (UI)**, ``Logger`` output appears in the **RESULTS** tab, **CONSOLE**, **SCALARS**,
  **PLOTS**, and **DEBUG SAMPLES** sub-tabs. When you compare experiments, ``Logger`` output appears in the
  comparisons.
  
  .. warning::
  
     Do not construct Logger objects directly.
  
  You must get a Logger object before calling any of the other ``Logger`` class methods by calling
  :meth:`.Task.get_logger` or :meth:`Logger.current_logger`.
class_docstr_tok: ["The","``","Logger","``","class","is","the","ClearML","console","log","and","metric","statistics","interface",",","and","contains","methods","for","explicit","reporting",".","Explicit","reporting","extends","ClearML","automagical","capturing","of","inputs","and","output",".","Explicit","reporting","methods","include","scalar","plots",",","line","plots",",","histograms",",","confusion","matrices",",","2D","and","3D","scatter","diagrams",",","text","logging",",","tables",",","and","image","uploading","and","reporting",".","In","the","*","*","ClearML","Web-App","(","UI",")","*","*",",","``","Logger","``","output","appears","in","the","*","*","RESULTS","*","*","tab",",","*","*","CONSOLE","*","*",",","*","*","SCALARS","*","*",",","*","*","PLOTS","*","*",",","and","*","*","DEBUG","SAMPLES","*","*","sub-tabs",".","When","you","compare","experiments",",","``","Logger","``","output","appears","in","the","comparisons",".","..","warning",":",":","Do","not","construct","Logger","objects","directly",".","You","must","get","a","Logger","object","before","calling","any","of","the","other","``","Logger","``","class","methods","by","calling",":","meth",":","`",".Task.get_logger","`","or",":","meth",":","`","Logger.current_logger","`","."]
docstr: For explicit reporting, report an image and upload its contents.
  
  This method uploads the image to a preconfigured bucket (see :meth:`Logger.set_default_upload_destination`)
  describing the task ID, title, series and iteration.
  
  For example:
  
  .. code-block:: py
  
     matrix = np.eye(256, 256, dtype=np.uint8)*255
     matrix = np.concatenate((np.atleast_3d(matrix), np.zeros((256, 256, 2), dtype=np.uint8)), axis=2)
     logger.report_image("test case", "image color red", iteration=1, image=m)
  
     image_open = Image.open(os.path.join("<image_path>", "<image_filename>"))
     logger.report_image("test case", "image PIL", iteration=1, image=image_open)
  
  One and only one of the following parameters must be provided.
  
  - ``local_path``
  - ``url``
  - ``image``
  - ``matrix``
  
  :param title: The title (metric) of the image.
  :param series: The series name (variant) of the reported image.
  :param iteration: The reported iteration / step.
  :param local_path: A path to an image file.
  :param url: A URL for the location of a pre-uploaded image.
  :param image: Image data (RGB).
  :param matrix: Deprecated, Image data (RGB).
  
      .. note::
         The ``matrix`` parameter is deprecated. Use the ``image`` parameters.
  :param max_image_history: The maximum number of images to store per metric/variant combination.
      For an unlimited number, use a negative value. The default value is set in global configuration
      (default=``5``).
  :param delete_after_upload: After the upload, delete the local copy of the image. The values are:
  
    - ``True`` - Delete after upload.
    - ``False`` - Do not delete after upload. (default)
docstr_tok: ["For","explicit","reporting",",","report","an","image","and","upload","its","contents",".","This","method","uploads","the","image","to","a","preconfigured","bucket","(","see",":","meth",":","`","Logger.set_default_upload_destination","`",")","describing","the","task","ID",",","title",",","series","and","iteration",".","For","example",":","..","code-block",":",":","py","matrix","=","np.eye","(","256",",","256",",","dtype=np.uint8",")","*","255","matrix","=","np.concatenate","(","(","np.atleast_3d","(","matrix",")",",","np.zeros","(","(","256",",","256",",","2",")",",","dtype=np.uint8",")",")",",","axis=2",")","logger.report_image","(","``","test","case","''",",","``","image","color","red","''",",","iteration=1",",","image=m",")","image_open","=","Image.open","(","os.path.join","(","``","<","image_path",">","''",",","``","<","image_filename",">","''",")",")","logger.report_image","(","``","test","case","''",",","``","image","PIL","''",",","iteration=1",",","image=image_open",")","One","and","only","one","of","the","following","parameters","must","be","provided",".","-","``","local_path","``","-","``","url","``","-","``","image","``","-","``","matrix","``",":","param","title",":","The","title","(","metric",")","of","the","image",".",":","param","series",":","The","series","name","(","variant",")","of","the","reported","image",".",":","param","iteration",":","The","reported","iteration","\/","step",".",":","param","local_path",":","A","path","to","an","image","file",".",":","param","url",":","A","URL","for","the","location","of","a","pre-uploaded","image",".",":","param","image",":","Image","data","(","RGB",")",".",":","param","matrix",":","Deprecated",",","Image","data","(","RGB",")",".","..","note",":",":","The","``","matrix","``","parameter","is","deprecated",".","Use","the","``","image","``","parameters",".",":","param","max_image_history",":","The","maximum","number","of","images","to","store","per","metric\/variant","combination",".","For","an","unlimited","number",",","use","a","negative","value",".","The","default","value","is","set","in","global","configuration","(","default=","``","5","``",")",".",":","param","delete_after_upload",":","After","the","upload",",","delete","the","local","copy","of","the","image",".","The","values","are",":","-","``","True","``","-","Delete","after","upload",".","-","``","False","``","-","Do","not","delete","after","upload",".","(","default",")"]
code: def report_image(
      self,
      title,  # type: str
      series,  # type: str
      iteration=None,  # type: Optional[int]
      local_path=None,  # type: Optional[str]
      image=None,  # type: Optional[Union[np.ndarray, Image.Image]]
      matrix=None,  # type: Optional[np.ndarray]
      max_image_history=None,  # type: Optional[int]
      delete_after_upload=False,  # type: bool
      url=None,  # type: Optional[str]
  ):
      """
      For explicit reporting, report an image and upload its contents.
  
      This method uploads the image to a preconfigured bucket (see :meth:`Logger.set_default_upload_destination`)
      describing the task ID, title, series and iteration.
  
      For example:
  
      .. code-block:: py
  
         matrix = np.eye(256, 256, dtype=np.uint8)*255
         matrix = np.concatenate((np.atleast_3d(matrix), np.zeros((256, 256, 2), dtype=np.uint8)), axis=2)
         logger.report_image("test case", "image color red", iteration=1, image=m)
  
         image_open = Image.open(os.path.join("<image_path>", "<image_filename>"))
         logger.report_image("test case", "image PIL", iteration=1, image=image_open)
  
      One and only one of the following parameters must be provided.
  
      - ``local_path``
      - ``url``
      - ``image``
      - ``matrix``
  
      :param title: The title (metric) of the image.
      :param series: The series name (variant) of the reported image.
      :param iteration: The reported iteration / step.
      :param local_path: A path to an image file.
      :param url: A URL for the location of a pre-uploaded image.
      :param image: Image data (RGB).
      :param matrix: Deprecated, Image data (RGB).
  
          .. note::
             The ``matrix`` parameter is deprecated. Use the ``image`` parameters.
      :param max_image_history: The maximum number of images to store per metric/variant combination.
          For an unlimited number, use a negative value. The default value is set in global configuration
          (default=``5``).
      :param delete_after_upload: After the upload, delete the local copy of the image. The values are:
  
        - ``True`` - Delete after upload.
        - ``False`` - Do not delete after upload. (default)
      """
      mutually_exclusive(
          UsageError,
          _check_none=True,
          local_path=local_path or None,
          url=url or None,
          image=image,
          matrix=matrix,
      )
      if matrix is not None:
          warnings.warn(
              "'matrix' variable is deprecated; use 'image' instead.",
              DeprecationWarning,
          )
      if image is None:
          image = matrix
      if image is not None and not isinstance(
          image, (np.ndarray, Image.Image)
      ):
          raise ValueError(
              "Supported 'image' types are: numpy.ndarray or PIL.Image"
          )
  
      # if task was not started, we have to start it
      self._start_task_if_needed()
  
      self._touch_title_series(title, series)
  
      if url:
          # noinspection PyProtectedMember
          self._task._reporter.report_image(
              title=title,
              series=series,
              src=url,
              iter=iteration or 0,
          )
  
      else:
          upload_uri = self.get_default_upload_destination()
          if not upload_uri:
              upload_uri = Path(get_cache_dir()) / "debug_images"
              upload_uri.mkdir(parents=True, exist_ok=True)
              # Verify that we can upload to this destination
              upload_uri = str(upload_uri)
              storage = StorageHelper.get(upload_uri)
              upload_uri = storage.verify_upload(folder_uri=upload_uri)
  
          if isinstance(image, Image.Image):
              image = np.array(image)  # noqa
          # noinspection PyProtectedMember
          self._task._reporter.report_image_and_upload(
              title=title,
              series=series,
              path=local_path,
              image=image,
              iter=iteration or 0,
              upload_uri=upload_uri,
              max_image_history=max_image_history
              if max_image_history is not None
              else self._default_max_sample_history,
              delete_after_upload=delete_after_upload,
          )
  
imports: import logging
  import math
  import warnings
  from typing import Any, Sequence, Union, List, Optional, Tuple, Dict, TYPE_CHECKING
  import numpy
  import six
  from PIL import Image
  from pathlib2 import Path
  from .debugging.log import LoggerRoot
  from .backend_interface.logger import StdStreamPatch
  from .backend_interface.task import Task
  from .backend_interface.task.log import TaskHandler
  from .backend_interface.util import mutually_exclusive
  from .backend_interface.metrics.events import UploadEvent, MetricsEventAdapter
  from .config import running_remotely, get_cache_dir, config, DEBUG_SIMULATE_REMOTE_TASK, deferred_config
  from .errors import UsageError
  from .storage.helper import StorageHelper
  from .utilities.plotly_reporter import SeriesInfo
label_desc: Use image node_id 15 for calling the Logger obj's underlying member method code with example usage: obj.report_image(title, series, iteration, local_path, image, matrix, max_image_history, delete_after_upload, url) without return types