{"id":20068230,"url":"https://github.com/phtrempe/netception","last_synced_at":"2025-07-12T14:34:44.101Z","repository":{"id":57445622,"uuid":"96044703","full_name":"PhTrempe/netception","owner":"PhTrempe","description":"A neural network inception library","archived":false,"fork":false,"pushed_at":"2017-07-04T00:12:38.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-12T14:45:10.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhTrempe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-02T19:32:55.000Z","updated_at":"2017-07-03T22:56:11.000Z","dependencies_parsed_at":"2022-09-26T17:30:53.166Z","dependency_job_id":null,"html_url":"https://github.com/PhTrempe/netception","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/PhTrempe/netception","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhTrempe%2Fnetception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhTrempe%2Fnetception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhTrempe%2Fnetception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhTrempe%2Fnetception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhTrempe","download_url":"https://codeload.github.com/PhTrempe/netception/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhTrempe%2Fnetception/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265003946,"owners_count":23696328,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T14:05:51.941Z","updated_at":"2025-07-12T14:34:44.085Z","avatar_url":"https://github.com/PhTrempe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"http://gdurl.com/g-tt\" width=\"540\"\u003e\n\u003c/div\u003e\n\n# Netception\n\n## Description\n\nNetception is a neural network inception library developed \nin Python 3 and used with Keras.\n\n## How to Install\n\n```\npip install netception\n```\n\n## Dependencies\n\nHere are Netception's required dependencies.\n\n* `numpy`\n* `keras`\n\nHere are some optional dependencies one might need.\n\n* `h5py` (to load and save Keras models stored in files)\n* `pillow` (to manipulate images)\n\nAlso note that Keras requires a backend library like TensorFlow to operate.\n\n```\npip install tensorflow\n```\n\nIf GPU support is desired, it is also possible to use the GPU version of \nTensorFlow.\n\n```\npip install tensorflow-gpu\n```\n\n## An Exhaustively Commented Example to Get You Started\n\n```python\nimport os\n\nfrom PIL import Image\nfrom keras import applications, backend\n\nfrom netception.inceptor import Inceptor\nfrom netception.utils.visualization_util import VisualizationUtil\n\n\nif __name__ == \"__main__\":\n    # Load the model to incept\n    # (Here, we load the pretrained VGG16 model from Keras)\n    model = applications.VGG16()\n\n    # Print the model's summary to see its layers\n    model.summary()\n\n    # Determine the target to incept within the model\n    # (Here, we choose to incept the output of the 455th filter of the\n    # convolutional layer \"block5_conv3\")\n    target = model.get_layer(\"block5_conv3\").output[:, :, :, 455]\n\n    # Create an inceptor and configure it\n    # (Here, we create an inceptor with our model and target. We also set an\n    # inception rate of 0.25, a maximal number of steps of 50, and parameters\n    # for early stopping if the inception score stops improving enough)\n    inceptor = Inceptor(\n        model=model,\n        target=target,\n        inception_rate=0.5,\n        max_steps=200,\n        improvement_check_interval=5,\n        improvement_threshold=0.05\n    )\n\n    # Run the inceptor\n    inception, score = inceptor.incept()\n\n    # Convert the resulting inception into image data\n    image_data = VisualizationUtil.inception_to_bytes(\n        inception=inception,\n        colorfulness=0.15\n    )\n\n    # Create an image from the image data, and resize the image\n    image = Image.fromarray(image_data).resize((512, 512), Image.BICUBIC)\n\n    # Show the image\n    image.show()\n\n    # Save the image\n    script_dir = os.path.dirname(os.path.realpath(__file__))\n    image.save(os.path.join(script_dir, \"inception.png\"))\n\n    # Clear the backend session\n    backend.clear_session()\n\n```\n\nThis is what the result looks like.\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"http://gdurl.com/XWya\" width=\"512\"\u003e\n\u003c/div\u003e\n\n## The Same Example In Compact Form For a Quick Copy \u0026 Paste\n\n```python\nimport os\n\nfrom PIL import Image\nfrom keras import applications, backend\n\nfrom netception.inceptor import Inceptor\nfrom netception.utils.visualization_util import VisualizationUtil\n\n\nif __name__ == \"__main__\":\n    model = applications.VGG16()\n    model.summary()\n    target = model.get_layer(\"block5_conv3\").output[:, :, :, 455]\n    inceptor = Inceptor(model, target, 0.5, 200, 5, 0.05)\n    inception, score = inceptor.incept()\n    image_data = VisualizationUtil.inception_to_bytes(inception, 0.15)\n    image = Image.fromarray(image_data).resize((512, 512), Image.BICUBIC)\n    image.show()\n    script_dir = os.path.dirname(os.path.realpath(__file__))\n    image.save(os.path.join(script_dir, \"inception.png\"))\n    backend.clear_session()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphtrempe%2Fnetception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphtrempe%2Fnetception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphtrempe%2Fnetception/lists"}