class_docstr: Implement the JPEG compression defence approach.
  
  For input images or videos with 3 color channels the compression is applied in mode `RGB`
  (3x8-bit pixels, true color), for all other numbers of channels the compression is applied for each channel with
  mode `L` (8-bit pixels, black and white).
  
  | Paper link: https://arxiv.org/abs/1705.02900, https://arxiv.org/abs/1608.00853
  
  
  | Please keep in mind the limitations of defences. For more information on the limitations of this defence,
      see https://arxiv.org/abs/1802.00420 . For details on how to evaluate classifier security in general, see
      https://arxiv.org/abs/1902.06705
docstr: Create an instance of JPEG compression.
  
  :param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
         for features.
  :param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
  :param channels_first: Set channels first or last.
  :param apply_fit: True if applied during fitting/training.
  :param apply_predict: True if applied during predicting.
  :param verbose: Show progress bars.
docstr_tok: ["Create","an","instance","of","JPEG","compression",".",":","param","clip_values",":","Tuple","of","the","form","`","(","min",",","max",")","`","representing","the","minimum","and","maximum","values","allowed","for","features",".",":","param","quality",":","The","image","quality",",","on","a","scale","from","1","(","worst",")","to","95","(","best",")",".","Values","above","95","should","be","avoided",".",":","param","channels_first",":","Set","channels","first","or","last",".",":","param","apply_fit",":","True","if","applied","during","fitting\/training",".",":","param","apply_predict",":","True","if","applied","during","predicting",".",":","param","verbose",":","Show","progress","bars","."]
code: def __init__(
      self,
      clip_values: "CLIP_VALUES_TYPE",
      quality: int = 50,
      channels_first: bool = False,
      apply_fit: bool = True,
      apply_predict: bool = True,
      verbose: bool = False,
  ):
      """
      Create an instance of JPEG compression.
  
      :param clip_values: Tuple of the form `(min, max)` representing the minimum and maximum values allowed
             for features.
      :param quality: The image quality, on a scale from 1 (worst) to 95 (best). Values above 95 should be avoided.
      :param channels_first: Set channels first or last.
      :param apply_fit: True if applied during fitting/training.
      :param apply_predict: True if applied during predicting.
      :param verbose: Show progress bars.
      """
  
      super().__init__(
          is_fitted=True,
          apply_fit=apply_fit,
          apply_predict=apply_predict,
      )
      self.quality = quality
      self.channels_first = channels_first
      self.clip_values = clip_values
      self.verbose = verbose
      self._check_params()
  
file_path: adversarial-robustness-toolbox/art/defences/preprocessor/jpeg_compression.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from io import BytesIO
  import logging
  from typing import Optional, Tuple, TYPE_CHECKING
  import numpy
  from tqdm.auto import tqdm
  from art.config import ART_NUMPY_DTYPE
  from art.defences.preprocessor.preprocessor import Preprocessor
label_desc: Use image node_id 1 to create a new JpegCompression object from inherited base classes: Preprocessor with example: obj = JpegCompression(clip_values, quality, channels_first, apply_fit, apply_predict, verbose)