prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [FEAT][CV] Add a "per-class" option to property drift & heatmap comparison
  In this per class option, the drift would be shown per class for the top drifted classes. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 """
  3 Image Property Drift Check
  4 **************************
  5 This notebooks provides an overview for using and understanding the image property drift check.
  6 
  7 **Structure:**
  8 
  9 * `How Does the ImagePropertyDrift Check Work? <#how-does-the-imagepropertydrift-check-work>`__
  10 * `Which Image Properties Are Used? <#which-image-properties-are-used>`__
  11 * `Prepare data <#prepare-data>`__
  12 * `Run the check <#run-the-check>`__
  13 * `Define a condition <#define-a-condition>`__
  14 * `Check Parameters <#check-parameters>`__
  15 
  16 How Does the ImagePropertyDrift Check Work?
  17 =================================
  18 Data drift is simply a change in the distribution of data over time. It is also one
  19 of the top reasons that a machine learning model performance degrades over time.
  20 
  21 In the context of machine learning, drift between the training set and the test set
  22 will likely make the model prone to errors. In other words, if the model was trained
  23 on data that is different from the current test data, it will probably make more mistakes
  24 predicting the target variable.
  25 
  26 The Image Property Drift check calculates a drift score for each image property in
  27 the test dataset, by comparing its distribution to the train dataset. For this, we
  28 use the Earth Movers Distance (Wasserstein distance).
  29 
  30 Which Image Properties Are Used?
  31 =================================
  32 ==============================  ==========
  33 Property name                   What is it
  34 ==============================  ==========
  35 Aspect Ratio                    Ratio between height and width of image (height / width)
  36 Area                            Area of image in pixels (height * width)
  37 Brightness                      Average intensity of image pixels. Color channels have different weights according to
  38                                 RGB-to-Grayscale formula
  39 RMS Contrast                    Contrast of image, calculated by standard deviation of pixels
  40 Mean Red Relative Intensity     Mean over all pixels of the red channel, scaled to their relative intensity in
  41                                 comparison to the other channels [r / (r + g + b)].
  42 Mean Green Relative Intensity   Mean over all pixels of the green channel, scaled to their relative intensity in
  43                                 comparison to the other channels [g / (r + g + b)].
  44 Mean Blue Relative Intensity    Mean over all pixels of the blue channel, scaled to their relative intensity in
  45                                 comparison to the other channels [b / (r + g + b)].
  46 ==============================  ==========
  47 
  48 Imports
  49 -------
  50 """
  51 
  52 #%%
  53 
  54 from deepchecks.vision.datasets.detection import coco
  55 from deepchecks.vision.checks.distribution import ImagePropertyDrift
  56 
  57 #%%
  58 # Prepare data
  59 # ------------
  60 from deepchecks.vision.utils import image_properties
  61 
  62 train_dataset = coco.load_dataset(train=True, object_type='VisionData')
  63 test_dataset = coco.load_dataset(train=False, object_type='VisionData')
  64 
  65 #%%
  66 # Run the check 
  67 # -------------
  68 
  69 check_result = ImagePropertyDrift().run(train_dataset, test_dataset)
  70 check_result
  71 
  72 #%%
  73 # Observe the check’s output 
  74 # --------------------------
  75 # The result value is a pandas DataFrame that contains drift score for each image property.
  76 
  77 check_result.value
  78 
  79 #%%
  80 # Define a condition
  81 # ==================
  82 # We can define a condition that make sure that image properties drift scores do not
  83 # exceed allowed threshold.
  84 
  85 check_result = (
  86     ImagePropertyDrift()
  87     .add_condition_drift_score_not_greater_than(0.001)
  88     .run(train_dataset, test_dataset)
  89 )
  90 check_result.show(show_additional_outputs=False)
  91 
  92 #%%
  93 # Check Parameters
  94 # ----------------
  95 # Image Property Drift Check accepts two parameters that allows us to control the look of the output:
  96 #
  97 # * `image_properties` - list of image properties that we are interested in
  98 # * `max_num_categories` - Maximal number of categories to use for the calculation of drift using PSI (Population Stability Index)
  99 #
  100 # Only next string values are allowed for the `image_properties` parameter:
  101 #
  102 # * `aspect_ratio`
  103 # * `area`
  104 # * `brightness`
  105 # * `mean_red_relative_intensity`
  106 # * `mean_green_relative_intensity`
  107 # * `mean_blue_relative_intensity`
  108 
  109 from typing import List
  110 import numpy as np
  111 
  112 
  113 def area(images: List[np.ndarray]) -> List[int]:
  114     # Return list of integers of image areas (height multiplied by width)
  115     return [img.shape[0] * img.shape[1] for img in images]
  116 
  117 
  118 def aspect_ratio(images: List[np.ndarray]) -> List[float]:
  119     # Return list of floats of image height to width ratio
  120     return [img.shape[0] / img.shape[1] for img in images]
  121 
  122 
  123 properties = [
  124     {'name': 'Area', 'method': area, 'output_type': 'continuous'},
  125     {'name': 'Aspect Ratio', 'method': aspect_ratio, 'output_type': 'continuous'}
  126 ]
  127 
  128 check_result = ImagePropertyDrift(
  129     alternative_image_properties=properties,
  130     max_num_categories=20
  131 ).run(train_dataset, test_dataset)
  132 
  133 check_result
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py b/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py
  --- a/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py
  +++ b/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py
  @@ -76,6 +76,17 @@
   
   check_result.value
   
  +#%%
  +# We can also pass the check a list of classes we wish to inspect, and the check will calculate the properties only
  +# for images either belonging to the classes or containing annotations belonging to the classes. (We'll lower the
  +# min_samples to 5 to tell the check to calculate drift despite having only a few images left after the class
  +# filtration)
  +
  +check_result = ImagePropertyDrift(classes_to_display=['person', 'cat', 'cell phone', 'car'], min_samples=5
  +                                  ).run(train_dataset, test_dataset)
  +check_result
  +
  +
   #%%
   # Define a condition
   # ==================
  
