{"id":15065051,"url":"https://github.com/waterviewsrl/swiss-army-keras","last_synced_at":"2025-10-05T01:31:30.324Z","repository":{"id":57472751,"uuid":"412480360","full_name":"waterviewsrl/swiss-army-keras","owner":"waterviewsrl","description":"A library to help with the development of AI models with Keras, with a focus on edge / IoT applications. Based originally on https://github.com/yingkaisha/keras-unet-collection","archived":false,"fork":true,"pushed_at":"2023-02-21T14:16:19.000Z","size":17281,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-28T08:59:50.953Z","etag":null,"topics":["albumentations","classification","coral-tpu","deeplab-v3-plus","deeplabv3","edge","edge-ai","edgetpu","efficientnet-lite","iot","keras","neural-network","quantization","segmentation","tensorflow2","tf-data","tf-trt","tflite","unet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"yingkaisha/keras-unet-collection","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waterviewsrl.png","metadata":{"files":{"readme":"README-keras-unet-collection.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-10-01T13:37:43.000Z","updated_at":"2023-01-16T08:16:26.000Z","dependencies_parsed_at":"2023-07-19T03:01:22.004Z","dependency_job_id":"984d7d49-c808-40dc-94ed-fb20ab8f136f","html_url":"https://github.com/waterviewsrl/swiss-army-keras","commit_stats":{"total_commits":285,"total_committers":5,"mean_commits":57.0,"dds":0.5859649122807018,"last_synced_commit":"5213edd3246a6029f91f3e6434739cc54e68cbf6"},"previous_names":["desmoteo/swiss-army-keras"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/waterviewsrl/swiss-army-keras","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterviewsrl%2Fswiss-army-keras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterviewsrl%2Fswiss-army-keras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterviewsrl%2Fswiss-army-keras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterviewsrl%2Fswiss-army-keras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waterviewsrl","download_url":"https://codeload.github.com/waterviewsrl/swiss-army-keras/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterviewsrl%2Fswiss-army-keras/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399628,"owners_count":25980330,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["albumentations","classification","coral-tpu","deeplab-v3-plus","deeplabv3","edge","edge-ai","edgetpu","efficientnet-lite","iot","keras","neural-network","quantization","segmentation","tensorflow2","tf-data","tf-trt","tflite","unet"],"created_at":"2024-09-25T00:30:09.854Z","updated_at":"2025-10-05T01:31:28.507Z","avatar_url":"https://github.com/waterviewsrl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keras-unet-collection\n\n[![PyPI version](https://badge.fury.io/py/keras-unet-collection.svg)](https://badge.fury.io/py/keras-unet-collection)\n[![PyPI license](https://img.shields.io/pypi/l/keras-unet-collection.svg)](https://pypi.org/project/keras-unet-collection/)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/yingkaisha/keras-unet-collection/graphs/commit-activity)\n\n[![DOI](https://zenodo.org/badge/323426984.svg)](https://zenodo.org/badge/latestdoi/323426984)\n\nThe `tensorflow.keras` implementation of U-net, V-net, U-net++, UNET 3+, Attention U-net, R2U-net, ResUnet-a, U^2-Net, TransUNET, and Swin-UNET with optional ImageNet-trained backbones.\n\n----------\n\n`swiss_army_keras.models` contains functions that configure keras models with hyper-parameter options. \n\n* Pre-trained ImageNet backbones are supported for U-net, U-net++, UNET 3+, Attention U-net, and TransUNET.\n* Deep supervision is supported for U-net++, UNET 3+, and U^2-Net.\n* See the [User guide](https://github.com/yingkaisha/keras-unet-collection/blob/main/examples/user_guide_models.ipynb) for other options and use cases.\n\n| `swiss_army_keras.models` | Name | Reference |\n|:---------------|:----------------|:----------------|\n| `unet_2d`      | U-net           | [Ronneberger et al. (2015)](https://link.springer.com/chapter/10.1007/978-3-319-24574-4_28) |\n| `vnet_2d`      | V-net (modified for 2-d inputs) | [Milletari et al. (2016)](https://arxiv.org/abs/1606.04797) |\n| `unet_plus_2d` | U-net++         | [Zhou et al. (2018)](https://link.springer.com/chapter/10.1007/978-3-030-00889-5_1) |\n| `r2_unet_2d`   | R2U-Net         | [Alom et al. (2018)](https://arxiv.org/abs/1802.06955) |\n| `att_unet_2d`  | Attention U-net | [Oktay et al. (2018)](https://arxiv.org/abs/1804.03999) |\n| `resunet_a_2d` | ResUnet-a       | [Diakogiannis et al. (2020)](https://doi.org/10.1016/j.isprsjprs.2020.01.013) |\n| `u2net_2d`     | U^2-Net         | [Qin et al. (2020)](https://arxiv.org/abs/2005.09007) |\n| `unet_3plus_2d` | UNET 3+        | [Huang et al. (2020)](https://arxiv.org/abs/2004.08790) |\n| `transunet_2d` | TransUNET       | [Chen et al. (2021)](https://arxiv.org/abs/2102.04306) |\n| `swin_unet_2d` | Swin-UNET       | [Hu et al. (2021)](https://arxiv.org/abs/2105.05537) |\n\n**Note**: the two Transformer models are incompatible with `Numpy 1.20`; `NumPy 1.19.5` is recommended.\n\n----------\n\n` swiss_army_keras.base` contains functions that build the base architecture (i.e., without model heads) of Unet variants for model customization and debugging.\n\n| ` swiss_army_keras.base` | Notes |\n|:-----------------------------------|:------|\n| `unet_2d_base`, `vnet_2d_base`, `unet_plus_2d_base`, `unet_3plus_2d_base`, `att_unet_2d_base`, `r2_unet_2d_base`, `resunet_a_2d_base`, `u2net_2d_base`, `transunet_2d_base`, `swin_unet_2d_base` | Functions that accept an input tensor and hyper-parameters of the corresponded model, and produce output tensors of the base architecture. |\n\n----------\n\n`swiss_army_keras.activations` and `swiss_army_keras.losses` provide additional activation layers and loss functions.\n\n| `swiss_army_keras.activations` | Name | Reference |\n|:--------|:----------------|:----------------|\n| `GELU`  | Gaussian Error Linear Units (GELU)   | [Hendrycks et al. (2016)](https://arxiv.org/abs/1606.08415) |\n| `Snake` | Snake activation                     | [Liu et al. (2020)](https://arxiv.org/abs/2006.08195) |\n\n| `swiss_army_keras.losses` | Name | Reference |\n|:----------------|:----------------|:----------------|\n| `dice`          | Dice loss                      | [Sudre et al. (2017)](https://link.springer.com/chapter/10.1007/978-3-319-67558-9_28) |\n| `tversky`       | Tversky loss                   | [Hashemi et al. (2018)](https://ieeexplore.ieee.org/abstract/document/8573779) |\n| `focal_tversky` | Focal Tversky loss             | [Abraham et al. (2019)](https://ieeexplore.ieee.org/abstract/document/8759329) |\n| `ms_ssim`       | Multi-scale Structural Similarity Index loss | [Wang et al. (2003)](https://ieeexplore.ieee.org/abstract/document/1292216) |\n| `iou_seg`       | Intersection over Union (IoU) loss for segmentation | [Rahman and Wang (2016)](https://link.springer.com/chapter/10.1007/978-3-319-50835-1_22) |\n| `iou_box`       | (Generalized) IoU loss for object detection | [Rezatofighi et al. (2019)](https://openaccess.thecvf.com/content_CVPR_2019/html/Rezatofighi_Generalized_Intersection_Over_Union_A_Metric_and_a_Loss_for_CVPR_2019_paper.html) |\n| `triplet_1d`    | Semi-hard triplet loss (experimental) | |\n| `crps2d_tf`     | CRPS loss (experimental)       | |\n\n# Installation and usage\n\n```pip install keras-unet-collection```\n\n```python\nfrom swiss_army_keras import models\n# e.g. models.unet_2d(...)\n```\n* **Note**: Currently supported backbone models are: `VGG[16,19]`, `ResNet[50,101,152]`, `ResNet[50,101,152]V2`, `DenseNet[121,169,201]`, and `EfficientNetB[0-7]`. See [Keras Applications](https://keras.io/api/applications/) for details. \n\n* **Note**: Neural networks produced by this package may contain customized layers that are not part of the Tensorflow. It is reommended to save and load model weights.\n\n* [Changelog](https://github.com/yingkaisha/keras-unet-collection/blob/main/CHANGELOG.md)\n\n# Examples\n\n* Jupyter notebooks are provided as [examples](https://github.com/yingkaisha/keras-unet-collection/tree/main/examples):\n\n  * Attention U-net with VGG16 backbone [[link]](https://github.com/yingkaisha/keras-unet-collection/blob/main/examples/human-seg_atten-unet-backbone_coco.ipynb).\n  \n  * UNET 3+ with deep supervision, classification-guided module, and hybrid loss [[link]](https://github.com/yingkaisha/keras-unet-collection/blob/main/examples/segmentation_unet-three-plus_oxford-iiit.ipynb).\n\n  * Vision-Transformer-based examples are in progress, and available at [**keras-vision-transformer**](https://github.com/yingkaisha/keras-vision-transformer)\n\n# Dependencies\n\n* TensorFlow 2.5.0, Keras 2.5.0, Numpy 1.19.5.\n\n* (Optional for examples) Pillow, matplotlib, etc.\n\n# Overview\n\nU-net is a convolutional neural network with encoder-decoder architecture and skip-connections, loosely defined under the concept of \"fully convolutional networks.\" U-net was originally proposed for the semantic segmentation of medical images and is modified for solving a wider range of gridded learning problems.\n\nU-net and many of its variants take three or four-dimensional tensors as inputs and produce outputs of the same shape. One technical highlight of these models is the skip-connections from downsampling to upsampling layers, which benefit the reconstruction of high-resolution, gridded outputs.\n\n# Contact\n\nYingkai (Kyle) Sha \u003c\u003cyingkai@eoas.ubc.ca\u003e\u003e \u003c\u003cyingkaisha@gmail.com\u003e\u003e\n\n# License\n\n[MIT License](https://github.com/yingkaisha/keras-unet/blob/main/LICENSE)\n\n# Citation\n\n* Sha, Y., 2021: Keras-unet-collection. GitHub repository, accessed 4 September 2021, https://doi.org/10.5281/zenodo.5449801\n\n```\n@misc{keras-unet-collection,\n  author = {Sha, Yingkai},\n  title = {Keras-unet-collection},\n  year = {2021},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/yingkaisha/keras-unet-collection}},\n  doi = {10.5281/zenodo.5449801}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaterviewsrl%2Fswiss-army-keras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaterviewsrl%2Fswiss-army-keras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaterviewsrl%2Fswiss-army-keras/lists"}