{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "692f8c386f9743a1a12f7d6c7959ca67": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_3e0f188e73294f6ea4d1e28640cfdc22", "IPY_MODEL_b754e18c5c49499d92db4803cfa426b7", "IPY_MODEL_6743cbc5ca2c47e7be565e0d6cd933c9" ], "layout": "IPY_MODEL_02aa2c49f2a94a7eb48794ed783c93e8" } }, "3e0f188e73294f6ea4d1e28640cfdc22": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ad84c0ed082d4ab7abf2815fc1910efa", "placeholder": "", "style": "IPY_MODEL_87a18840cc2c45ac824e8fe3d83d5150", "value": "Fetching 21 files: 100%" } }, "b754e18c5c49499d92db4803cfa426b7": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_0b3b4fc0e99a47d0a494aee20166337f", "max": 21, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_2de24c12eebd4054a3e6163fb6951986", "value": 21 } }, "6743cbc5ca2c47e7be565e0d6cd933c9": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_1c9af9a39e594c689590d09ae71baeb3", "placeholder": "", "style": "IPY_MODEL_182cc15b918a45d081543a6b3f182a07", "value": " 21/21 [00:00<00:00, 20.35it/s]" } }, "02aa2c49f2a94a7eb48794ed783c93e8": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "ad84c0ed082d4ab7abf2815fc1910efa": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "87a18840cc2c45ac824e8fe3d83d5150": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "0b3b4fc0e99a47d0a494aee20166337f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2de24c12eebd4054a3e6163fb6951986": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "1c9af9a39e594c689590d09ae71baeb3": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "182cc15b918a45d081543a6b3f182a07": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "cells": [ { "cell_type": "markdown", "source": [ "### Install libraries\n", "**Make sure to restart the Colab runtime after installation**\n", "\n", "Colab Menu -> Runtime -> Restart runtime" ], "metadata": { "id": "t8BYG2CFF6wD" } }, { "cell_type": "code", "source": [ "!pip install open_clip_torch transformers" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "nUAkSVJ90DQs", "outputId": "7f3d4fdb-8cab-4269-d10f-0e03c6e882d1" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", "Requirement already satisfied: open_clip_torch in /usr/local/lib/python3.9/dist-packages (2.16.2)\n", "Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (4.28.1)\n", "Requirement already satisfied: huggingface-hub in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.13.4)\n", "Requirement already satisfied: ftfy in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (6.1.1)\n", "Requirement already satisfied: torch>=1.9.0 in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (2.0.0+cu118)\n", "Requirement already satisfied: timm in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.6.13)\n", "Requirement already satisfied: torchvision in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.15.1+cu118)\n", "Requirement already satisfied: regex in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (2022.10.31)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (4.65.0)\n", "Requirement already satisfied: protobuf<4 in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (3.20.3)\n", "Requirement already satisfied: sentencepiece in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.1.98)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.9/dist-packages (from transformers) (6.0)\n", "Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.9/dist-packages (from transformers) (0.13.3)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.9/dist-packages (from transformers) (3.11.0)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from transformers) (2.27.1)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.9/dist-packages (from transformers) (1.22.4)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.9/dist-packages (from transformers) (23.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.9/dist-packages (from huggingface-hub->open_clip_torch) (4.5.0)\n", "Requirement already satisfied: networkx in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (3.1)\n", "Requirement already satisfied: jinja2 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (3.1.2)\n", "Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (2.0.0)\n", "Requirement already satisfied: sympy in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (1.11.1)\n", "Requirement already satisfied: lit in /usr/local/lib/python3.9/dist-packages (from triton==2.0.0->torch>=1.9.0->open_clip_torch) (16.0.1)\n", "Requirement already satisfied: cmake in /usr/local/lib/python3.9/dist-packages (from triton==2.0.0->torch>=1.9.0->open_clip_torch) (3.25.2)\n", "Requirement already satisfied: wcwidth>=0.2.5 in /usr/local/lib/python3.9/dist-packages (from ftfy->open_clip_torch) (0.2.6)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (2022.12.7)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (3.4)\n", "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (1.26.15)\n", "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (2.0.12)\n", "Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.9/dist-packages (from torchvision->open_clip_torch) (8.4.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/dist-packages (from jinja2->torch>=1.9.0->open_clip_torch) (2.1.2)\n", "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.9/dist-packages (from sympy->torch>=1.9.0->open_clip_torch) (1.3.0)\n" ] } ] }, { "cell_type": "markdown", "source": [ "## Load BiomedCLIP model" ], "metadata": { "id": "kaOyeKkjqnri" } }, { "cell_type": "code", "source": [ "import open_clip\n", "\n", "model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224')\n", "tokenizer = open_clip.get_tokenizer('hf-hub:microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "V8Yv9g_8EQ1W", "outputId": "3ec24c9b-4c4f-4c17-8d76-6cfd74bb8bdf" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "Some weights of the model checkpoint at microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract were not used when initializing BertModel: ['bert.pooler.dense.bias', 'cls.predictions.bias', 'bert.pooler.dense.weight', 'cls.seq_relationship.bias', 'cls.predictions.decoder.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.seq_relationship.weight', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias']\n", "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" ] } ] }, { "cell_type": "markdown", "source": [ "# Download sample images" ], "metadata": { "id": "bk0hm1R7qqU_" } }, { "cell_type": "code", "source": [ "from huggingface_hub import snapshot_download\n", "snapshot_download(\"microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224\", local_dir=\"biomed-clip-share\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 67, "referenced_widgets": [ "692f8c386f9743a1a12f7d6c7959ca67", "3e0f188e73294f6ea4d1e28640cfdc22", "b754e18c5c49499d92db4803cfa426b7", "6743cbc5ca2c47e7be565e0d6cd933c9", "02aa2c49f2a94a7eb48794ed783c93e8", "ad84c0ed082d4ab7abf2815fc1910efa", "87a18840cc2c45ac824e8fe3d83d5150", "0b3b4fc0e99a47d0a494aee20166337f", "2de24c12eebd4054a3e6163fb6951986", "1c9af9a39e594c689590d09ae71baeb3", "182cc15b918a45d081543a6b3f182a07" ] }, "id": "qqafKW1kqgc4", "outputId": "34c29f78-32c5-4a6f-914e-30e8a07840a6" }, "execution_count": null, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Fetching 21 files: 0%| | 0/21 [00:00, ?it/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "692f8c386f9743a1a12f7d6c7959ca67" } }, "metadata": {} }, { "output_type": "execute_result", "data": { "text/plain": [ "'/content/biomed-clip-share'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 9 } ] }, { "cell_type": "code", "source": [ "!ls biomed-clip-share" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4WOxBdKr0e_m", "outputId": "2a05beae-6f5f-4c3c-ef59-b23210b6e1b5" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "biomed_clip_example.ipynb models\t\t\tspecial_tokens_map.json\n", "biomed-vlp-eval.svg\t open_clip_config.json\ttokenizer_config.json\n", "example_data\t\t open_clip_pytorch_model.bin\ttokenizer.json\n", "LICENSE.md\t\t README.md\t\t\tvocab.txt\n" ] } ] }, { "cell_type": "markdown", "source": [ "### Example: Zero-shot classifications" ], "metadata": { "id": "_11A5zFuGfkG" } }, { "cell_type": "code", "source": [ "import glob\n", "from collections import OrderedDict\n", "\n", "import torch\n", "from PIL import Image\n", "import open_clip\n", "\n", "dataset_path = 'biomed-clip-share/example_data/biomed_image_classification_example_data'\n", "template = 'this is a photo of '\n", "labels = [\n", " 'adenocarcinoma histopathology',\n", " 'brain MRI',\n", " 'covid line chart',\n", " 'squamous cell carcinoma histopathology',\n", " 'immunohistochemistry histopathology',\n", " 'bone X-ray',\n", " 'chest X-ray',\n", " 'pie chart',\n", " 'hematoxylin and eosin histopathology'\n", "]\n", "\n", "test_imgs = glob.glob(dataset_path + '/*')\n", "\n", "device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')\n", "model.to(device)\n", "model.eval()\n", "\n", "context_length = 256\n", "\n", "images = torch.stack([preprocess_val(Image.open(img)) for img in test_imgs]).to(device)\n", "texts = tokenizer([template + l for l in labels], context_length=context_length).to(device)\n", "with torch.no_grad():\n", " image_features, text_features, logit_scale = model(images, texts)\n", "\n", " logits = (logit_scale * image_features @ text_features.t()).detach().softmax(dim=-1)\n", " sorted_indices = torch.argsort(logits, dim=-1, descending=True)\n", "\n", " logits = logits.cpu().numpy()\n", " sorted_indices = sorted_indices.cpu().numpy()\n", "\n", "top_k = -1\n", "\n", "for i, img in enumerate(test_imgs):\n", " pred = labels[sorted_indices[i][0]]\n", "\n", " top_k = len(labels) if top_k == -1 else top_k\n", " print(img.split('/')[-1] + ':')\n", " for j in range(top_k):\n", " jth_index = sorted_indices[i][j]\n", " print(f'{labels[jth_index]}: {logits[i][jth_index]}')\n", " print('\\n')" ], "metadata": { "id": "XSJw7Qpm1w-f", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "c8e69acc-09a6-41ac-a719-e0c2016e41d8" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "pie_chart.png:\n", "pie chart: 0.999992847442627\n", "covid line chart: 6.056918664398836e-06\n", "brain MRI: 6.21218759988551e-07\n", "bone X-ray: 1.8702671411574556e-07\n", "chest X-ray: 1.4315841667666973e-07\n", "immunohistochemistry histopathology: 7.397970591682679e-08\n", "hematoxylin and eosin histopathology: 1.3329820802709946e-08\n", "adenocarcinoma histopathology: 7.695367898463701e-09\n", "squamous cell carcinoma histopathology: 4.512842100012904e-09\n", "\n", "\n", "adenocarcinoma_histopathology.jpg:\n", "adenocarcinoma histopathology: 0.7818871140480042\n", "hematoxylin and eosin histopathology: 0.15517646074295044\n", "immunohistochemistry histopathology: 0.061494842171669006\n", "squamous cell carcinoma histopathology: 0.0014182098675519228\n", "chest X-ray: 2.017213228100445e-05\n", "brain MRI: 1.2181627653262694e-06\n", "pie chart: 7.932726475701202e-07\n", "bone X-ray: 7.436452165165974e-07\n", "covid line chart: 4.482610336253856e-07\n", "\n", "\n", "bone_X-ray.jpg:\n", "bone X-ray: 0.9037958383560181\n", "hematoxylin and eosin histopathology: 0.07279340922832489\n", "brain MRI: 0.01353507861495018\n", "chest X-ray: 0.008212118409574032\n", "immunohistochemistry histopathology: 0.001647905446588993\n", "squamous cell carcinoma histopathology: 1.4188163731887471e-05\n", "covid line chart: 1.135158640863665e-06\n", "adenocarcinoma histopathology: 2.3802228099611966e-07\n", "pie chart: 9.433299652528149e-08\n", "\n", "\n", "H_and_E_histopathology.jpg:\n", "hematoxylin and eosin histopathology: 0.795325756072998\n", "immunohistochemistry histopathology: 0.19779936969280243\n", "chest X-ray: 0.005973866209387779\n", "bone X-ray: 0.0008049175376072526\n", "adenocarcinoma histopathology: 9.133945422945544e-05\n", "squamous cell carcinoma histopathology: 3.642375759227434e-06\n", "brain MRI: 6.688670168841782e-07\n", "pie chart: 4.278801952750655e-07\n", "covid line chart: 3.05161016456168e-08\n", "\n", "\n", "covid_line_chart.png:\n", "covid line chart: 0.949320912361145\n", "adenocarcinoma histopathology: 0.01898209936916828\n", "squamous cell carcinoma histopathology: 0.017550114542245865\n", "immunohistochemistry histopathology: 0.006791798863559961\n", "hematoxylin and eosin histopathology: 0.0034173529129475355\n", "brain MRI: 0.0026299136225134134\n", "chest X-ray: 0.0010041164932772517\n", "bone X-ray: 0.00024685743846930563\n", "pie chart: 5.681204129359685e-05\n", "\n", "\n", "IHC_histopathology.jpg:\n", "immunohistochemistry histopathology: 0.9465930461883545\n", "hematoxylin and eosin histopathology: 0.032324690371751785\n", "brain MRI: 0.020657381042838097\n", "adenocarcinoma histopathology: 0.00030473514925688505\n", "bone X-ray: 4.573518890538253e-05\n", "squamous cell carcinoma histopathology: 3.1508847314398736e-05\n", "covid line chart: 2.0559591575874947e-05\n", "chest X-ray: 1.2715485354419798e-05\n", "pie chart: 9.55287669057725e-06\n", "\n", "\n", "brain_MRI.jpg:\n", "brain MRI: 0.9565796852111816\n", "hematoxylin and eosin histopathology: 0.041418083012104034\n", "immunohistochemistry histopathology: 0.001945042866282165\n", "pie chart: 2.715110167628154e-05\n", "squamous cell carcinoma histopathology: 1.022376545734005e-05\n", "bone X-ray: 8.66248501552036e-06\n", "chest X-ray: 7.967616511450615e-06\n", "adenocarcinoma histopathology: 2.7691876312019303e-06\n", "covid line chart: 3.420062455461448e-07\n", "\n", "\n", "chest_X-ray.jpg:\n", "chest X-ray: 0.9998347759246826\n", "hematoxylin and eosin histopathology: 0.0001205605294671841\n", "bone X-ray: 4.112880560569465e-05\n", "immunohistochemistry histopathology: 1.0486444352864055e-06\n", "adenocarcinoma histopathology: 9.66637117016944e-07\n", "covid line chart: 9.508941616331867e-07\n", "brain MRI: 3.2324109611181484e-07\n", "squamous cell carcinoma histopathology: 2.5336956355204165e-07\n", "pie chart: 3.6984038054299617e-09\n", "\n", "\n", "squamous_cell_carcinoma_histopathology.jpeg:\n", "squamous cell carcinoma histopathology: 0.9469490647315979\n", "adenocarcinoma histopathology: 0.05259014666080475\n", "hematoxylin and eosin histopathology: 0.000398839358240366\n", "immunohistochemistry histopathology: 6.187919643707573e-05\n", "chest X-ray: 1.4099568623748837e-08\n", "pie chart: 3.5225011796313765e-10\n", "bone X-ray: 2.963370659969655e-10\n", "brain MRI: 1.2720478836936167e-10\n", "covid line chart: 1.8425710176378507e-12\n", "\n", "\n" ] } ] }, { "cell_type": "markdown", "source": [ "
\n", "adenocarcinoma_histopathology.jpg:\n", "adenocarcinoma histopathology: 0.7818863987922668\n", "hematoxylin and eosin histopathology: 0.15517690777778625\n", "immunohistochemistry histopathology: 0.06149514392018318\n", "squamous cell carcinoma histopathology: 0.0014182085869833827\n", "chest X-ray: 2.017213228100445e-05\n", "brain MRI: 1.2181524198240368e-06\n", "pie chart: 7.932688959044754e-07\n", "bone X-ray: 7.436410101036017e-07\n", "covid line chart: 4.482610052036762e-07\n", "\n", "\n", "covid_line_chart.png:\n", "covid line chart: 0.9493210315704346\n", "adenocarcinoma histopathology: 0.01898195780813694\n", "squamous cell carcinoma histopathology: 0.0175501499325037\n", "immunohistochemistry histopathology: 0.006791787222027779\n", "hematoxylin and eosin histopathology: 0.003417333820834756\n", "brain MRI: 0.002629919210448861\n", "chest X-ray: 0.0010041205678135157\n", "bone X-ray: 0.00024685842799954116\n", "pie chart: 5.6812208640621975e-05\n", "\n", "\n", "bone_X-ray.jpg:\n", "bone X-ray: 0.9037961959838867\n", "hematoxylin and eosin histopathology: 0.07279316335916519\n", "brain MRI: 0.013534954749047756\n", "chest X-ray: 0.00821212213486433\n", "immunohistochemistry histopathology: 0.001647887285798788\n", "squamous cell carcinoma histopathology: 1.418814281350933e-05\n", "covid line chart: 1.1351590956110158e-06\n", "adenocarcinoma histopathology: 2.3802124360372545e-07\n", "pie chart: 9.433303205241828e-08\n", "\n", "\n", "pie_chart.png:\n", "pie chart: 0.999992847442627\n", "covid line chart: 6.056906840967713e-06\n", "brain MRI: 6.212158041307703e-07\n", "bone X-ray: 1.870277799298492e-07\n", "chest X-ray: 1.4315827456812258e-07\n", "immunohistochemistry histopathology: 7.397970591682679e-08\n", "hematoxylin and eosin histopathology: 1.3329795045535775e-08\n", "adenocarcinoma histopathology: 7.695367898463701e-09\n", "squamous cell carcinoma histopathology: 4.512833662317917e-09\n", "\n", "\n", "H_and_E_histopathology.jpg:\n", "hematoxylin and eosin histopathology: 0.7953251600265503\n", "immunohistochemistry histopathology: 0.19779996573925018\n", "chest X-ray: 0.005973907187581062\n", "bone X-ray: 0.0008049230673350394\n", "adenocarcinoma histopathology: 9.133991261478513e-05\n", "squamous cell carcinoma histopathology: 3.6423973597266013e-06\n", "brain MRI: 6.688684948130685e-07\n", "pie chart: 4.278819574210502e-07\n", "covid line chart: 3.051619401617245e-08\n", "\n", "\n", "brain_MRI.jpg:\n", "brain MRI: 0.9565795660018921\n", "hematoxylin and eosin histopathology: 0.041418157517910004\n", "immunohistochemistry histopathology: 0.0019450499676167965\n", "pie chart: 2.7151252652402036e-05\n", "squamous cell carcinoma histopathology: 1.0223812751064543e-05\n", "bone X-ray: 8.662499567435589e-06\n", "chest X-ray: 7.96773747424595e-06\n", "adenocarcinoma histopathology: 2.7692055937222904e-06\n", "covid line chart: 3.420084908611898e-07\n", "\n", "\n", "chest_X-ray.jpg:\n", "chest X-ray: 0.9998347759246826\n", "hematoxylin and eosin histopathology: 0.0001205605294671841\n", "bone X-ray: 4.112880560569465e-05\n", "immunohistochemistry histopathology: 1.0486423889233265e-06\n", "adenocarcinoma histopathology: 9.66637117016944e-07\n", "covid line chart: 9.508977996119938e-07\n", "brain MRI: 3.232386518448038e-07\n", "squamous cell carcinoma histopathology: 2.53368597213921e-07\n", "pie chart: 3.6984038054299617e-09\n", "\n", "\n", "squamous_cell_carcinoma_histopathology.jpeg:\n", "squamous cell carcinoma histopathology: 0.9469489455223083\n", "adenocarcinoma histopathology: 0.05259034037590027\n", "hematoxylin and eosin histopathology: 0.0003988408425357193\n", "immunohistochemistry histopathology: 6.187965482240543e-05\n", "chest X-ray: 1.4099594380923008e-08\n", "pie chart: 3.522500624519864e-10\n", "bone X-ray: 2.9633814846441453e-10\n", "brain MRI: 1.2720452469139332e-10\n", "covid line chart: 1.8425603924565603e-12\n", "\n", "\n", "IHC_histopathology.jpg:\n", "immunohistochemistry histopathology: 0.9465934634208679\n", "hematoxylin and eosin histopathology: 0.03232448548078537\n", "brain MRI: 0.020657211542129517\n", "adenocarcinoma histopathology: 0.000304735847748816\n", "bone X-ray: 4.5735167077509686e-05\n", "squamous cell carcinoma histopathology: 3.150868360535242e-05\n", "covid line chart: 2.0559578842949122e-05\n", "chest X-ray: 1.2715442608168814e-05\n", "pie chart: 9.55282575887395e-06\n", "\n", "