class_docstr: Base Data type class
class_docstr_tok: ["Base","Data","type","class"]
docstr: Input data from Image
  
  Args:
      images: the path to the directory with image data in ``np.ndarray`` format
          or array in ``np.ndarray`` format
      labels: the path to the directory with image labels in ``np.ndarray`` format
          or array in ``np.ndarray`` format
      task: the :obj:`Task` that should be solved with data
      target_size: size for the images resizing (if necessary)
  
  Returns:
      An instance of :class:`InputData`.
code: def from_image(
      images: Union[str, np.ndarray] = None,
      labels: Union[str, np.ndarray] = None,
      task: Task = Task(TaskTypesEnum.classification),
      target_size: Optional[Tuple[int, int]] = None,
  ) -> InputData:
      """Input data from Image
  
      Args:
          images: the path to the directory with image data in ``np.ndarray`` format
              or array in ``np.ndarray`` format
          labels: the path to the directory with image labels in ``np.ndarray`` format
              or array in ``np.ndarray`` format
          task: the :obj:`Task` that should be solved with data
          target_size: size for the images resizing (if necessary)
  
      Returns:
          An instance of :class:`InputData`.
      """
  
      features = images
      target = labels
  
      if isinstance(images, str):
          # if upload from path
          if "*.jpeg" in images:
              # upload from folder of images
              path = images
              images_list = []
              for file_path in glob.glob(path):
                  if target_size is not None:
                      img = _resize_image(file_path, target_size)
                      images_list.append(img)
                  else:
                      raise ValueError("Set target_size for images")
              features = np.asarray(images_list)
              target = labels
          else:
              # upload from array
              features = np.load(images)
              target = np.load(labels)
              # add channels if None
              if len(features.shape) == 3:
                  features = np.expand_dims(features, -1)
  
      idx = np.arange(0, len(features))
  
      return InputData(
          idx=idx,
          features=features,
          target=target,
          task=task,
          data_type=DataTypesEnum.image,
      )
  
imports: from __future__ import annotations
  import glob
  import os
  from copy import copy, deepcopy
  from dataclasses import dataclass, field
  from typing import Any, Iterable, List, Optional, Tuple, Union
  import numpy
  import pandas
  from golem.core.log import default_log
  from golem.utilities.requirements_notificator import warn_requirement
  from fedot.core.data.array_utilities import atleast_2d
  from fedot.core.data.load_data import JSONBatchLoader, TextBatchLoader
  from fedot.core.data.supplementary_data import SupplementaryData
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum
label_desc: Use image node_id 7 for calling the Data obj's underlying member method code with example usage: obj.from_image(images, labels, task, target_size) and returns: InputData