verification_info: {"golden_diff": "diff --git a/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py b/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py\n--- a/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py\n+++ b/docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py\n@@ -76,6 +76,17 @@\n \n check_result.value\n \n+#%%\n+# We can also pass the check a list of classes we wish to inspect, and the check will calculate the properties only\n+# for images either belonging to the classes or containing annotations belonging to the classes. (We'll lower the\n+# min_samples to 5 to tell the check to calculate drift despite having only a few images left after the class\n+# filtration)\n+\n+check_result = ImagePropertyDrift(classes_to_display=['person', 'cat', 'cell phone', 'car'], min_samples=5\n+                                  ).run(train_dataset, test_dataset)\n+check_result\n+\n+\n #%%\n # Define a condition\n # ==================\n", "issue": "[FEAT][CV] Add a \"per-class\" option to property drift & heatmap comparison\nIn this per class option, the drift would be shown per class for the top drifted classes. \n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nImage Property Drift Check\n**************************\nThis notebooks provides an overview for using and understanding the image property drift check.\n\n**Structure:**\n\n* `How Does the ImagePropertyDrift Check Work? <#how-does-the-imagepropertydrift-check-work>`__\n* `Which Image Properties Are Used? <#which-image-properties-are-used>`__\n* `Prepare data <#prepare-data>`__\n* `Run the check <#run-the-check>`__\n* `Define a condition <#define-a-condition>`__\n* `Check Parameters <#check-parameters>`__\n\nHow Does the ImagePropertyDrift Check Work?\n=================================\nData drift is simply a change in the distribution of data over time. It is also one\nof the top reasons that a machine learning model performance degrades over time.\n\nIn the context of machine learning, drift between the training set and the test set\nwill likely make the model prone to errors. In other words, if the model was trained\non data that is different from the current test data, it will probably make more mistakes\npredicting the target variable.\n\nThe Image Property Drift check calculates a drift score for each image property in\nthe test dataset, by comparing its distribution to the train dataset. For this, we\nuse the Earth Movers Distance (Wasserstein distance).\n\nWhich Image Properties Are Used?\n=================================\n==============================  ==========\nProperty name                   What is it\n==============================  ==========\nAspect Ratio                    Ratio between height and width of image (height / width)\nArea                            Area of image in pixels (height * width)\nBrightness                      Average intensity of image pixels. Color channels have different weights according to\n                                RGB-to-Grayscale formula\nRMS Contrast                    Contrast of image, calculated by standard deviation of pixels\nMean Red Relative Intensity     Mean over all pixels of the red channel, scaled to their relative intensity in\n                                comparison to the other channels [r / (r + g + b)].\nMean Green Relative Intensity   Mean over all pixels of the green channel, scaled to their relative intensity in\n                                comparison to the other channels [g / (r + g + b)].\nMean Blue Relative Intensity    Mean over all pixels of the blue channel, scaled to their relative intensity in\n                                comparison to the other channels [b / (r + g + b)].\n==============================  ==========\n\nImports\n-------\n\"\"\"\n\n#%%\n\nfrom deepchecks.vision.datasets.detection import coco\nfrom deepchecks.vision.checks.distribution import ImagePropertyDrift\n\n#%%\n# Prepare data\n# ------------\nfrom deepchecks.vision.utils import image_properties\n\ntrain_dataset = coco.load_dataset(train=True, object_type='VisionData')\ntest_dataset = coco.load_dataset(train=False, object_type='VisionData')\n\n#%%\n# Run the check \n# -------------\n\ncheck_result = ImagePropertyDrift().run(train_dataset, test_dataset)\ncheck_result\n\n#%%\n# Observe the check\u2019s output \n# --------------------------\n# The result value is a pandas DataFrame that contains drift score for each image property.\n\ncheck_result.value\n\n#%%\n# Define a condition\n# ==================\n# We can define a condition that make sure that image properties drift scores do not\n# exceed allowed threshold.\n\ncheck_result = (\n    ImagePropertyDrift()\n    .add_condition_drift_score_not_greater_than(0.001)\n    .run(train_dataset, test_dataset)\n)\ncheck_result.show(show_additional_outputs=False)\n\n#%%\n# Check Parameters\n# ----------------\n# Image Property Drift Check accepts two parameters that allows us to control the look of the output:\n#\n# * `image_properties` - list of image properties that we are interested in\n# * `max_num_categories` - Maximal number of categories to use for the calculation of drift using PSI (Population Stability Index)\n#\n# Only next string values are allowed for the `image_properties` parameter:\n#\n# * `aspect_ratio`\n# * `area`\n# * `brightness`\n# * `mean_red_relative_intensity`\n# * `mean_green_relative_intensity`\n# * `mean_blue_relative_intensity`\n\nfrom typing import List\nimport numpy as np\n\n\ndef area(images: List[np.ndarray]) -> List[int]:\n    # Return list of integers of image areas (height multiplied by width)\n    return [img.shape[0] * img.shape[1] for img in images]\n\n\ndef aspect_ratio(images: List[np.ndarray]) -> List[float]:\n    # Return list of floats of image height to width ratio\n    return [img.shape[0] / img.shape[1] for img in images]\n\n\nproperties = [\n    {'name': 'Area', 'method': area, 'output_type': 'continuous'},\n    {'name': 'Aspect Ratio', 'method': aspect_ratio, 'output_type': 'continuous'}\n]\n\ncheck_result = ImagePropertyDrift(\n    alternative_image_properties=properties,\n    max_num_categories=20\n).run(train_dataset, test_dataset)\n\ncheck_result", "path": "docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nImage Property Drift Check\n**************************\nThis notebooks provides an overview for using and understanding the image property drift check.\n\n**Structure:**\n\n* `How Does the ImagePropertyDrift Check Work? <#how-does-the-imagepropertydrift-check-work>`__\n* `Which Image Properties Are Used? <#which-image-properties-are-used>`__\n* `Prepare data <#prepare-data>`__\n* `Run the check <#run-the-check>`__\n* `Define a condition <#define-a-condition>`__\n* `Check Parameters <#check-parameters>`__\n\nHow Does the ImagePropertyDrift Check Work?\n=================================\nData drift is simply a change in the distribution of data over time. It is also one\nof the top reasons that a machine learning model performance degrades over time.\n\nIn the context of machine learning, drift between the training set and the test set\nwill likely make the model prone to errors. In other words, if the model was trained\non data that is different from the current test data, it will probably make more mistakes\npredicting the target variable.\n\nThe Image Property Drift check calculates a drift score for each image property in\nthe test dataset, by comparing its distribution to the train dataset. For this, we\nuse the Earth Movers Distance (Wasserstein distance).\n\nWhich Image Properties Are Used?\n=================================\n==============================  ==========\nProperty name                   What is it\n==============================  ==========\nAspect Ratio                    Ratio between height and width of image (height / width)\nArea                            Area of image in pixels (height * width)\nBrightness                      Average intensity of image pixels. Color channels have different weights according to\n                                RGB-to-Grayscale formula\nRMS Contrast                    Contrast of image, calculated by standard deviation of pixels\nMean Red Relative Intensity     Mean over all pixels of the red channel, scaled to their relative intensity in\n                                comparison to the other channels [r / (r + g + b)].\nMean Green Relative Intensity   Mean over all pixels of the green channel, scaled to their relative intensity in\n                                comparison to the other channels [g / (r + g + b)].\nMean Blue Relative Intensity    Mean over all pixels of the blue channel, scaled to their relative intensity in\n                                comparison to the other channels [b / (r + g + b)].\n==============================  ==========\n\nImports\n-------\n\"\"\"\n\n#%%\n\nfrom deepchecks.vision.datasets.detection import coco\nfrom deepchecks.vision.checks.distribution import ImagePropertyDrift\n\n#%%\n# Prepare data\n# ------------\nfrom deepchecks.vision.utils import image_properties\n\ntrain_dataset = coco.load_dataset(train=True, object_type='VisionData')\ntest_dataset = coco.load_dataset(train=False, object_type='VisionData')\n\n#%%\n# Run the check \n# -------------\n\ncheck_result = ImagePropertyDrift().run(train_dataset, test_dataset)\ncheck_result\n\n#%%\n# Observe the check\u2019s output \n# --------------------------\n# The result value is a pandas DataFrame that contains drift score for each image property.\n\ncheck_result.value\n\n#%%\n# We can also pass the check a list of classes we wish to inspect, and the check will calculate the properties only\n# for images either belonging to the classes or containing annotations belonging to the classes. (We'll lower the\n# min_samples to 5 to tell the check to calculate drift despite having only a few images left after the class\n# filtration)\n\ncheck_result = ImagePropertyDrift(classes_to_display=['person', 'cat', 'cell phone', 'car'], min_samples=5\n                                  ).run(train_dataset, test_dataset)\ncheck_result\n\n\n#%%\n# Define a condition\n# ==================\n# We can define a condition that make sure that image properties drift scores do not\n# exceed allowed threshold.\n\ncheck_result = (\n    ImagePropertyDrift()\n    .add_condition_drift_score_not_greater_than(0.001)\n    .run(train_dataset, test_dataset)\n)\ncheck_result.show(show_additional_outputs=False)\n\n#%%\n# Check Parameters\n# ----------------\n# Image Property Drift Check accepts two parameters that allows us to control the look of the output:\n#\n# * `image_properties` - list of image properties that we are interested in\n# * `max_num_categories` - Maximal number of categories to use for the calculation of drift using PSI (Population Stability Index)\n#\n# Only next string values are allowed for the `image_properties` parameter:\n#\n# * `aspect_ratio`\n# * `area`\n# * `brightness`\n# * `mean_red_relative_intensity`\n# * `mean_green_relative_intensity`\n# * `mean_blue_relative_intensity`\n\nfrom typing import List\nimport numpy as np\n\n\ndef area(images: List[np.ndarray]) -> List[int]:\n    # Return list of integers of image areas (height multiplied by width)\n    return [img.shape[0] * img.shape[1] for img in images]\n\n\ndef aspect_ratio(images: List[np.ndarray]) -> List[float]:\n    # Return list of floats of image height to width ratio\n    return [img.shape[0] / img.shape[1] for img in images]\n\n\nproperties = [\n    {'name': 'Area', 'method': area, 'output_type': 'continuous'},\n    {'name': 'Aspect Ratio', 'method': aspect_ratio, 'output_type': 'continuous'}\n]\n\ncheck_result = ImagePropertyDrift(\n    alternative_image_properties=properties,\n    max_num_categories=20\n).run(train_dataset, test_dataset)\n\ncheck_result", "path": "docs/source/examples/vision/checks/distribution/source/plot_image_property_check.py"}]}