Skip to content

Instantly share code, notes, and snippets.

@phivk
Created September 5, 2022 21:18
Show Gist options
  • Save phivk/f31ff741dbb7d3882c32ffd1785d5fbe to your computer and use it in GitHub Desktop.
Save phivk/f31ff741dbb7d3882c32ffd1785d5fbe to your computer and use it in GitHub Desktop.
Autogenerated from www.imagegraph.cc, My sketch title
{"caption":"My sketch title","offset":{"x":-17,"y":-142},"nodes":{"129140b9-8f5b-42a3-8391-62f7fe1a89b0":{"id":"129140b9-8f5b-42a3-8391-62f7fe1a89b0","position":{"x":657,"y":341},"type":"loadIIIFManifest","ports":{"port1":{"id":"port1","type":"bottom","properties":{"type":"imL"},"position":{"x":24,"y":108}}},"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"}},"92a64402-e4eb-4846-aa10-ffdfa0cc89bd":{"id":"92a64402-e4eb-4846-aa10-ffdfa0cc89bd","position":{"x":657,"y":518},"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"}},"c0dc0e30-7879-4e0b-8fec-d160331cb252":{"id":"c0dc0e30-7879-4e0b-8fec-d160331cb252","position":{"x":658,"y":643},"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"}},"f8b4064a-f5bf-4f24-9367-583d8f1d326f":{"id":"f8b4064a-f5bf-4f24-9367-583d8f1d326f","position":{"x":1080,"y":534},"type":"viewSingleImage","ports":{"port1":{"id":"port1","type":"top","properties":{"type":"imL"},"position":{"x":24,"y":-12}},"port2":{"id":"port2","type":"top","properties":{"type":"f"},"position":{"x":156,"y":-12}}},"properties":{"text":"View one image from the list; use insertFloat to select a single image. ","form":"none"}}},"selected":{"type":"node","id":"f8b4064a-f5bf-4f24-9367-583d8f1d326f"},"links":{"9efa5e00-5062-42b4-bcbe-3169057119e9":{"id":"9efa5e00-5062-42b4-bcbe-3169057119e9","from":{"nodeId":"129140b9-8f5b-42a3-8391-62f7fe1a89b0","portId":"port1"},"to":{"nodeId":"92a64402-e4eb-4846-aa10-ffdfa0cc89bd","portId":"port1"}},"cc77c078-97c2-42b2-adbb-953325e2558c":{"id":"cc77c078-97c2-42b2-adbb-953325e2558c","from":{"nodeId":"92a64402-e4eb-4846-aa10-ffdfa0cc89bd","portId":"port2"},"to":{"nodeId":"c0dc0e30-7879-4e0b-8fec-d160331cb252","portId":"port1"}},"e89bf856-4122-45ea-bfe6-ceae439e5604":{"id":"e89bf856-4122-45ea-bfe6-ceae439e5604","from":{"nodeId":"129140b9-8f5b-42a3-8391-62f7fe1a89b0","portId":"port1"},"to":{"nodeId":"f8b4064a-f5bf-4f24-9367-583d8f1d326f","portId":"port1"}},"b05518a3-e246-4ba6-8e02-30015b8aadd9":{"id":"b05518a3-e246-4ba6-8e02-30015b8aadd9","from":{"nodeId":"f8b4064a-f5bf-4f24-9367-583d8f1d326f","portId":"port2"},"to":{}}},"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) " ], "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