{"id":17987367,"url":"https://github.com/offchan42/superkeras","last_synced_at":"2025-03-25T22:32:03.424Z","repository":{"id":108171539,"uuid":"162369750","full_name":"offchan42/superkeras","owner":"offchan42","description":":rocket: A bunch of Keras utilities and paper implementations written under TensorFlow backend","archived":false,"fork":false,"pushed_at":"2024-03-02T00:00:36.000Z","size":93,"stargazers_count":9,"open_issues_count":5,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-03T00:39:08.625Z","etag":null,"topics":["helpers","keras","permutation","python3","tensorflow","utilities"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/offchan42.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}},"created_at":"2018-12-19T02:08:41.000Z","updated_at":"2023-02-25T16:49:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a470e74-c0ca-4e48-bc1c-f65d7d8d85bd","html_url":"https://github.com/offchan42/superkeras","commit_stats":null,"previous_names":["offchan42/superkeras"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offchan42%2Fsuperkeras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offchan42%2Fsuperkeras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offchan42%2Fsuperkeras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offchan42%2Fsuperkeras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/offchan42","download_url":"https://codeload.github.com/offchan42/superkeras/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222099533,"owners_count":16931433,"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":["helpers","keras","permutation","python3","tensorflow","utilities"],"created_at":"2024-10-29T19:08:37.513Z","updated_at":"2024-10-29T19:08:38.285Z","avatar_url":"https://github.com/offchan42.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# superkeras\n\nA bunch of Keras utilities and paper implementations written under TensorFlow backend\n\nIt is made to work nicely with `tensorflow.keras` and TensorFlow 2.0.\n\n## How to use\n\nDownload this repository and put it inside your project as a folder named `superkeras`.\n\nOne of the nice option is to do `git submodule add https://github.com/offchan42/superkeras` in order to download this repo\nand track it as a part of your Git repository because this repo is frequently updated.\n\nThen simply `import superkeras` to use all the functionalities provided. See more info below.\n\n### General utilities/helpers/extras\n\n- `import superkeras.layers` to use use functions and classes in the file. Contains some useful functions like:\n  - `repeat_layers` for creating multiple layers with the same type\n  - `apply_residual_block` function for building ResNet-like architecture, making the network able to learn without\n    degradation when the depth is very deep\n  - `BlurPool` antialiased layer to make ConvNet shift-invariant, also increase accuracy.\n    See https://github.com/adobe/antialiased-cnns\n  - `Arithmetic` layer for performing simple arithmetic operations on a trainable weight\n  - `NormalizeQuaternion` layer for normalizing Quaternion data to have magnitude of 1.\n  - and couple more utilities\n- `import superkeras.losses` to use loss functions (which can also be used as metrics)\n  - `r2_score` for computing r-squared score for regression problem.\n  - `mean_euclidean_distance` or `mean_euclidean_distance_squared` for computing\n    distance between 2 positions.\n  - `mean_quat_distance`, `mean_quat_angle`, `mean_quat_angle_deg`, and\n    `mean_sqr_quat_angle` are for computing Quaternion difference, must be used\n    with normalized quaternion (output of `NormalizeQuaternion` layer).\n  - `dice_loss`, `iou_coef`, and `dice_coef` are losses/metrics for image segmentation problems.\n- `import superkeras.datautil` to use utilities made for `tf.data` module\n- `import superkeras.utils` to use some helper functions not related to `keras` e.g. `make_xy_3d` for converting\n  a time-series `DataFrame` into a 3D data for ConvNets or LSTM.\n- `import superkeras.imgutils` to use helper functions for manipulating images e.g. cropping with zero padding.\n  Please check `Rect` class which helps you a lot in bounding box related manipulation.\n\n### Paper implementations\n\n- `import superkeras.permutational_layer` to use `PermutationalLayer`\n  model implemented accurately following the paper [Permutation-equivariant\n  neural networks applied to dynamics\n  prediction](https://arxiv.org/pdf/1612.04530.pdf). This layer is for modeling\n  problems that the order of the input objects are not important and that you\n  can swap/permute/re-order them and the prediction should stay the same,\n  preserving **Permutation Invariance** property. You can think of this as\n  modeling a `Set` data structure for the inputs of neural networks.\n\n  To use it without the need to understand too much details,\n  you can use `PermutationalModule`.\n\n  You can run the main code in the module to understand how it works intuitively.\n\n- `import superkeras.pointnet` to use `PointNet` architecture from the\n  [PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation](https://arxiv.org/abs/1612.00593) paper.\n  PointNet also allows modeling of permutation invariance problems, it's computationally cheaper than `PermutationalLayer`\n  for large amount of point instances.\n\n  You can run the main code in the module to understand how it practically works.\n\n## Tips\n\nYou can run `pytest` to run test files that have name starting with `test_`.\n\nFor any functions that are not mentioned here but exist in the file, you can use them.\nAll of the functions that are supposed to be usable usually have documentation written very good on them. So check that!\n\n## Troubleshooting\n\n- `ValueError: Unknown metric function:mean_quat_angle_deg`:\n\n  This error is caused by not providing the function to the model loader.\n  It usually happens when you save the Keras model to disk and trying to load it\n  using `keras.models.load_model` function.\n\n  To fix this, you need to provide `custom_objects` dictionary with string key\n  pointing to the function reference.\n  Example:\n\n  ```python\n  from superkeras.losses import mean_quat_angle_deg\n  from keras.models import load_model\n  model = load_model('model_path.h5', custom_objects=dict(mean_quat_angle_deg=mean_quat_angle_deg))\n  ```\n\n  There are many possible metric functions that this error can indicate.\n  Most of the functions live in `losses` and `layers` module.\n  So you must provide all of the unknown functions into `custom_objects`.\n\n## FAQ\n\n### How do I run the example main code in `permutational_layer.py` or `pointnet.py`?\n\nYou can run each file as a module of `superkeras` package by changing directory to be above `superkeras` and then run\n`python -m superkeras.pointnet` for example. You cannot run `python pointnet.py` because this kind of run is not working\nwith relative imports.\n\n### Why is this library named `superkeras`?\n\nWhen I was searching for a unique name for my keras helper utilities like keras helpers, keras utils, keras extras, etc,\nI've found that all of those names were already chosen by someone else. I don't want to repeat the name so I thought of\nsomething cool and just name `superkeras` for ease in remembering.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffchan42%2Fsuperkeras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffchan42%2Fsuperkeras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffchan42%2Fsuperkeras/lists"}