{"id":22562314,"url":"https://github.com/mdietrichstein/tfhub-exporter","last_synced_at":"2026-05-09T06:12:54.525Z","repository":{"id":73366586,"uuid":"187855654","full_name":"mdietrichstein/tfhub-exporter","owner":"mdietrichstein","description":"Export and optimize Tensorflow Hub models for inference and deployment","archived":false,"fork":false,"pushed_at":"2019-05-21T15:31:49.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T22:53:36.732Z","etag":null,"topics":["deployment","exporter","inference","optimization","tensorflow","tensorflow-hub","tensorflow-models","tfhub","tool"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdietrichstein.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-05-21T14:36:41.000Z","updated_at":"2020-07-13T09:34:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ecf2fc4-f0da-49aa-9937-79f71cd8f3ce","html_url":"https://github.com/mdietrichstein/tfhub-exporter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdietrichstein/tfhub-exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdietrichstein%2Ftfhub-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdietrichstein%2Ftfhub-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdietrichstein%2Ftfhub-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdietrichstein%2Ftfhub-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdietrichstein","download_url":"https://codeload.github.com/mdietrichstein/tfhub-exporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdietrichstein%2Ftfhub-exporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809150,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["deployment","exporter","inference","optimization","tensorflow","tensorflow-hub","tensorflow-models","tfhub","tool"],"created_at":"2024-12-07T22:12:31.657Z","updated_at":"2026-05-09T06:12:54.519Z","avatar_url":"https://github.com/mdietrichstein.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tensorflow Hub Module Exporter\n\nThis tool allows you to create optimized versions of the pretrained machine learning modules available on [Tensorflow Hub](https://tfhub.dev).\n\nIt downloads a module from TF Hub, freezes the network weights, applies a (configurable) number of transformations in order to optimize it for deployment and inference and exports the processed model as a [Saved Model](https://www.tensorflow.org/guide/saved_model).\n\n## Prerequisites\n\n* Make sure that you are running at least `python 3.6`\n* Run `pip install -r requirements.txt` to install the neccessary dependencies\n\nThat's it, you should be ready to go.\n\n## Usage\n\nThe examples in this repository use the [TF Hub Imagenet (ILSVRC-2012-CLS) classification with MobileNet V2 (depth multiplier 1.40)](https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/3) model.\n\nTake a look at the [usage notebook](usage.ipynb) for a full example on how to export and load an optimized model.\n\n### Export a TF Hub Module (export)\n\n**Usage**\n\n```\npython main.py export --help\n\nUsage: main.py export [OPTIONS] MODULE_URL TARGET\n\n  Exports a frozen and optimized TF Hub module to a SavedModel\n\n  Example: python main.py export \"https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/3\"\n  export/mobilenet\n\nOptions:\n  --verbose          Enable verbose log output\n  --signature TEXT   Model signature to export\n  --transforms TEXT  Transforms which should be applied to the exported graph  [default: remove_nodes(op=Identity),\n                     merge_duplicate_nodes, strip_unused_nodes, fold_constants(ignore_errors=true), fold_batch_norms]\n  --help             Show this message and exit.\n```\n\n**Example**\n\n```\npython main.py export \"https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/3\" export/mobilenet\n\n\nEXPORT SUMMARY\n\nExport Location: \"/Users/marc/Development/tfhub-exporter/export/mobilenet\"\n\n Model Inputs\n╭────────┬─────────────────────┬─────────╮\n│  name  │        shape        │  dtype  │\n├────────┼─────────────────────┼─────────┤\n│ images │ (None, 224, 224, 3) │ float32 │\n╰────────┴─────────────────────┴─────────╯\n\n Model Outputs for signature \"default\"\n╭──────────────────────────────────────────────────┬──────────────┬─────────╮\n│                       name                       │    shape     │  dtype  │\n├──────────────────────────────────────────────────┼──────────────┼─────────┤\n│ module_apply_default/MobilenetV2/Logits/output:0 │ (None, 1001) │ float32 │\n╰──────────────────────────────────────────────────┴──────────────┴─────────╯\n```\n\n### Inspect a TF Hub Module (show-info)\n\nThis command inspects the given module and displays information about the network inputs and outputs per signature.\n\n**Usage**\n```\npython main.py show-info --help\n\nUsage: main.py show-info [OPTIONS] MODULE_URL\n\n  Shows internal TF Hub Module information like supported inputs, outputs and signatures\n\nOptions:\n  --verbose  Enable verbose log output\n  --help     Show this message and exit.\n```\n\n**Example**\n\n```\npython main.py show-info \"https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/3\"\n\n Model Inputs\n╭────────┬─────────────────────┬─────────╮\n│  name  │        shape        │  dtype  │\n├────────┼─────────────────────┼─────────┤\n│ images │ (None, 224, 224, 3) │ float32 │\n╰────────┴─────────────────────┴─────────╯\n\n Supported Outputs\n╭───────────┬──────────────┬─────────╮\n│ signature │    shape     │  dtype  │\n├───────────┼──────────────┼─────────┤\n│  default  │ (None, 1001) │ float32 │\n╰───────────┴──────────────┴─────────╯\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdietrichstein%2Ftfhub-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdietrichstein%2Ftfhub-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdietrichstein%2Ftfhub-exporter/lists"}