{"id":18305042,"url":"https://github.com/mdbloice/patch-augmentation","last_synced_at":"2025-07-04T13:06:27.554Z","repository":{"id":109495423,"uuid":"213658417","full_name":"mdbloice/Patch-Augmentation","owner":"mdbloice","description":"Code for the implemenation of the Patch Augmentation technique","archived":false,"fork":false,"pushed_at":"2019-11-28T15:02:24.000Z","size":18904,"stargazers_count":11,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T16:36:41.171Z","etag":null,"topics":["image-augmentation","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/mdbloice.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-08T14:02:15.000Z","updated_at":"2024-09-07T16:02:51.000Z","dependencies_parsed_at":"2023-05-01T22:31:52.622Z","dependency_job_id":null,"html_url":"https://github.com/mdbloice/Patch-Augmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdbloice/Patch-Augmentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbloice%2FPatch-Augmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbloice%2FPatch-Augmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbloice%2FPatch-Augmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbloice%2FPatch-Augmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdbloice","download_url":"https://codeload.github.com/mdbloice/Patch-Augmentation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdbloice%2FPatch-Augmentation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263548653,"owners_count":23478807,"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":["image-augmentation","machine-learning"],"created_at":"2024-11-05T15:32:21.328Z","updated_at":"2025-07-04T13:06:27.546Z","avatar_url":"https://github.com/mdbloice.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Patch Augmentation\n*Patch Augmentation* is an novel image augmentation technique designed to improve model generalisation and mitigate against adversarial attacks.\n\nFor details, see the following pre-print: **Patch augmentation: Towards efficient decision boundaries for neural networks**, *arXiv:1911.07922*, Nov. 2019, \u003chttps://arxiv.org/abs/1911.07922\u003e\n\n## How it works\n\n*Patch Augmentation* is a data-independent approach that creates new image data based on image/label pairs, where a patch from one of the two images in the pair is superimposed on to the other image, creating a new augmented sample. \n\nBelow is a visual example of the technique:\n\n![examples-random-patches-cropped.jpg](./DemoImages/examples-random-patches-cropped.jpg)\n\nThe augmented image label is a combination of the image pair's original labels. The labels for the dog and cat classes are `[1.0, 0.0]` and `[0.0, 1.0]` respectively. Clockwise from the upper left, the augmented image's labels are `[0.72220625, 0.27779375]`, `[0.2832, 0.7168]`, `[0.0, 1.0]`, and `[0.918925, 0.081075]` respectively.\n\nA notebook containing a reproducible experiment (training ResNet20v1 using the CIFAR-100 data set) can be found in the following notebook:\n\n[Patch-Augmentation-CIFAR-100.ipynb](Patch-Augmentation-CIFAR-100.ipynb)\n\nIn the notebook above, *Patch Augmentation* improves a baseline accuracy of about 45% to over 61%.\n\nThe table below shows the technique being applied to several data sets and network architectures (test set accuracy):\n\n| Dataset       | Model      | No Augmentation | Patch Augmentation  |\n|---------------|------------|-----------------|---------------------|\n| CIFAR-10      | ResNet20v1 | 80.86%          | **89.33%**          |\n|               | ResNet29v2 | 83.15%          | **91.19%**          |\n| CIFAR-100     | ResNet20v1 | 44.08%          | **61.41%**          |\n|               | ResNet29v2 | 52.21%          | **68.06%**          |\n\n## Robustness Against Adversarial Attacks\n\nInitial experiments show networks trained with *Patch Augmentation* are more robust to adversarial attacks, see the following notebook for details:\n\n[Adversarial-Examples.ipynb](Adversarial-Examples.ipynb)\n\nUsing the Fast Gradient Sign Method to create adversarial examples, the network trained with *Patch Augmentation* had an accuracy of 72.5% versus 64.3% compared to the network trained without augmentation.\n\n## Publication\nPublication in review.\n\nPre-print available here: **Patch augmentation: Towards efficient decision boundaries for neural networks**, *arXiv:1911.07922*, Nov. 2019, \u003chttps://arxiv.org/abs/1911.07922\u003e\n\nRepository made public on the 25th of October 2019.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdbloice%2Fpatch-augmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdbloice%2Fpatch-augmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdbloice%2Fpatch-augmentation/lists"}