{"id":38521526,"url":"https://github.com/awsaf49/tensorflow_extra","last_synced_at":"2026-01-17T06:41:15.704Z","repository":{"id":56933772,"uuid":"478569569","full_name":"awsaf49/tensorflow_extra","owner":"awsaf49","description":"TensorFlow GPU \u0026 TPU compatible operations: MelSpectrogram, TimeFreqMask, CutMix, MixUp, ZScore, and more","archived":false,"fork":false,"pushed_at":"2023-09-29T05:49:52.000Z","size":916,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-28T03:40:21.130Z","etag":null,"topics":["audio-processing","comuter-vision","tensorflow"],"latest_commit_sha":null,"homepage":"","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/awsaf49.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-04-06T13:21:07.000Z","updated_at":"2025-07-13T07:02:12.000Z","dependencies_parsed_at":"2023-09-29T06:58:55.688Z","dependency_job_id":null,"html_url":"https://github.com/awsaf49/tensorflow_extra","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"6dfe54503e379d4bf7309325da908ed64c546307"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/awsaf49/tensorflow_extra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsaf49%2Ftensorflow_extra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsaf49%2Ftensorflow_extra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsaf49%2Ftensorflow_extra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsaf49%2Ftensorflow_extra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awsaf49","download_url":"https://codeload.github.com/awsaf49/tensorflow_extra/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsaf49%2Ftensorflow_extra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28502816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["audio-processing","comuter-vision","tensorflow"],"created_at":"2026-01-17T06:41:11.407Z","updated_at":"2026-01-17T06:41:15.699Z","avatar_url":"https://github.com/awsaf49.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tensorflow Extra\r\n\u003e TensorFlow GPU \u0026 TPU compatible operations: MelSpectrogram, TimeFreqMask, CutMix, MixUp, ZScore, and more\r\n\r\n# Installation\r\nFor Stable version\r\n```shell\r\n!pip install tensorflow-extra\r\n```\r\nor\r\nFor updated version\r\n```shell\r\n!pip install git+https://github.com/awsaf49/tensorflow_extra\r\n```\r\n\r\n# Usage\r\nTo check use case of this library, checkout [BirdCLEF23: Pretraining is All you Need](https://www.kaggle.com/code/awsaf49/birdclef23-pretraining-is-all-you-need-train) notebook. It uses this library along with **Multi Stage Transfer Learning** for Bird Call Identification task.\r\n\r\n\r\n# Layers\r\n## MelSpectrogram\r\nConverts audio data to mel-spectrogram in GPU/TPU.\r\n```py\r\nimport tensorflow_extra as tfe\r\naudio2spec = tfe.layers.MelSpectrogram()\r\nspec = audio2spec(audio)\r\n```\r\n\r\n\u003cimg src=\"https://github.com/awsaf49/tensorflow_extra/assets/36858976/45981a3f-fe32-423b-9a0d-5016b8463bbf\" width=\"600\"\u003e\r\n\r\n\r\n## Time Frequency Masking\r\nCan also control number of stripes.\r\n```py\r\ntime_freq_mask = tfe.layers.TimeFreqMask()\r\nspec = time_freq_mask(spec)\r\n```\r\n\u003cimg src=\"https://github.com/awsaf49/tensorflow_extra/assets/36858976/78bc7007-67e1-4a93-8f26-9d8a2e687edd\" width=\"600\"\u003e\r\n\r\n## CutMix\r\nCan be used with audio, spec, image. For spec full freq resolution can be used using `full_height=True`.\r\n```py\r\ncutmix = tfe.layers.CutMix()\r\naudio = cutmix(audio, training=True) # accepts both audio \u0026 spectrogram\r\n```\r\n\u003cimg src=\"https://github.com/awsaf49/tensorflow_extra/assets/36858976/35af3140-46ec-4592-8923-4bd21f76cb15\" width=\"600\"\u003e\r\n\r\n\r\n## MixUp\r\nCan be used with audio, spec, image. For spec full freq resolution can be used using `full_height=True`.\r\n```py\r\nmixup = tfe.layers.MixUp()\r\naudio = mixup(audio, training=True)  # accepts both audio \u0026 spectrogram\r\n```\r\n\r\n\u003cimg src=\"https://github.com/awsaf49/tensorflow_extra/assets/36858976/128de4aa-5295-4655-b00d-1e16b5e06560\" width=\"600\"\u003e\r\n\r\n\r\n## Normalization\r\nApplies standardization and rescaling.\r\n```py\r\nnorm = tfe.layers.ZScoreMinMax()\r\nspec = norm(spec)\r\n```\r\n\u003cimg src=\"https://github.com/awsaf49/tensorflow_extra/assets/36858976/8a8a4b38-9eb2-4dda-ab09-11887b37c593\" width=\"600\"\u003e\r\n\r\n\r\n# Activations\r\n## SmeLU: Smooth ReLU\r\n```py\r\nimport tensorflow as tf\r\nimport tensorflow_extra as tfe\r\n\r\na = tf.constant([-2.5, -1.0, 0.5, 1.0, 2.5])\r\nb = tfe.activations.smelu(a)  # array([0., 0.04166667, 0.6666667 , 1.0416666 , 2.5])\r\n```\r\n\u003cimg src=\"images/smelu.png\" width=500\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawsaf49%2Ftensorflow_extra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawsaf49%2Ftensorflow_extra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawsaf49%2Ftensorflow_extra/lists"}