{ "info": { "author": "Sergiusz Bleja", "author_email": "duckgoose@bleja.org", "bugtrack_url": null, "classifiers": [], "description": "# duckgoose\nUtility scripts for the online [fast.ai](www.fast.ai) course. There are two main parts: one to download and organise arbitrary image classes, and one to highlight what parts of an image is activating the decision for a classification.\n\n1. Utility for Lesson 1 experimentation with external image classes. The script:\n* Downloads images from google images for specific classes\n* Sanity checks that images can be opened and have three channels\n* Organises the images into separate folders (train/valid/test + classes) as expected by the fast.ai library\n\n2. Utility for creating Class Activation Maps for both classifications.\n\n## Prerequisites \n\n* `chromedriver` is required. On ubuntu/debian: `sudo apt-get chromium-chromedriver`\n\n## Installation\n\n```python\npip install duckgoose\n```\n\n## Usage\n\n### Fetching, sanity checking and organising images\n\n```python\nfrom duckgoose import fetchImagesAndPrepForClassification\n\n# dictionary structure `class_name => search term`\nimage_classes = { 'ducks' : 'ducks -rubber' , 'geese' : 'geese' }\ndownload_path = '/home/myuser/data/downloaded_from_google'\noutput_path = '/home/myuser/data/ducksgeese/'\nnumber_of_images = 100\n\nfetchImagesAndPrepForClassification(image_classes, download_path, output_path, number_of_images)\n```\n\n### Create Class Activation Maps (CAM)\n*Note*: This was implemented for fastai v2 part 1.\nHere is a full example of creating a class activation maps for ducks and geese using fast ai. \n\n```python\nfrom fastai.imports import *\nfrom fastai.transforms import *\nfrom fastai.conv_learner import *\nfrom fastai.model import *\nfrom fastai.dataset import *\nfrom fastai.sgdr import *\nfrom fastai.plots import *\n\nfrom duckgoose.cam import calculateAndChartHeatZoneFor\n\nPATH = \"data/ducksgeese/\"\nsz=224\narch = resnet34\nbs = 64\n\nm = arch(True)\nm = nn.Sequential(*children(m)[:-2], \n nn.Conv2d(512, 2, 3, padding=1), \n nn.AdaptiveAvgPool2d(1),\n Flatten(), \n nn.LogSoftmax())\n\ntfms = tfms_from_model(arch, sz, aug_tfms=transforms_side_on, max_zoom=1.1)\ndata = ImageClassifierData.from_paths(PATH, tfms=tfms, bs=bs)\nlearn = ConvLearner.from_model_data(m, data)\n\nlearn.freeze_to(-4)\n\n_, val_tfms = tfms_from_model(learn.model, sz)\n\nlearn.fit(0.01, 2)\n\ncalculateAndChartHeatZoneFor('./data/ducksgeese/test/ducks/ducks_427.jpg', val_tfms, learn)\n```\n\n![Duck and goose heatmap](images/duck.png)\n\n\n# License\n[The MIT License (MIT)](LICENSE.txt)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/svenski/duckgoose/archive/0.1.8.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/svenski/duckgoose", "keywords": "fastai,image-classification,deep-learning,class-activation-maps", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "duckgoose", "package_url": "https://pypi.org/project/duckgoose/", "platform": "", "project_url": "https://pypi.org/project/duckgoose/", "project_urls": { "Download": "https://github.com/svenski/duckgoose/archive/0.1.8.tar.gz", "Homepage": "http://github.com/svenski/duckgoose" }, "release_url": "https://pypi.org/project/duckgoose/0.1.8/", "requires_dist": null, "requires_python": "", "summary": "Utility functions for the fast ai mooc", "version": "0.1.8" }, "last_serial": 5317368, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e2cd32746fa7ef8a317859f6e2fa2909", "sha256": "bdda975710253d3593d98b68cd49b324b9dc695c7fb9af6d1f8802e7bbf58ebb" }, "downloads": -1, "filename": "duckgoose-0.1.tar.gz", "has_sig": false, "md5_digest": "e2cd32746fa7ef8a317859f6e2fa2909", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2970, "upload_time": "2018-06-05T21:13:36", "url": "https://files.pythonhosted.org/packages/15/35/573e840256c755eb2d65d8a0eaf5cd4da532bd6c65a41e4433719e2d46e6/duckgoose-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c88afbd23a0f35fb27b1d82d519de37d", "sha256": "d17384b123fdbc4c4d2fb16d6d0281e2c3b7f114c88acf7eaa1b127e455b7139" }, "downloads": -1, "filename": "duckgoose-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c88afbd23a0f35fb27b1d82d519de37d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2961, "upload_time": "2018-06-06T18:14:12", "url": "https://files.pythonhosted.org/packages/77/52/9a072309cb77a97823af81420edfd411bd23fedcadb4108524f0d960cec5/duckgoose-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "06e9e99b634c411a869f495ededd4050", "sha256": "90970a2bd655728e90157a7b78421350bd8c5670406946b47d3f6cafe4de45ce" }, "downloads": -1, "filename": "duckgoose-0.1.2.tar.gz", "has_sig": false, "md5_digest": "06e9e99b634c411a869f495ededd4050", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2996, "upload_time": "2018-06-06T18:26:07", "url": "https://files.pythonhosted.org/packages/72/b4/f5a8936e6b3b96d9df3f5128c6481524b71312d5f588d5186d669969d5aa/duckgoose-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "80dc7aa03beda066faadcc4f2be64d66", "sha256": "2a91e763e5cdc1c0214a340fcc4be328cea8e0089d6924a5d320bea8d5760b2f" }, "downloads": -1, "filename": "duckgoose-0.1.3.tar.gz", "has_sig": false, "md5_digest": "80dc7aa03beda066faadcc4f2be64d66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3014, "upload_time": "2018-06-06T18:43:22", "url": "https://files.pythonhosted.org/packages/1e/18/d3264b81fdeec2ba816ddadfadef4c2f814f8fe3f8d65c3ffb7786553356/duckgoose-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "f049a9d36e47c9ae1a4fb6a585452bff", "sha256": "ba7a6f3cd72e7eb77a206144bc277686c5a056ca215457be8ca679add5485352" }, "downloads": -1, "filename": "duckgoose-0.1.4.tar.gz", "has_sig": false, "md5_digest": "f049a9d36e47c9ae1a4fb6a585452bff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3024, "upload_time": "2018-06-06T19:32:16", "url": "https://files.pythonhosted.org/packages/c6/ff/1db933e86a4da382fc80ff0281fe9bf67ee4e849af5f754486514a4050fa/duckgoose-0.1.4.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "96010b812ec73862c35df4d2aa00c91d", "sha256": "fe47fc71e2bc90710f0bfeeaa435fd28c3e6e7767ba63224ebb3a497d21680a7" }, "downloads": -1, "filename": "duckgoose-0.1.6.tar.gz", "has_sig": false, "md5_digest": "96010b812ec73862c35df4d2aa00c91d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4406, "upload_time": "2018-07-17T16:31:58", "url": "https://files.pythonhosted.org/packages/0e/dd/142b01aea80a2b888a208087050a87b7ad45bd2f614a21f7c6de699d7039/duckgoose-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "67fa87d2f0eaa283bcb6bc949a268246", "sha256": "4d05507c722d184ab5fe8878be9e98b448835c702b6456de356a5c26ecabda69" }, "downloads": -1, "filename": "duckgoose-0.1.7.tar.gz", "has_sig": false, "md5_digest": "67fa87d2f0eaa283bcb6bc949a268246", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5008, "upload_time": "2018-10-27T16:03:04", "url": "https://files.pythonhosted.org/packages/9a/13/8e9f336c0a69f883dac1b8c086525a4dca61a5c9a953704d209fd197e5c3/duckgoose-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "0f7577bb152ff4b318fb2596af565fb1", "sha256": "b767cb7d06c07febe6104956cb38eaa2bb447876d624010f3f99fd0cfc45cb91" }, "downloads": -1, "filename": "duckgoose-0.1.8.tar.gz", "has_sig": false, "md5_digest": "0f7577bb152ff4b318fb2596af565fb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5200, "upload_time": "2019-05-25T21:46:09", "url": "https://files.pythonhosted.org/packages/80/22/56e3dee6d7c3c78b420f3d28b1ee66eefb3e8a531275d8a77ae66ac4a95c/duckgoose-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0f7577bb152ff4b318fb2596af565fb1", "sha256": "b767cb7d06c07febe6104956cb38eaa2bb447876d624010f3f99fd0cfc45cb91" }, "downloads": -1, "filename": "duckgoose-0.1.8.tar.gz", "has_sig": false, "md5_digest": "0f7577bb152ff4b318fb2596af565fb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5200, "upload_time": "2019-05-25T21:46:09", "url": "https://files.pythonhosted.org/packages/80/22/56e3dee6d7c3c78b420f3d28b1ee66eefb3e8a531275d8a77ae66ac4a95c/duckgoose-0.1.8.tar.gz" } ] }