.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/vision/distribution/plot_image_property_outliers.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_checks_gallery_vision_distribution_plot_image_property_outliers.py: Image Property Outliers ======================= This notebooks provides an overview for using and understanding the image property outliers check, used to detect outliers in simple image properties in a dataset. **Structure:** * `Why Check for Outliers? <#why-check-for-outliers>`__ * `How Does the Check Work? <#how-does-the-check-work>`__ * `Which Image Properties Are Used? <#which-image-properties-are-used>`__ * `Run the Check <#run-the-check>`__ Why Check for Outliers? ----------------------- Examining outliers may help you gain insights that you couldn't have reached from taking an aggregate look or by inspecting random samples. For example, it may help you understand you have some corrupt samples (e.g. an image that is completely black), or samples you didn't expect to have (e.g. extreme aspect ratio). In some cases, these outliers may help debug some performance discrepancies (the model can be excused for failing on a totally dark image). In more extreme cases, the outlier samples may indicate the presence of samples interfering with the model's training by teaching the model to fit "irrelevant" samples. How Does the Check Work? ------------------------ Ideally we would like to directly find images which are outliers, but this is computationally expensive and does not have a clear and explainable results. Therefore, we use image properties in order to find outliers (such as brightness, aspect ratio etc.) which are much more efficient to compute, and each outlier is easily explained. We use `Interquartile Range `_ to define our upper and lower limit for the properties' values. Which Image Properties Are Used? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default the checks use the built-in image properties, and it's also possible to replace the default properties with custom ones. For the list of the built-in image properties and explanation about custom properties refer to :doc:`vision properties `. .. GENERATED FROM PYTHON SOURCE LINES 46-49 Run the Check ------------- For the example we will load COCO object detection data, and will run the check with the default properties. .. GENERATED FROM PYTHON SOURCE LINES 49-58 .. code-block:: default from deepchecks.vision.checks import ImagePropertyOutliers from deepchecks.vision.datasets.detection.coco import load_dataset train_data = load_dataset(train=True, object_type='VisionData') check = ImagePropertyOutliers() result = check.run(train_data) result .. rst-class:: sphx-glr-script-out Out: .. code-block:: none 0%| | 0/6984509 [00:00

Image Property Outliers

Find outliers images with respect to the given properties.

Additional Outputs

Property "Aspect Ratio"

Total number of outliers: 11
Non-outliers range: 0.34 to 1.3
Aspect Ratio
1.33
1.5
1.5
1.5
1.54
Image

Property "Area"

Total number of outliers: 13
Non-outliers range: 220,800 to 359,040
Area
139,520
166,000
166,500
187,000
187,500
360,000
361,600
366,720
374,544
378,240
Image

Property "Brightness"

Total number of outliers: 6
Non-outliers range: 0.24 to 0.69
Brightness
0.11
0.12
0.22
0.71
0.72
0.78
Image

Property "RMS Contrast"

Total number of outliers: 3
Non-outliers range: 0.1 to 0.37
RMS Contrast
0.07
0.38
0.4
Image

Property "Mean Red Relative Intensity"

Total number of outliers: 6
Non-outliers range: 0.24 to 0.48
Mean Red Relative Intensity
0.16
0.48
0.49
0.49
0.5
0.54
Image

Property "Mean Green Relative Intensity"

Total number of outliers: 7
Non-outliers range: 0.28 to 0.4
Mean Green Relative Intensity
0.22
0.44
0.45
0.48
0.53
0.69
Image

Property "Mean Blue Relative Intensity"

Total number of outliers: 3
Non-outliers range: 0.16 to 0.41
Mean Blue Relative Intensity
0.08
0.11
0.14
Image


.. GENERATED FROM PYTHON SOURCE LINES 59-73 Observe Graphic Result ^^^^^^^^^^^^^^^^^^^^^^ The check shows a section for each property. In each section we show the number of outliers and the non-outlier property range, and also the images with the lowest and highest values for the property. For example in property "RMS Contrast" we can see that only 3 outliers were found, 1 below the normal property range and 2 above. Now we can inspect these images and decide if we wish to ignore these kinds of samples or if we would like the model to be able to support them, in which case we may take a close look into the model's predictions on these samples. Observe Result Value ^^^^^^^^^^^^^^^^^^^^ The check returns CheckResult object with a property 'value' on it which contain the information that was calculated in the check's run. .. GENERATED FROM PYTHON SOURCE LINES 73-77 .. code-block:: default result.value .. rst-class:: sphx-glr-script-out Out: .. code-block:: none {'Aspect Ratio': {'indices': [6, 4, 27, 40, 63, 31, 8, 46, 10, 32, 22], 'lower_limit': 0.340625, 'upper_limit': 1.3029296874999998}, 'Area': {'indices': [60, 61, 44, 25, 62, 13, 6, 58, 50, 11, 26, 14, 45], 'lower_limit': 220800.0, 'upper_limit': 359040.0}, 'Brightness': {'indices': [54, 55, 47, 38, 62, 28], 'lower_limit': 0.23778584214186751, 'upper_limit': 0.6858694940161068}, 'RMS Contrast': {'indices': [54, 56, 61], 'lower_limit': 0.09993963741568856, 'upper_limit': 0.36929402509717535}, 'Mean Red Relative Intensity': {'indices': [50, 37, 36, 60, 61, 55], 'lower_limit': 0.24169391794555903, 'upper_limit': 0.4769510114694686}, 'Mean Green Relative Intensity': {'indices': [61, 3, 60, 63, 48, 54, 50], 'lower_limit': 0.28084770328411535, 'upper_limit': 0.4030514973864122}, 'Mean Blue Relative Intensity': {'indices': [60, 55, 50], 'lower_limit': 0.15795800862207085, 'upper_limit': 0.41322135317957304}} .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 5.177 seconds) .. _sphx_glr_download_checks_gallery_vision_distribution_plot_image_property_outliers.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_image_property_outliers.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_image_property_outliers.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_