{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "tVTHQ7QjH6TE"
},
"source": [
">### 🚩 *Create a free WhyLabs account to get more value out of whylogs!*
\n",
">*Did you know you can store, visualize, and monitor whylogs profiles with the [WhyLabs Observability Platform](https://whylabs.ai/whylogs-free-signup?utm_source=whylogs-Github&utm_medium=whylogs-example&utm_campaign=Image_Logging)? Sign up for a [free WhyLabs account](https://whylabs.ai/whylogs-free-signup?utm_source=whylogs-Github&utm_medium=whylogs-example&utm_campaign=Image_Logging) to leverage the power of whylogs and WhyLabs together!*"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5miDsaTTu3Fb"
},
"source": [
"# Image Logging\n",
"\n",
"Whylogs has optional support for logging data about images. This example demonstrates how to use whylogs with image data.\n",
"\n",
"## Install whylogs with Image Logging Support\n",
"\n",
"Whylogs uses [Pillow](https://python-pillow.org) for working with images. To install whylogs with the optional image support enabled, use the following:\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4MNaZsuHxiq2",
"outputId": "a44a04f4-d987-4624-8f59-5ad78fbb1ef4",
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"# Note: you may need to restart the kernel to use updated packages.\n",
"%pip install 'whylogs[image,whylabs]'"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NsW-ivHNyLjU"
},
"source": [
"This will install all the dependencies whylogs needs to work with image data.\n",
"\n",
"## Basic Image Logging\n",
"\n",
"The `log_image()` function provides a simple interface for logging images."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 567
},
"id": "Laud3_BTGRU1",
"outputId": "7a802064-a8e8-41e5-80a3-b80e6cbe6674"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAANIUlEQVR4nO1d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5migIcx6wyfRnly/ssjKkXPtolpqBcLD2grzYB1AlP3p4arDr0pgF6WoK0oqI/50hHyLlSzrvC9D9b45a7Vps+JOTOffXbPq3TZh3TYmZGwIodtakFVlEf13l48/udifA8imuegoqYNpvvzV+JwTYPsem+xRkn/jdpMXLO6U1pSGBXrhKo317cfT4vGUXGnJGh0t6azwWVwsjlkoA2TwSdIx/J/wOV4asJkSgYSToTX3d8LtcGrNVgho10Jz5O+J3uzZorQQJXJH/otmkdYuJuF0ctVcCADbuXmf8zl+i0r1HR27N+VtkLGJk+7Yc1NHDa3SORoGTdnp5j9BxGHDTivsdIkBnY6jXhBvp601SfY8DZ9X3owFAv1rgkN0+3yXWmxa4rLc/DQB60gK3tPb9Njn3WuC4wn41AHCtBc757J8AlxT0YFSOQUC87OukFvdyHALgQA16mlKORkA3NejPrToiAbDmoE+v8rgEIAZjQkLfgdXRCQAMSDhCWHkSAoAUWz0Nx0oqnIyAWDKYNcuCvcuJCcjk+NBjufg3S38QcOoOnFo+CDh1B04tHwScugOnlg8CTt2BU8sHAadyQX8R4eHJnPBfQhjD04Uhv4BwbAMulgFGYgQvlAEG0lngIhmIQQ/zXy5KEsjD4tfLkRTwhyOUHlyYChzgDqs/XYJkYIeqH89eclCH6p/PW/JAh3UnzlgKMIf1p85ViiB/K5/sfYvniaV8jyt+wJkrQQVe1RE6awaq4BSe4BkzoICmcoXPlgEVMGUscKYMKGGpg6GzZEANqmaDxPlNh3X3tDYcPjMlqIVTnw84KwbqwTQkRM6IgQYoTZukzsUQNN7J5pTYWShBM4j/AZ0duhOKlwPCAAAAAElFTkSuQmCC",
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 91.99722290039062, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 91.99722290039062, 'image/Brightness.mean:distribution/min': 91.99722290039062, 'image/Brightness.mean:distribution/q_01': 91.99722290039062, 'image/Brightness.mean:distribution/q_05': 91.99722290039062, 'image/Brightness.mean:distribution/q_10': 91.99722290039062, 'image/Brightness.mean:distribution/q_25': 91.99722290039062, 'image/Brightness.mean:distribution/median': 91.99722290039062, 'image/Brightness.mean:distribution/q_75': 91.99722290039062, 'image/Brightness.mean:distribution/q_90': 91.99722290039062, 'image/Brightness.mean:distribution/q_95': 91.99722290039062, 'image/Brightness.mean:distribution/q_99': 91.99722290039062, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 41.904298558131785, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 41.904298558131785, 'image/Brightness.stddev:distribution/min': 41.904298558131785, 'image/Brightness.stddev:distribution/q_01': 41.904298558131785, 'image/Brightness.stddev:distribution/q_05': 41.904298558131785, 'image/Brightness.stddev:distribution/q_10': 41.904298558131785, 'image/Brightness.stddev:distribution/q_25': 41.904298558131785, 'image/Brightness.stddev:distribution/median': 41.904298558131785, 'image/Brightness.stddev:distribution/q_75': 41.904298558131785, 'image/Brightness.stddev:distribution/q_90': 41.904298558131785, 'image/Brightness.stddev:distribution/q_95': 41.904298558131785, 'image/Brightness.stddev:distribution/q_99': 41.904298558131785}\n"
]
}
],
"source": [
"from PIL import Image\n",
"\n",
"from whylogs.extras.image_metric import log_image\n",
"\n",
"img1 = Image.effect_mandelbrot((256, 256), (-3, -2.5, 2, 2.5), 9)\n",
"img2 = Image.effect_mandelbrot((256, 256), (-3, -2.5, 2, 2.5), 20)\n",
"\n",
"display(img1)\n",
"display(img2)\n",
"\n",
"results = log_image(img1)\n",
"print(results.view().get_column(\"image\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kd9IqAfXIzX4"
},
"source": [
"As you can see above, just passing in an `Image` results in a column named \"image\" in the profile. You can pass in a list of images, which will append an index to each column name:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "uioACRBVKzxX",
"outputId": "7363e3c7-781e-4ce5-c6f9-dcb4c8b3c78f"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['image_0', 'image_1']\n",
"{'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 44.64898681640625, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 44.64898681640625, 'image/Brightness.mean:distribution/min': 44.64898681640625, 'image/Brightness.mean:distribution/q_01': 44.64898681640625, 'image/Brightness.mean:distribution/q_05': 44.64898681640625, 'image/Brightness.mean:distribution/q_10': 44.64898681640625, 'image/Brightness.mean:distribution/q_25': 44.64898681640625, 'image/Brightness.mean:distribution/median': 44.64898681640625, 'image/Brightness.mean:distribution/q_75': 44.64898681640625, 'image/Brightness.mean:distribution/q_90': 44.64898681640625, 'image/Brightness.mean:distribution/q_95': 44.64898681640625, 'image/Brightness.mean:distribution/q_99': 44.64898681640625, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 25.79447615661466, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 25.79447615661466, 'image/Brightness.stddev:distribution/min': 25.79447615661466, 'image/Brightness.stddev:distribution/q_01': 25.79447615661466, 'image/Brightness.stddev:distribution/q_05': 25.79447615661466, 'image/Brightness.stddev:distribution/q_10': 25.79447615661466, 'image/Brightness.stddev:distribution/q_25': 25.79447615661466, 'image/Brightness.stddev:distribution/median': 25.79447615661466, 'image/Brightness.stddev:distribution/q_75': 25.79447615661466, 'image/Brightness.stddev:distribution/q_90': 25.79447615661466, 'image/Brightness.stddev:distribution/q_95': 25.79447615661466, 'image/Brightness.stddev:distribution/q_99': 25.79447615661466}\n"
]
}
],
"source": [
"results = log_image([img1, img2])\n",
"print(list(results.view().get_columns()))\n",
"print(results.view().get_column(\"image_1\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "B2Niw5rwLBaS"
},
"source": [
"You can change the default name if you like:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "MqylDGGLNWl4",
"outputId": "85d8c6aa-a568-47b5-d995-17f00b25fa7e"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['awesome_image_0', 'awesome_image_1']\n",
"{'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 91.99722290039062, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 91.99722290039062, 'image/Brightness.mean:distribution/min': 91.99722290039062, 'image/Brightness.mean:distribution/q_01': 91.99722290039062, 'image/Brightness.mean:distribution/q_05': 91.99722290039062, 'image/Brightness.mean:distribution/q_10': 91.99722290039062, 'image/Brightness.mean:distribution/q_25': 91.99722290039062, 'image/Brightness.mean:distribution/median': 91.99722290039062, 'image/Brightness.mean:distribution/q_75': 91.99722290039062, 'image/Brightness.mean:distribution/q_90': 91.99722290039062, 'image/Brightness.mean:distribution/q_95': 91.99722290039062, 'image/Brightness.mean:distribution/q_99': 91.99722290039062, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 41.904298558131785, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 41.904298558131785, 'image/Brightness.stddev:distribution/min': 41.904298558131785, 'image/Brightness.stddev:distribution/q_01': 41.904298558131785, 'image/Brightness.stddev:distribution/q_05': 41.904298558131785, 'image/Brightness.stddev:distribution/q_10': 41.904298558131785, 'image/Brightness.stddev:distribution/q_25': 41.904298558131785, 'image/Brightness.stddev:distribution/median': 41.904298558131785, 'image/Brightness.stddev:distribution/q_75': 41.904298558131785, 'image/Brightness.stddev:distribution/q_90': 41.904298558131785, 'image/Brightness.stddev:distribution/q_95': 41.904298558131785, 'image/Brightness.stddev:distribution/q_99': 41.904298558131785}\n"
]
}
],
"source": [
"results = log_image([img1, img2], default_column_prefix=\"awesome_image\")\n",
"print(list(results.view().get_columns()))\n",
"print(results.view().get_column(\"awesome_image_0\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "bdvbyB10NrAs"
},
"source": [
"You can also pass a dictionary of images to give each \"column\" a unique name:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ogb_0tJLNqY7",
"outputId": "763da1ee-4054-48bb-e369-8b9aa68b41ed"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 44.64898681640625, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 44.64898681640625, 'image/Brightness.mean:distribution/min': 44.64898681640625, 'image/Brightness.mean:distribution/q_01': 44.64898681640625, 'image/Brightness.mean:distribution/q_05': 44.64898681640625, 'image/Brightness.mean:distribution/q_10': 44.64898681640625, 'image/Brightness.mean:distribution/q_25': 44.64898681640625, 'image/Brightness.mean:distribution/median': 44.64898681640625, 'image/Brightness.mean:distribution/q_75': 44.64898681640625, 'image/Brightness.mean:distribution/q_90': 44.64898681640625, 'image/Brightness.mean:distribution/q_95': 44.64898681640625, 'image/Brightness.mean:distribution/q_99': 44.64898681640625, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 25.79447615661466, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 25.79447615661466, 'image/Brightness.stddev:distribution/min': 25.79447615661466, 'image/Brightness.stddev:distribution/q_01': 25.79447615661466, 'image/Brightness.stddev:distribution/q_05': 25.79447615661466, 'image/Brightness.stddev:distribution/q_10': 25.79447615661466, 'image/Brightness.stddev:distribution/q_25': 25.79447615661466, 'image/Brightness.stddev:distribution/median': 25.79447615661466, 'image/Brightness.stddev:distribution/q_75': 25.79447615661466, 'image/Brightness.stddev:distribution/q_90': 25.79447615661466, 'image/Brightness.stddev:distribution/q_95': 25.79447615661466, 'image/Brightness.stddev:distribution/q_99': 25.79447615661466}\n"
]
}
],
"source": [
"results = log_image({\"left_camera\": img1, \"right_camera\": img2})\n",
"print(results.view().get_column(\"right_camera\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "QDK7MW5_eH1T"
},
"source": [
"## EXIF Tag Logging\n",
"\n",
"whylogs will include any EXIF tags with numeric or string values in the image profile. PIL's EXIF facilities are rudimentary, so we'll use the piexif library to construct EXIF tags for this example. See the Advanced Image Logging section for how to control which EXIF tags are tracked."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_Q0BhfSEe-1s",
"outputId": "2e9cbbcc-e195-4d89-adef-325ca23cf87f"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Collecting piexif\n",
" Downloading piexif-1.1.3-py2.py3-none-any.whl (20 kB)\n",
"Installing collected packages: piexif\n",
"Successfully installed piexif-1.1.3\n"
]
}
],
"source": [
"%pip install piexif"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "YeX7Lm-IfGi-",
"outputId": "bd50984c-6c37-4619-e849-8355cfaa2683"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{36867: '2099:09:29 10:10:10', 41994: 65535, 282: (96, 1), 283: (96, 1), 34665: 105, 305: 'piexif', 42034: ((1, 1), (1, 1), (1, 1), (1, 1)), 42035: 'LensMake', 315: 'someone'}\n",
"{'image/DateTimeOriginal:counts/n': 1, 'image/DateTimeOriginal:counts/null': 0, 'image/DateTimeOriginal:types/integral': 0, 'image/DateTimeOriginal:types/fractional': 0, 'image/DateTimeOriginal:types/boolean': 0, 'image/DateTimeOriginal:types/string': 1, 'image/DateTimeOriginal:types/object': 0, 'image/DateTimeOriginal:cardinality/est': 1.0, 'image/DateTimeOriginal:cardinality/upper_1': 1.000049929250618, 'image/DateTimeOriginal:cardinality/lower_1': 1.0, 'image/DateTimeOriginal:frequent_items/frequent_strings': [FrequentItem(value='2099:09:29 10:10:10', est=1, upper=1, lower=1)], 'image/ExifIFD:counts/n': 1, 'image/ExifIFD:counts/null': 0, 'image/ExifIFD:types/integral': 1, 'image/ExifIFD:types/fractional': 0, 'image/ExifIFD:types/boolean': 0, 'image/ExifIFD:types/string': 0, 'image/ExifIFD:types/object': 0, 'image/ExifIFD:cardinality/est': 1.0, 'image/ExifIFD:cardinality/upper_1': 1.000049929250618, 'image/ExifIFD:cardinality/lower_1': 1.0, 'image/ExifIFD:distribution/mean': 105.0, 'image/ExifIFD:distribution/stddev': 0.0, 'image/ExifIFD:distribution/n': 1, 'image/ExifIFD:distribution/max': 105.0, 'image/ExifIFD:distribution/min': 105.0, 'image/ExifIFD:distribution/q_01': 105.0, 'image/ExifIFD:distribution/q_05': 105.0, 'image/ExifIFD:distribution/q_10': 105.0, 'image/ExifIFD:distribution/q_25': 105.0, 'image/ExifIFD:distribution/median': 105.0, 'image/ExifIFD:distribution/q_75': 105.0, 'image/ExifIFD:distribution/q_90': 105.0, 'image/ExifIFD:distribution/q_95': 105.0, 'image/ExifIFD:distribution/q_99': 105.0, 'image/ExifIFD:ints/max': 105, 'image/ExifIFD:ints/min': 105, 'image/ExifIFD:frequent_items/frequent_strings': [FrequentItem(value='105.000000', est=1, upper=1, lower=1)], 'image/Sharpness:counts/n': 1, 'image/Sharpness:counts/null': 0, 'image/Sharpness:types/integral': 1, 'image/Sharpness:types/fractional': 0, 'image/Sharpness:types/boolean': 0, 'image/Sharpness:types/string': 0, 'image/Sharpness:types/object': 0, 'image/Sharpness:cardinality/est': 1.0, 'image/Sharpness:cardinality/upper_1': 1.000049929250618, 'image/Sharpness:cardinality/lower_1': 1.0, 'image/Sharpness:distribution/mean': 65535.0, 'image/Sharpness:distribution/stddev': 0.0, 'image/Sharpness:distribution/n': 1, 'image/Sharpness:distribution/max': 65535.0, 'image/Sharpness:distribution/min': 65535.0, 'image/Sharpness:distribution/q_01': 65535.0, 'image/Sharpness:distribution/q_05': 65535.0, 'image/Sharpness:distribution/q_10': 65535.0, 'image/Sharpness:distribution/q_25': 65535.0, 'image/Sharpness:distribution/median': 65535.0, 'image/Sharpness:distribution/q_75': 65535.0, 'image/Sharpness:distribution/q_90': 65535.0, 'image/Sharpness:distribution/q_95': 65535.0, 'image/Sharpness:distribution/q_99': 65535.0, 'image/Sharpness:ints/max': 65535, 'image/Sharpness:ints/min': 65535, 'image/Sharpness:frequent_items/frequent_strings': [FrequentItem(value='65535.000000', est=1, upper=1, lower=1)], 'image/Software:counts/n': 1, 'image/Software:counts/null': 0, 'image/Software:types/integral': 0, 'image/Software:types/fractional': 0, 'image/Software:types/boolean': 0, 'image/Software:types/string': 1, 'image/Software:types/object': 0, 'image/Software:cardinality/est': 1.0, 'image/Software:cardinality/upper_1': 1.000049929250618, 'image/Software:cardinality/lower_1': 1.0, 'image/Software:frequent_items/frequent_strings': [FrequentItem(value='piexif', est=1, upper=1, lower=1)], 'image/LensSpecification:counts/n': 1, 'image/LensSpecification:counts/null': 0, 'image/LensSpecification:types/integral': 0, 'image/LensSpecification:types/fractional': 0, 'image/LensSpecification:types/boolean': 0, 'image/LensSpecification:types/string': 0, 'image/LensSpecification:types/object': 1, 'image/LensSpecification:cardinality/est': 0.0, 'image/LensSpecification:cardinality/upper_1': 0.0, 'image/LensSpecification:cardinality/lower_1': 0.0, 'image/LensMake:counts/n': 1, 'image/LensMake:counts/null': 0, 'image/LensMake:types/integral': 0, 'image/LensMake:types/fractional': 0, 'image/LensMake:types/boolean': 0, 'image/LensMake:types/string': 1, 'image/LensMake:types/object': 0, 'image/LensMake:cardinality/est': 1.0, 'image/LensMake:cardinality/upper_1': 1.000049929250618, 'image/LensMake:cardinality/lower_1': 1.0, 'image/LensMake:frequent_items/frequent_strings': [FrequentItem(value='LensMake', est=1, upper=1, lower=1)], 'image/Artist:counts/n': 1, 'image/Artist:counts/null': 0, 'image/Artist:types/integral': 0, 'image/Artist:types/fractional': 0, 'image/Artist:types/boolean': 0, 'image/Artist:types/string': 1, 'image/Artist:types/object': 0, 'image/Artist:cardinality/est': 1.0, 'image/Artist:cardinality/upper_1': 1.000049929250618, 'image/Artist:cardinality/lower_1': 1.0, 'image/Artist:frequent_items/frequent_strings': [FrequentItem(value='someone', est=1, upper=1, lower=1)], 'image/XResolution:counts/n': 1, 'image/XResolution:counts/null': 0, 'image/XResolution:types/integral': 0, 'image/XResolution:types/fractional': 0, 'image/XResolution:types/boolean': 0, 'image/XResolution:types/string': 0, 'image/XResolution:types/object': 1, 'image/XResolution:cardinality/est': 0.0, 'image/XResolution:cardinality/upper_1': 0.0, 'image/XResolution:cardinality/lower_1': 0.0, 'image/YResolution:counts/n': 1, 'image/YResolution:counts/null': 0, 'image/YResolution:types/integral': 0, 'image/YResolution:types/fractional': 0, 'image/YResolution:types/boolean': 0, 'image/YResolution:types/string': 0, 'image/YResolution:types/object': 1, 'image/YResolution:cardinality/est': 0.0, 'image/YResolution:cardinality/upper_1': 0.0, 'image/YResolution:cardinality/lower_1': 0.0, 'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 44.71923828125, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 44.71923828125, 'image/Brightness.mean:distribution/min': 44.71923828125, 'image/Brightness.mean:distribution/q_01': 44.71923828125, 'image/Brightness.mean:distribution/q_05': 44.71923828125, 'image/Brightness.mean:distribution/q_10': 44.71923828125, 'image/Brightness.mean:distribution/q_25': 44.71923828125, 'image/Brightness.mean:distribution/median': 44.71923828125, 'image/Brightness.mean:distribution/q_75': 44.71923828125, 'image/Brightness.mean:distribution/q_90': 44.71923828125, 'image/Brightness.mean:distribution/q_95': 44.71923828125, 'image/Brightness.mean:distribution/q_99': 44.71923828125, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 25.719757982712743, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 25.719757982712743, 'image/Brightness.stddev:distribution/min': 25.719757982712743, 'image/Brightness.stddev:distribution/q_01': 25.719757982712743, 'image/Brightness.stddev:distribution/q_05': 25.719757982712743, 'image/Brightness.stddev:distribution/q_10': 25.719757982712743, 'image/Brightness.stddev:distribution/q_25': 25.719757982712743, 'image/Brightness.stddev:distribution/median': 25.719757982712743, 'image/Brightness.stddev:distribution/q_75': 25.719757982712743, 'image/Brightness.stddev:distribution/q_90': 25.719757982712743, 'image/Brightness.stddev:distribution/q_95': 25.719757982712743, 'image/Brightness.stddev:distribution/q_99': 25.719757982712743}\n"
]
}
],
"source": [
"import piexif\n",
"zeroth_ifd = {\n",
" piexif.ImageIFD.Artist: u\"someone\",\n",
" piexif.ImageIFD.XResolution: (96, 1),\n",
" piexif.ImageIFD.YResolution: (96, 1),\n",
" piexif.ImageIFD.Software: u\"piexif\"\n",
"}\n",
"exif_ifd = {\n",
" piexif.ExifIFD.DateTimeOriginal: u\"2099:09:29 10:10:10\",\n",
" piexif.ExifIFD.LensMake: u\"LensMake\",\n",
" piexif.ExifIFD.Sharpness: 65535,\n",
" piexif.ExifIFD.LensSpecification: ((1, 1), (1, 1), (1, 1), (1, 1)),\n",
"}\n",
"exif_dict = {\"0th\": zeroth_ifd, \"Exif\": exif_ifd}\n",
"exif_bytes = piexif.dump(exif_dict)\n",
"img2.save(\"out.jpg\", exif=exif_bytes)\n",
"img3 = Image.open(\"out.jpg\")\n",
"print(img3._getexif())\n",
"\n",
"results = log_image(img3)\n",
"print(results.view().get_column(\"image\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dmPj0szMSdpy"
},
"source": [
"## Advanced Image Logging\n",
"\n",
"The `log_image()` function provides a flexible interface for logging image data. If you want to log images along with other types of data, you can do so by setting up a custom `DatasetSchema` to specify which columns contain images. For this example, we'll compute a couple of features from the image and log them along with the image itself in a Pandas `DataFrame`. We subclass the `StandardResolver` to use an `ImageMetric` for any image columns, and the standard metrics for any other columns."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "6NyXGf30aegh",
"outputId": "413d77b5-d500-41b8-c30d-18ed8b554b61"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'counts/n': 1, 'counts/null': 0, 'types/integral': 1, 'types/fractional': 0, 'types/boolean': 0, 'types/string': 0, 'types/object': 0, 'distribution/mean': 85.0, 'distribution/stddev': 0.0, 'distribution/n': 1, 'distribution/max': 85.0, 'distribution/min': 85.0, 'distribution/q_01': 85.0, 'distribution/q_05': 85.0, 'distribution/q_10': 85.0, 'distribution/q_25': 85.0, 'distribution/median': 85.0, 'distribution/q_75': 85.0, 'distribution/q_90': 85.0, 'distribution/q_95': 85.0, 'distribution/q_99': 85.0, 'ints/max': 85, 'ints/min': 85, 'cardinality/est': 1.0, 'cardinality/upper_1': 1.000049929250618, 'cardinality/lower_1': 1.0, 'frequent_items/frequent_strings': [FrequentItem(value='85', est=1, upper=1, lower=1)]}\n",
"{'counts/n': 1, 'counts/null': 0, 'types/integral': 0, 'types/fractional': 1, 'types/boolean': 0, 'types/string': 0, 'types/object': 0, 'cardinality/est': 1.0, 'cardinality/upper_1': 1.000049929250618, 'cardinality/lower_1': 1.0, 'distribution/mean': 6029130.0, 'distribution/stddev': 0.0, 'distribution/n': 1, 'distribution/max': 6029130.0, 'distribution/min': 6029130.0, 'distribution/q_01': 6029130.0, 'distribution/q_05': 6029130.0, 'distribution/q_10': 6029130.0, 'distribution/q_25': 6029130.0, 'distribution/median': 6029130.0, 'distribution/q_75': 6029130.0, 'distribution/q_90': 6029130.0, 'distribution/q_95': 6029130.0, 'distribution/q_99': 6029130.0}\n",
"{'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 91.99722290039062, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 91.99722290039062, 'image/Brightness.mean:distribution/min': 91.99722290039062, 'image/Brightness.mean:distribution/q_01': 91.99722290039062, 'image/Brightness.mean:distribution/q_05': 91.99722290039062, 'image/Brightness.mean:distribution/q_10': 91.99722290039062, 'image/Brightness.mean:distribution/q_25': 91.99722290039062, 'image/Brightness.mean:distribution/median': 91.99722290039062, 'image/Brightness.mean:distribution/q_75': 91.99722290039062, 'image/Brightness.mean:distribution/q_90': 91.99722290039062, 'image/Brightness.mean:distribution/q_95': 91.99722290039062, 'image/Brightness.mean:distribution/q_99': 91.99722290039062, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 41.904298558131785, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 41.904298558131785, 'image/Brightness.stddev:distribution/min': 41.904298558131785, 'image/Brightness.stddev:distribution/q_01': 41.904298558131785, 'image/Brightness.stddev:distribution/q_05': 41.904298558131785, 'image/Brightness.stddev:distribution/q_10': 41.904298558131785, 'image/Brightness.stddev:distribution/q_25': 41.904298558131785, 'image/Brightness.stddev:distribution/median': 41.904298558131785, 'image/Brightness.stddev:distribution/q_75': 41.904298558131785, 'image/Brightness.stddev:distribution/q_90': 41.904298558131785, 'image/Brightness.stddev:distribution/q_95': 41.904298558131785, 'image/Brightness.stddev:distribution/q_99': 41.904298558131785}\n"
]
}
],
"source": [
"from typing import Dict\n",
"from PIL.ImageStat import Stat\n",
"import pandas as pd\n",
"\n",
"import whylogs as why\n",
"from whylogs.core.datatypes import DataType\n",
"from whylogs.core.metrics import Metric\n",
"from whylogs.core.resolvers import StandardResolver\n",
"from whylogs.core.schema import DatasetSchema, ColumnSchema\n",
"from whylogs.extras.image_metric import ImageMetric, ImageMetricConfig\n",
"\n",
"class ImageResolver(StandardResolver):\n",
" def resolve(self, name: str, why_type: DataType, column_schema: ColumnSchema) -> Dict[str, Metric]:\n",
" if \"image\" in name:\n",
" return {ImageMetric.get_namespace(): ImageMetric.zero(column_schema.cfg)}\n",
" return super(ImageResolver, self).resolve(name, why_type, column_schema)\n",
"\n",
"schema = DatasetSchema(resolvers=ImageResolver(), default_configs=ImageMetricConfig())\n",
"\n",
"stats = Stat(img1)\n",
"df = pd.DataFrame({\"median\": stats.median, \"sum\": stats.sum, \"images\": img1})\n",
"results = why.log(df, schema=schema).view()\n",
"\n",
"print(results.get_column(\"median\").to_summary_dict())\n",
"print(results.get_column(\"sum\").to_summary_dict())\n",
"print(results.get_column(\"images\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "l2q4fSAiWxo_"
},
"source": [
"By default, any numerical or string valued EXIF tags will be included in the image profile. You can control which tags are included via the `allowed_exif_tags` and `forbidden_exif_tags` members of the `ImageMetricConfig`. These are both sets of strings naming the allowed or forbidden EXIF tag names. If `allowed_exif_tags` is non-empty, only the tags it contains will be included in the profile. Any tags listed in `forbidden_exif_tags` will be excluded from the profile (handy in case any of the tags are considered PII). In this example, we'll exclude the `Artist` tag from the profile."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "FG_zIOrkbnEA",
"outputId": "dabd78ed-cc2d-4595-b538-5ac0a70df4b6"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'image/DateTimeOriginal:counts/n': 1, 'image/DateTimeOriginal:counts/null': 0, 'image/DateTimeOriginal:types/integral': 0, 'image/DateTimeOriginal:types/fractional': 0, 'image/DateTimeOriginal:types/boolean': 0, 'image/DateTimeOriginal:types/string': 1, 'image/DateTimeOriginal:types/object': 0, 'image/DateTimeOriginal:cardinality/est': 1.0, 'image/DateTimeOriginal:cardinality/upper_1': 1.000049929250618, 'image/DateTimeOriginal:cardinality/lower_1': 1.0, 'image/DateTimeOriginal:frequent_items/frequent_strings': [FrequentItem(value='2099:09:29 10:10:10', est=1, upper=1, lower=1)], 'image/ExifIFD:counts/n': 1, 'image/ExifIFD:counts/null': 0, 'image/ExifIFD:types/integral': 1, 'image/ExifIFD:types/fractional': 0, 'image/ExifIFD:types/boolean': 0, 'image/ExifIFD:types/string': 0, 'image/ExifIFD:types/object': 0, 'image/ExifIFD:cardinality/est': 1.0, 'image/ExifIFD:cardinality/upper_1': 1.000049929250618, 'image/ExifIFD:cardinality/lower_1': 1.0, 'image/ExifIFD:distribution/mean': 105.0, 'image/ExifIFD:distribution/stddev': 0.0, 'image/ExifIFD:distribution/n': 1, 'image/ExifIFD:distribution/max': 105.0, 'image/ExifIFD:distribution/min': 105.0, 'image/ExifIFD:distribution/q_01': 105.0, 'image/ExifIFD:distribution/q_05': 105.0, 'image/ExifIFD:distribution/q_10': 105.0, 'image/ExifIFD:distribution/q_25': 105.0, 'image/ExifIFD:distribution/median': 105.0, 'image/ExifIFD:distribution/q_75': 105.0, 'image/ExifIFD:distribution/q_90': 105.0, 'image/ExifIFD:distribution/q_95': 105.0, 'image/ExifIFD:distribution/q_99': 105.0, 'image/ExifIFD:ints/max': 105, 'image/ExifIFD:ints/min': 105, 'image/ExifIFD:frequent_items/frequent_strings': [FrequentItem(value='105.000000', est=1, upper=1, lower=1)], 'image/Sharpness:counts/n': 1, 'image/Sharpness:counts/null': 0, 'image/Sharpness:types/integral': 1, 'image/Sharpness:types/fractional': 0, 'image/Sharpness:types/boolean': 0, 'image/Sharpness:types/string': 0, 'image/Sharpness:types/object': 0, 'image/Sharpness:cardinality/est': 1.0, 'image/Sharpness:cardinality/upper_1': 1.000049929250618, 'image/Sharpness:cardinality/lower_1': 1.0, 'image/Sharpness:distribution/mean': 65535.0, 'image/Sharpness:distribution/stddev': 0.0, 'image/Sharpness:distribution/n': 1, 'image/Sharpness:distribution/max': 65535.0, 'image/Sharpness:distribution/min': 65535.0, 'image/Sharpness:distribution/q_01': 65535.0, 'image/Sharpness:distribution/q_05': 65535.0, 'image/Sharpness:distribution/q_10': 65535.0, 'image/Sharpness:distribution/q_25': 65535.0, 'image/Sharpness:distribution/median': 65535.0, 'image/Sharpness:distribution/q_75': 65535.0, 'image/Sharpness:distribution/q_90': 65535.0, 'image/Sharpness:distribution/q_95': 65535.0, 'image/Sharpness:distribution/q_99': 65535.0, 'image/Sharpness:ints/max': 65535, 'image/Sharpness:ints/min': 65535, 'image/Sharpness:frequent_items/frequent_strings': [FrequentItem(value='65535.000000', est=1, upper=1, lower=1)], 'image/Software:counts/n': 1, 'image/Software:counts/null': 0, 'image/Software:types/integral': 0, 'image/Software:types/fractional': 0, 'image/Software:types/boolean': 0, 'image/Software:types/string': 1, 'image/Software:types/object': 0, 'image/Software:cardinality/est': 1.0, 'image/Software:cardinality/upper_1': 1.000049929250618, 'image/Software:cardinality/lower_1': 1.0, 'image/Software:frequent_items/frequent_strings': [FrequentItem(value='piexif', est=1, upper=1, lower=1)], 'image/LensSpecification:counts/n': 1, 'image/LensSpecification:counts/null': 0, 'image/LensSpecification:types/integral': 0, 'image/LensSpecification:types/fractional': 0, 'image/LensSpecification:types/boolean': 0, 'image/LensSpecification:types/string': 0, 'image/LensSpecification:types/object': 1, 'image/LensSpecification:cardinality/est': 0.0, 'image/LensSpecification:cardinality/upper_1': 0.0, 'image/LensSpecification:cardinality/lower_1': 0.0, 'image/LensMake:counts/n': 1, 'image/LensMake:counts/null': 0, 'image/LensMake:types/integral': 0, 'image/LensMake:types/fractional': 0, 'image/LensMake:types/boolean': 0, 'image/LensMake:types/string': 1, 'image/LensMake:types/object': 0, 'image/LensMake:cardinality/est': 1.0, 'image/LensMake:cardinality/upper_1': 1.000049929250618, 'image/LensMake:cardinality/lower_1': 1.0, 'image/LensMake:frequent_items/frequent_strings': [FrequentItem(value='LensMake', est=1, upper=1, lower=1)], 'image/XResolution:counts/n': 1, 'image/XResolution:counts/null': 0, 'image/XResolution:types/integral': 0, 'image/XResolution:types/fractional': 0, 'image/XResolution:types/boolean': 0, 'image/XResolution:types/string': 0, 'image/XResolution:types/object': 1, 'image/XResolution:cardinality/est': 0.0, 'image/XResolution:cardinality/upper_1': 0.0, 'image/XResolution:cardinality/lower_1': 0.0, 'image/YResolution:counts/n': 1, 'image/YResolution:counts/null': 0, 'image/YResolution:types/integral': 0, 'image/YResolution:types/fractional': 0, 'image/YResolution:types/boolean': 0, 'image/YResolution:types/string': 0, 'image/YResolution:types/object': 1, 'image/YResolution:cardinality/est': 0.0, 'image/YResolution:cardinality/upper_1': 0.0, 'image/YResolution:cardinality/lower_1': 0.0, 'image/ImagePixelWidth:counts/n': 1, 'image/ImagePixelWidth:counts/null': 0, 'image/ImagePixelWidth:types/integral': 1, 'image/ImagePixelWidth:types/fractional': 0, 'image/ImagePixelWidth:types/boolean': 0, 'image/ImagePixelWidth:types/string': 0, 'image/ImagePixelWidth:types/object': 0, 'image/ImagePixelWidth:cardinality/est': 1.0, 'image/ImagePixelWidth:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelWidth:cardinality/lower_1': 1.0, 'image/ImagePixelWidth:distribution/mean': 256.0, 'image/ImagePixelWidth:distribution/stddev': 0.0, 'image/ImagePixelWidth:distribution/n': 1, 'image/ImagePixelWidth:distribution/max': 256.0, 'image/ImagePixelWidth:distribution/min': 256.0, 'image/ImagePixelWidth:distribution/q_01': 256.0, 'image/ImagePixelWidth:distribution/q_05': 256.0, 'image/ImagePixelWidth:distribution/q_10': 256.0, 'image/ImagePixelWidth:distribution/q_25': 256.0, 'image/ImagePixelWidth:distribution/median': 256.0, 'image/ImagePixelWidth:distribution/q_75': 256.0, 'image/ImagePixelWidth:distribution/q_90': 256.0, 'image/ImagePixelWidth:distribution/q_95': 256.0, 'image/ImagePixelWidth:distribution/q_99': 256.0, 'image/ImagePixelWidth:ints/max': 256, 'image/ImagePixelWidth:ints/min': 256, 'image/ImagePixelWidth:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/ImagePixelHeight:counts/n': 1, 'image/ImagePixelHeight:counts/null': 0, 'image/ImagePixelHeight:types/integral': 1, 'image/ImagePixelHeight:types/fractional': 0, 'image/ImagePixelHeight:types/boolean': 0, 'image/ImagePixelHeight:types/string': 0, 'image/ImagePixelHeight:types/object': 0, 'image/ImagePixelHeight:cardinality/est': 1.0, 'image/ImagePixelHeight:cardinality/upper_1': 1.000049929250618, 'image/ImagePixelHeight:cardinality/lower_1': 1.0, 'image/ImagePixelHeight:distribution/mean': 256.0, 'image/ImagePixelHeight:distribution/stddev': 0.0, 'image/ImagePixelHeight:distribution/n': 1, 'image/ImagePixelHeight:distribution/max': 256.0, 'image/ImagePixelHeight:distribution/min': 256.0, 'image/ImagePixelHeight:distribution/q_01': 256.0, 'image/ImagePixelHeight:distribution/q_05': 256.0, 'image/ImagePixelHeight:distribution/q_10': 256.0, 'image/ImagePixelHeight:distribution/q_25': 256.0, 'image/ImagePixelHeight:distribution/median': 256.0, 'image/ImagePixelHeight:distribution/q_75': 256.0, 'image/ImagePixelHeight:distribution/q_90': 256.0, 'image/ImagePixelHeight:distribution/q_95': 256.0, 'image/ImagePixelHeight:distribution/q_99': 256.0, 'image/ImagePixelHeight:ints/max': 256, 'image/ImagePixelHeight:ints/min': 256, 'image/ImagePixelHeight:frequent_items/frequent_strings': [FrequentItem(value='256.000000', est=1, upper=1, lower=1)], 'image/Colorspace:counts/n': 1, 'image/Colorspace:counts/null': 0, 'image/Colorspace:types/integral': 0, 'image/Colorspace:types/fractional': 0, 'image/Colorspace:types/boolean': 0, 'image/Colorspace:types/string': 1, 'image/Colorspace:types/object': 0, 'image/Colorspace:cardinality/est': 1.0, 'image/Colorspace:cardinality/upper_1': 1.000049929250618, 'image/Colorspace:cardinality/lower_1': 1.0, 'image/Colorspace:frequent_items/frequent_strings': [FrequentItem(value='L', est=1, upper=1, lower=1)], 'image/Hue.mean:counts/n': 1, 'image/Hue.mean:counts/null': 0, 'image/Hue.mean:types/integral': 0, 'image/Hue.mean:types/fractional': 1, 'image/Hue.mean:types/boolean': 0, 'image/Hue.mean:types/string': 0, 'image/Hue.mean:types/object': 0, 'image/Hue.mean:cardinality/est': 1.0, 'image/Hue.mean:cardinality/upper_1': 1.000049929250618, 'image/Hue.mean:cardinality/lower_1': 1.0, 'image/Hue.mean:distribution/mean': 0.0, 'image/Hue.mean:distribution/stddev': 0.0, 'image/Hue.mean:distribution/n': 1, 'image/Hue.mean:distribution/max': 0.0, 'image/Hue.mean:distribution/min': 0.0, 'image/Hue.mean:distribution/q_01': 0.0, 'image/Hue.mean:distribution/q_05': 0.0, 'image/Hue.mean:distribution/q_10': 0.0, 'image/Hue.mean:distribution/q_25': 0.0, 'image/Hue.mean:distribution/median': 0.0, 'image/Hue.mean:distribution/q_75': 0.0, 'image/Hue.mean:distribution/q_90': 0.0, 'image/Hue.mean:distribution/q_95': 0.0, 'image/Hue.mean:distribution/q_99': 0.0, 'image/Hue.stddev:counts/n': 1, 'image/Hue.stddev:counts/null': 0, 'image/Hue.stddev:types/integral': 0, 'image/Hue.stddev:types/fractional': 1, 'image/Hue.stddev:types/boolean': 0, 'image/Hue.stddev:types/string': 0, 'image/Hue.stddev:types/object': 0, 'image/Hue.stddev:cardinality/est': 1.0, 'image/Hue.stddev:cardinality/upper_1': 1.000049929250618, 'image/Hue.stddev:cardinality/lower_1': 1.0, 'image/Hue.stddev:distribution/mean': 0.0, 'image/Hue.stddev:distribution/stddev': 0.0, 'image/Hue.stddev:distribution/n': 1, 'image/Hue.stddev:distribution/max': 0.0, 'image/Hue.stddev:distribution/min': 0.0, 'image/Hue.stddev:distribution/q_01': 0.0, 'image/Hue.stddev:distribution/q_05': 0.0, 'image/Hue.stddev:distribution/q_10': 0.0, 'image/Hue.stddev:distribution/q_25': 0.0, 'image/Hue.stddev:distribution/median': 0.0, 'image/Hue.stddev:distribution/q_75': 0.0, 'image/Hue.stddev:distribution/q_90': 0.0, 'image/Hue.stddev:distribution/q_95': 0.0, 'image/Hue.stddev:distribution/q_99': 0.0, 'image/Saturation.mean:counts/n': 1, 'image/Saturation.mean:counts/null': 0, 'image/Saturation.mean:types/integral': 0, 'image/Saturation.mean:types/fractional': 1, 'image/Saturation.mean:types/boolean': 0, 'image/Saturation.mean:types/string': 0, 'image/Saturation.mean:types/object': 0, 'image/Saturation.mean:cardinality/est': 1.0, 'image/Saturation.mean:cardinality/upper_1': 1.000049929250618, 'image/Saturation.mean:cardinality/lower_1': 1.0, 'image/Saturation.mean:distribution/mean': 0.0, 'image/Saturation.mean:distribution/stddev': 0.0, 'image/Saturation.mean:distribution/n': 1, 'image/Saturation.mean:distribution/max': 0.0, 'image/Saturation.mean:distribution/min': 0.0, 'image/Saturation.mean:distribution/q_01': 0.0, 'image/Saturation.mean:distribution/q_05': 0.0, 'image/Saturation.mean:distribution/q_10': 0.0, 'image/Saturation.mean:distribution/q_25': 0.0, 'image/Saturation.mean:distribution/median': 0.0, 'image/Saturation.mean:distribution/q_75': 0.0, 'image/Saturation.mean:distribution/q_90': 0.0, 'image/Saturation.mean:distribution/q_95': 0.0, 'image/Saturation.mean:distribution/q_99': 0.0, 'image/Saturation.stddev:counts/n': 1, 'image/Saturation.stddev:counts/null': 0, 'image/Saturation.stddev:types/integral': 0, 'image/Saturation.stddev:types/fractional': 1, 'image/Saturation.stddev:types/boolean': 0, 'image/Saturation.stddev:types/string': 0, 'image/Saturation.stddev:types/object': 0, 'image/Saturation.stddev:cardinality/est': 1.0, 'image/Saturation.stddev:cardinality/upper_1': 1.000049929250618, 'image/Saturation.stddev:cardinality/lower_1': 1.0, 'image/Saturation.stddev:distribution/mean': 0.0, 'image/Saturation.stddev:distribution/stddev': 0.0, 'image/Saturation.stddev:distribution/n': 1, 'image/Saturation.stddev:distribution/max': 0.0, 'image/Saturation.stddev:distribution/min': 0.0, 'image/Saturation.stddev:distribution/q_01': 0.0, 'image/Saturation.stddev:distribution/q_05': 0.0, 'image/Saturation.stddev:distribution/q_10': 0.0, 'image/Saturation.stddev:distribution/q_25': 0.0, 'image/Saturation.stddev:distribution/median': 0.0, 'image/Saturation.stddev:distribution/q_75': 0.0, 'image/Saturation.stddev:distribution/q_90': 0.0, 'image/Saturation.stddev:distribution/q_95': 0.0, 'image/Saturation.stddev:distribution/q_99': 0.0, 'image/Brightness.mean:counts/n': 1, 'image/Brightness.mean:counts/null': 0, 'image/Brightness.mean:types/integral': 0, 'image/Brightness.mean:types/fractional': 1, 'image/Brightness.mean:types/boolean': 0, 'image/Brightness.mean:types/string': 0, 'image/Brightness.mean:types/object': 0, 'image/Brightness.mean:cardinality/est': 1.0, 'image/Brightness.mean:cardinality/upper_1': 1.000049929250618, 'image/Brightness.mean:cardinality/lower_1': 1.0, 'image/Brightness.mean:distribution/mean': 44.71923828125, 'image/Brightness.mean:distribution/stddev': 0.0, 'image/Brightness.mean:distribution/n': 1, 'image/Brightness.mean:distribution/max': 44.71923828125, 'image/Brightness.mean:distribution/min': 44.71923828125, 'image/Brightness.mean:distribution/q_01': 44.71923828125, 'image/Brightness.mean:distribution/q_05': 44.71923828125, 'image/Brightness.mean:distribution/q_10': 44.71923828125, 'image/Brightness.mean:distribution/q_25': 44.71923828125, 'image/Brightness.mean:distribution/median': 44.71923828125, 'image/Brightness.mean:distribution/q_75': 44.71923828125, 'image/Brightness.mean:distribution/q_90': 44.71923828125, 'image/Brightness.mean:distribution/q_95': 44.71923828125, 'image/Brightness.mean:distribution/q_99': 44.71923828125, 'image/Brightness.stddev:counts/n': 1, 'image/Brightness.stddev:counts/null': 0, 'image/Brightness.stddev:types/integral': 0, 'image/Brightness.stddev:types/fractional': 1, 'image/Brightness.stddev:types/boolean': 0, 'image/Brightness.stddev:types/string': 0, 'image/Brightness.stddev:types/object': 0, 'image/Brightness.stddev:cardinality/est': 1.0, 'image/Brightness.stddev:cardinality/upper_1': 1.000049929250618, 'image/Brightness.stddev:cardinality/lower_1': 1.0, 'image/Brightness.stddev:distribution/mean': 25.719757982712743, 'image/Brightness.stddev:distribution/stddev': 0.0, 'image/Brightness.stddev:distribution/n': 1, 'image/Brightness.stddev:distribution/max': 25.719757982712743, 'image/Brightness.stddev:distribution/min': 25.719757982712743, 'image/Brightness.stddev:distribution/q_01': 25.719757982712743, 'image/Brightness.stddev:distribution/q_05': 25.719757982712743, 'image/Brightness.stddev:distribution/q_10': 25.719757982712743, 'image/Brightness.stddev:distribution/q_25': 25.719757982712743, 'image/Brightness.stddev:distribution/median': 25.719757982712743, 'image/Brightness.stddev:distribution/q_75': 25.719757982712743, 'image/Brightness.stddev:distribution/q_90': 25.719757982712743, 'image/Brightness.stddev:distribution/q_95': 25.719757982712743, 'image/Brightness.stddev:distribution/q_99': 25.719757982712743}\n"
]
}
],
"source": [
"no_pii_config = ImageMetricConfig(forbidden_exif_tags={\"Artist\"})\n",
"no_pii_schema = DatasetSchema(resolvers=ImageResolver(), default_configs=no_pii_config)\n",
"results = log_image(img3, schema=no_pii_schema)\n",
"print(results.view().get_column(\"image\").to_summary_dict())"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "VlBQ2ypRiQ6u"
},
"source": [
"## Logging to Whylabs\n",
"\n",
"The profiles produced by `log_image()` or `log()` with a `DatasetSchema` that includes an `ImageMetric` can be sent to whylabs just like any whylogs profile. Edit this cell to use the organization and model ID you setup when you created your whylabs account."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "CEarSjfdiuRs"
},
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
"from datetime import datetime\n",
"from typing import Dict\n",
"\n",
"from whylogs.api.writer.whylabs import WhyLabsWriter\n",
"\n",
"# set your org-id here - should be something like \"org-xxxx\"\n",
"os.environ[\"WHYLABS_DEFAULT_ORG_ID\"] = \"org-XXXX\"\n",
"\n",
"# set your datased_id (or model_id) here - should be something like \"model-xxxx\"\n",
"os.environ[\"WHYLABS_DEFAULT_DATASET_ID\"] = \"model-XXXX\"\n",
"\n",
"# set your API key here\n",
"print(\"Enter your WhyLabs API key\")\n",
"os.environ[\"WHYLABS_API_KEY\"] = getpass.getpass()\n",
"print(\"Using API Key ID: \", os.environ[\"WHYLABS_API_KEY\"][0:10])\n",
"\n",
"profile = log_image(img3, schema=no_pii_schema).profile()\n",
"profile.set_dataset_timestamp(datetime.now())\n",
"view = profile.view()\n",
"\n",
"writer = WhyLabsWriter()\n",
"writer.write(profile=view)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "FOKXVxCwmR9A"
},
"source": [
"Each tracked EXIF tag becomes a feature when viewed in the whylabs profile."
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}