Skip to content

Instantly share code, notes, and snippets.

@leoimpett
Created January 12, 2023 12:18
Show Gist options
  • Save leoimpett/df3695225fb4b70310b103267fda6276 to your computer and use it in GitHub Desktop.
Save leoimpett/df3695225fb4b70310b103267fda6276 to your computer and use it in GitHub Desktop.
Autogenerated from www.imagegraph.cc, My sketch title
{"caption":"My sketch title","offset":{"x":0,"y":0},"nodes":{"49697015-d6a0-4165-bc1a-2e783334599e":{"id":"49697015-d6a0-4165-bc1a-2e783334599e","position":{"x":305,"y":186},"type":"loadIIIFManifest","ports":{"port1":{"id":"port1","type":"bottom","properties":{"type":"imL"},"position":{"x":24,"y":107}}},"properties":{"text":"Loads a IIIF manifest. Paste in any IIIF manifest URL, which you can get from most libraries. ","form":"string","innerDefault":"https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json","viewer":"https://universalviewer.io/uv.html?manifest=","innerValue":"https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json"}},"4363d967-fa60-4a34-b2ab-0ba732d20a44":{"id":"4363d967-fa60-4a34-b2ab-0ba732d20a44","position":{"x":404,"y":316},"type":"getNNEmbedding","ports":{"port1":{"id":"port1","type":"top","properties":{"type":"imL"},"position":{"x":24,"y":-12}},"port2":{"id":"port2","type":"bottom","properties":{"type":"vL"},"position":{"x":24,"y":60}}},"properties":{"text":"Extracts the second-to-last-layer neural network embedding for each image fed in; outputs them as a list of vectors","form":"none","colabform":"True","preform":"myModel = \"vgg16\" #@param [\"vgg16\", \"inceptionv3\", \"efficientnet\"]","argform":"modelType = myModel"}},"ccb411b9-75cd-4ac2-a67f-0ad036168ed2":{"id":"ccb411b9-75cd-4ac2-a67f-0ad036168ed2","position":{"x":456,"y":435},"type":"reduceDims","ports":{"port1":{"id":"port1","type":"top","properties":{"type":"vL"},"position":{"x":24,"y":-12}},"port2":{"id":"port2","type":"bottom","properties":{"type":"fL"},"position":{"x":24,"y":60}},"port3":{"id":"port3","type":"bottom","properties":{"type":"fL"},"position":{"x":156,"y":60}}},"properties":{"text":"Reduce dimensions to 2 using TSNE, UMAP, or PCA. ","form":"none","colabform":"True","preform":"myMethod = \"TSNE\" #@param [\"TSNE\", \"UMAP\", \"PCA\"]","argform":"method = myMethod"}},"a722a7bc-6e35-4173-9c30-152ad4807138":{"id":"a722a7bc-6e35-4173-9c30-152ad4807138","position":{"x":401,"y":573},"type":"scatterImages","ports":{"port1":{"id":"port1","type":"top","properties":{"type":"imL"},"position":{"x":24,"y":-12}},"port2":{"id":"port2","type":"top","properties":{"type":"fL"},"position":{"x":90,"y":-12}},"port3":{"id":"port3","type":"top","properties":{"type":"fL"},"position":{"x":156,"y":-12}}},"properties":{"text":"A *direct visualization* of an image list on an x-y grid. ","form":"none"}}},"selected":{"type":"node","id":"4363d967-fa60-4a34-b2ab-0ba732d20a44"},"links":{"43e4a429-8af1-44ac-a195-f0d7ca483ee9":{"id":"43e4a429-8af1-44ac-a195-f0d7ca483ee9","from":{"nodeId":"49697015-d6a0-4165-bc1a-2e783334599e","portId":"port1"},"to":{"nodeId":"4363d967-fa60-4a34-b2ab-0ba732d20a44","portId":"port1"}},"28598d0d-78f1-4682-9cbc-bec095933ee2":{"id":"28598d0d-78f1-4682-9cbc-bec095933ee2","from":{"nodeId":"4363d967-fa60-4a34-b2ab-0ba732d20a44","portId":"port2"},"to":{"nodeId":"ccb411b9-75cd-4ac2-a67f-0ad036168ed2","portId":"port1"}},"12e5812f-da34-4c02-9fc1-bc961b0a1970":{"id":"12e5812f-da34-4c02-9fc1-bc961b0a1970","from":{"nodeId":"ccb411b9-75cd-4ac2-a67f-0ad036168ed2","portId":"port2"},"to":{"nodeId":"a722a7bc-6e35-4173-9c30-152ad4807138","portId":"port2"}},"8c91381c-1441-4127-b00c-7d675c74ac41":{"id":"8c91381c-1441-4127-b00c-7d675c74ac41","from":{"nodeId":"ccb411b9-75cd-4ac2-a67f-0ad036168ed2","portId":"port3"},"to":{"nodeId":"a722a7bc-6e35-4173-9c30-152ad4807138","portId":"port3"}},"5a46e11a-ede0-4a9e-863c-45aa3e2a9fc2":{"id":"5a46e11a-ede0-4a9e-863c-45aa3e2a9fc2","from":{"nodeId":"49697015-d6a0-4165-bc1a-2e783334599e","portId":"port1"},"to":{"nodeId":"a722a7bc-6e35-4173-9c30-152ad4807138","portId":"port1"}}},"hovered":{}}
Display the source blob
Display the rendered blob
Raw
{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "ImageGraph.ipynb", "version": "0.3.2", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" } }, "cells": [ { "cell_type": "code", "metadata": { "id": "gsUbIGfNqSjV", "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", "height": 34 }, "outputId": "a306f9c8-c721-4280-fba4-f175cffa7090" }, "source": [ " !pip install -q -U git+https:\/\/github.com\/leoimpett\/pyimagegraph\nimport imagegraph as ig\nimL00 = ig.loadIIIFManifest(\"https:\/\/iiif.bodleian.ox.ac.uk\/iiif\/manifest\/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json\")\nmyModel = \"vgg16\" #@param [\"vgg16\", \"inceptionv3\", \"efficientnet\"]\nvL01 = ig.getNNEmbedding(imL00,modelType = myModel)\nmyMethod = \"TSNE\" #@param [\"TSNE\", \"UMAP\", \"PCA\"]\nfL02,fL03 = ig.reduceDims(vL01,method = myMethod)\n_ = ig.scatterImages(imL00,fL02,fL03) " ], "execution_count": 0, "outputs": [ { "output_type": "stream", "text": [ " " ], "name": "stdout" } ] } ]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment