From cbd460ec15b1efe87804f1028716416a9b10886c Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Wed, 11 May 2022 15:25:14 +0100 Subject: [PATCH] Rename model catalog entries (#248) * rename models * update notebook to refelct catalog changes * increment version --- examples/scivision-core-functionality.ipynb | 62 ++++++++++----------- scivision/catalog/data/models.json | 4 +- setup.py | 2 +- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/scivision-core-functionality.ipynb b/examples/scivision-core-functionality.ipynb index f8a765db..6f0a6c09 100644 --- a/examples/scivision-core-functionality.ipynb +++ b/examples/scivision-core-functionality.ipynb @@ -38,7 +38,7 @@ "\n", "A scivision catalog is a collection of **models** and **datasources**.\n", "\n", - "For this example, we want to find datasources compatible with the model catalog entry \"scivision_classifier\". But first, let's use the catalog to retrive the \"scivision_classifier\" repository url and take a look at the data contained in the *default catalog* (the built-in catalog, distributed as part of scivision) and see how this is structured." + "For this example, we want to find datasources compatible with the model catalog entry \"image-classifiers\". But first, let's use the catalog to retrive the \"image-classifiers\" repository url and take a look at the data contained in the *default catalog* (the built-in catalog, distributed as part of scivision) and see how this is structured." ] }, { @@ -60,7 +60,7 @@ "source": [ "# Get the model repo url\n", "models_catalog = default_catalog.models.to_dataframe()\n", - "model_repo = models_catalog[models_catalog.name == \"scivision_classifier\"].url.item()\n", + "model_repo = models_catalog[models_catalog.name == \"image-classifiers\"].url.item()\n", "model_repo # Why not paste the repo link into your browser and see how it looks?" ] }, @@ -105,7 +105,7 @@ " \n", " \n", " 8\n", - " scivision_classifier\n", + " image-classifiers\n", " None\n", " (TaskEnum.classificiation,)\n", " https://github.com/alan-turing-institute/scivi...\n", @@ -121,8 +121,8 @@ "" ], "text/plain": [ - " name description tasks \\\n", - "8 scivision_classifier None (TaskEnum.classificiation,) \n", + " name description tasks \\\n", + "8 image-classifiers None (TaskEnum.classificiation,) \n", "\n", " url \\\n", "8 https://github.com/alan-turing-institute/scivi... \n", @@ -141,7 +141,7 @@ ], "source": [ "# Inspecting model entry and its metadata in the default catalog\n", - "models_catalog[models_catalog.name == \"scivision_classifier\"]" + "models_catalog[models_catalog.name == \"image-classifiers\"]" ] }, { @@ -150,7 +150,7 @@ "source": [ "## Loading the model\n", "\n", - "Some model entries in the scivision catalog contain a single loadable model. Here, let's load the \"scivision_classifier\" entry, which contains each of the models in the [image-classifiers](https://pypi.org/project/image-classifiers/) package. We can do this with the `load_pretrained_model` function. We'll load 2 models (\"resnet18\" and \"densenet121\"), making sure to set the `allow_install` arg to True the first time `load_pretrained_model` is called (note the \"model\" arg is not mandatory and will have a default value for any model catalog entries that have more than one model - for model catalog entries with a single model, this need not be set):" + "Some model entries in the scivision catalog contain a single loadable model. Here, let's load the \"image-classifiers\" entry, which contains each of the models in the [image-classifiers](https://pypi.org/project/image-classifiers/) package. We can do this with the `load_pretrained_model` function. We'll load 2 models (\"resnet18\" and \"densenet121\"), making sure to set the `allow_install` arg to True the first time `load_pretrained_model` is called (note the \"model\" arg is not mandatory and will have a default value for any model catalog entries that have more than one model - for model catalog entries with a single model, this need not be set):" ] }, { @@ -163,14 +163,14 @@ "output_type": "stream", "text": [ "Collecting scivision_classifier\n", - " Cloning https://github.com/alan-turing-institute/scivision_classifier (to revision main) to /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-rxpk_viw/scivision-classifier_19d0d355635f407e9fe031ef64533cc0\n" + " Cloning https://github.com/alan-turing-institute/scivision_classifier (to revision main) to /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-12ttdzvt/scivision-classifier_7004fcecb5334c47b6cb2eae4803b6c3\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - " Running command git clone --filter=blob:none --quiet https://github.com/alan-turing-institute/scivision_classifier /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-rxpk_viw/scivision-classifier_19d0d355635f407e9fe031ef64533cc0\n" + " Running command git clone --filter=blob:none --quiet https://github.com/alan-turing-institute/scivision_classifier /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-12ttdzvt/scivision-classifier_7004fcecb5334c47b6cb2eae4803b6c3\n" ] }, { @@ -183,8 +183,8 @@ "Building wheels for collected packages: scivision_classifier\n", " Building wheel for scivision_classifier (setup.py): started\n", " Building wheel for scivision_classifier (setup.py): finished with status 'done'\n", - " Created wheel for scivision_classifier: filename=scivision_classifier-0.0.1-py3-none-any.whl size=3883 sha256=b12a86b66e85c0d4b8debda47ca5cda62221951bf8ba5eba8526222fa3d32ac3\n", - " Stored in directory: /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-ephem-wheel-cache-h25btjdh/wheels/af/27/f9/5c32ecec2f2682373da54294d060008ca1d046e18d74187784\n", + " Created wheel for scivision_classifier: filename=scivision_classifier-0.0.1-py3-none-any.whl size=3883 sha256=4fc051cf088067bf79e11d01db304d4e002e7a663284ea549a5cb039ad4f1521\n", + " Stored in directory: /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-ephem-wheel-cache-7_rxr2ez/wheels/af/27/f9/5c32ecec2f2682373da54294d060008ca1d046e18d74187784\n", "Successfully built scivision_classifier\n", "Installing collected packages: scivision_classifier\n", " Attempting uninstall: scivision_classifier\n", @@ -387,7 +387,7 @@ } ], "source": [ - "compatible_datasources = default_catalog.compatible_datasources(\"scivision_classifier\").to_dataframe()\n", + "compatible_datasources = default_catalog.compatible_datasources(\"image-classifiers\").to_dataframe()\n", "compatible_datasources" ] }, @@ -920,7 +920,7 @@ "Coordinates:\n", " * y (y) int64 0 1 2 3 4 5 6 7 8 ... 231 232 233 234 235 236 237 238 239\n", " * x (x) int64 0 1 2 3 4 5 6 7 8 ... 253 254 255 256 257 258 259 260 261\n", - " * channel (channel) int64 0 1 2" ], "text/plain": [ "\n", @@ -1045,7 +1045,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 13, @@ -1240,7 +1240,7 @@ " \n", " \n", " 8\n", - " scivision_classifier\n", + " image-classifiers\n", " None\n", " (TaskEnum.classificiation,)\n", " https://github.com/alan-turing-institute/scivi...\n", @@ -1253,7 +1253,7 @@ " \n", " \n", " 9\n", - " scivision_huggingface\n", + " huggingface-classifiers\n", " None\n", " (TaskEnum.classificiation,)\n", " https://github.com/alan-turing-institute/scivi...\n", @@ -1269,14 +1269,14 @@ "" ], "text/plain": [ - " name description \\\n", - "0 model-000 None \n", - "1 model-001 None \n", - "4 scivision-test-plugin None \n", - "5 mapreader-plant automated detection of plant patches in images... \n", - "6 resnet50-plantkton automated classification of plankton images co... \n", - "8 scivision_classifier None \n", - "9 scivision_huggingface None \n", + " name description \\\n", + "0 model-000 None \n", + "1 model-001 None \n", + "4 scivision-test-plugin None \n", + "5 mapreader-plant automated detection of plant patches in images... \n", + "6 resnet50-plantkton automated classification of plankton images co... \n", + "8 image-classifiers None \n", + "9 huggingface-classifiers None \n", "\n", " tasks \\\n", "0 (TaskEnum.object_detection, TaskEnum.segmentat... \n", @@ -1338,7 +1338,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The `scivision_huggingface` catalog entry can be used to load some of the most popular image classification models from [Hugging Face](https://huggingface.co/models?pipeline_tag=image-classification&sort=downloads). See the list of included models in the [model repo](https://github.com/alan-turing-institute/scivision_huggingface). As before, let's load one of the named models and run it on our test image:" + "The `huggingface-classifiers` catalog entry can be used to load some of the most popular image classification models from [Hugging Face](https://huggingface.co/models?pipeline_tag=image-classification&sort=downloads). See the list of included models in the [model repo](https://github.com/alan-turing-institute/scivision_huggingface). As before, let's load one of the named models and run it on our test image:" ] }, { @@ -1351,14 +1351,14 @@ "output_type": "stream", "text": [ "Collecting scivision_huggingface\n", - " Cloning https://github.com/alan-turing-institute/scivision_huggingface (to revision main) to /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-2e3d9ms4/scivision-huggingface_b64d98ce9a5c4bf08b45917d70b30ecf\n" + " Cloning https://github.com/alan-turing-institute/scivision_huggingface (to revision main) to /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-56tpd_1p/scivision-huggingface_5812e68de5c54f73889ae7ce50486097\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - " Running command git clone --filter=blob:none --quiet https://github.com/alan-turing-institute/scivision_huggingface /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-2e3d9ms4/scivision-huggingface_b64d98ce9a5c4bf08b45917d70b30ecf\n" + " Running command git clone --filter=blob:none --quiet https://github.com/alan-turing-institute/scivision_huggingface /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-install-56tpd_1p/scivision-huggingface_5812e68de5c54f73889ae7ce50486097\n" ] }, { @@ -1371,8 +1371,8 @@ "Building wheels for collected packages: scivision_huggingface\n", " Building wheel for scivision_huggingface (setup.py): started\n", " Building wheel for scivision_huggingface (setup.py): finished with status 'done'\n", - " Created wheel for scivision_huggingface: filename=scivision_huggingface-0.0.1-py3-none-any.whl size=3817 sha256=6cc49b09ae48bed70862bcda01bf83899539eeb1e7da07ba0579f432fcbeef4e\n", - " Stored in directory: /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-ephem-wheel-cache-7y7ve25i/wheels/58/43/19/be5a260399f14abe94dbcffed3df890b92e52dc026f56e3ec2\n", + " Created wheel for scivision_huggingface: filename=scivision_huggingface-0.0.1-py3-none-any.whl size=3817 sha256=8a036189b9f92358eb27bc1709617dbc35a27fdbe70256d558960867597e0c4d\n", + " Stored in directory: /private/var/folders/kf/72snt1z56h56smb3y7c0dxpr9rwb6q/T/pip-ephem-wheel-cache-p3bnj_5g/wheels/58/43/19/be5a260399f14abe94dbcffed3df890b92e52dc026f56e3ec2\n", "Successfully built scivision_huggingface\n", "Installing collected packages: scivision_huggingface\n", " Attempting uninstall: scivision_huggingface\n", @@ -1392,7 +1392,7 @@ } ], "source": [ - "huggingface_repo = models_catalog[models_catalog.name == \"scivision_huggingface\"].url.item()\n", + "huggingface_repo = models_catalog[models_catalog.name == \"huggingface-classifiers\"].url.item()\n", "microsoft_model = load_pretrained_model(huggingface_repo, allow_install=True, model='microsoft_swin_tiny_patch4_window7_224')" ] }, diff --git a/scivision/catalog/data/models.json b/scivision/catalog/data/models.json index ed01285f..ae459410 100644 --- a/scivision/catalog/data/models.json +++ b/scivision/catalog/data/models.json @@ -94,7 +94,7 @@ "tags": ["2D", "satellite", "remote-sensing", "ecology", "environmental-science"] }, { - "name":"scivision_classifier", + "name":"image-classifiers", "tasks":["classification"], "url":"https://github.com/alan-turing-institute/scivision_classifier", "pkg_url":"git+https://github.com/alan-turing-institute/scivision_classifier.git@main", @@ -105,7 +105,7 @@ "tags": ["classification", "2D", "image"] }, { - "name":"scivision_huggingface", + "name":"huggingface-classifiers", "tasks":["classification"], "url":"https://github.com/alan-turing-institute/scivision_huggingface", "pkg_url":"git+https://github.com/alan-turing-institute/scivision_huggingface.git@main", diff --git a/setup.py b/setup.py index 0f233738..e90994a4 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name="scivision", - version="0.2.7", + version="0.2.8", description="scivision", author="The Alan Turing Institute", author_email="scivision@turing.ac.uk",