{"id":15651705,"url":"https://github.com/pinto0309/onnx2json","last_synced_at":"2025-06-27T19:32:08.629Z","repository":{"id":57448879,"uuid":"361445606","full_name":"PINTO0309/onnx2json","owner":"PINTO0309","description":"Exports the ONNX file to a JSON file and JSON dict.","archived":false,"fork":false,"pushed_at":"2023-01-25T22:53:30.000Z","size":38,"stargazers_count":33,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-09T19:06:26.099Z","etag":null,"topics":["cli","converter","json","model-converter","onnx","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/PINTO0309.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}},"created_at":"2021-04-25T14:07:35.000Z","updated_at":"2025-03-10T18:31:08.000Z","dependencies_parsed_at":"2023-02-14T12:15:48.735Z","dependency_job_id":null,"html_url":"https://github.com/PINTO0309/onnx2json","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/PINTO0309/onnx2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PINTO0309%2Fonnx2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PINTO0309%2Fonnx2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PINTO0309%2Fonnx2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PINTO0309%2Fonnx2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PINTO0309","download_url":"https://codeload.github.com/PINTO0309/onnx2json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PINTO0309%2Fonnx2json/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262319070,"owners_count":23293002,"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":["cli","converter","json","model-converter","onnx","python"],"created_at":"2024-10-03T12:39:50.046Z","updated_at":"2025-06-27T19:32:08.582Z","avatar_url":"https://github.com/PINTO0309.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# onnx2json\nExports the ONNX file to a JSON file and JSON dict. Click here for **[json2onnx](https://github.com/PINTO0309/json2onnx)**.\n\nhttps://github.com/PINTO0309/simple-onnx-processing-tools\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/onnx2json?color=2BAF2B\u0026label=Downloads%EF%BC%8FInstalled)](https://pypistats.org/packages/onnx2json) ![GitHub](https://img.shields.io/github/license/PINTO0309/onnx2json?color=2BAF2B) [![PyPI](https://img.shields.io/pypi/v/onnx2json?color=2BAF2B)](https://pypi.org/project/onnx2json/)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/33194443/170162575-4c3b9b62-a8f4-44a3-9240-856f9abdf460.png\" /\u003e\n\u003c/p\u003e\n\n## 1. Setup\n\n### 1-1. HostPC\n```bash\n### option\n$ echo export PATH=\"~/.local/bin:$PATH\" \u003e\u003e ~/.bashrc \\\n\u0026\u0026 source ~/.bashrc\n\n### run\n$ pip install -U onnx protobuf \\\n\u0026\u0026 python3 -m pip install -U onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com \\\n\u0026\u0026 pip install -U onnx2json\n```\n### 1-2. Docker\nhttps://github.com/PINTO0309/simple-onnx-processing-tools#docker\n\n## 2. CLI Usage\n```\nusage:\n  onnx2json [-h]\n  -if INPUT_ONNX_FILE_PATH\n  -oj OUTPUT_JSON_PATH\n  [-i JSON_INDENT]\n\noptional arguments:\n  -h, --help\n      show this help message and exit\n\n  -if INPUT_ONNX_FILE_PATH, --input_onnx_file_path INPUT_ONNX_FILE_PATH\n      Input ONNX model path. (*.onnx)\n\n  -oj OUTPUT_JSON_PATH, --output_json_path OUTPUT_JSON_PATH\n      Output JSON file path (*.json) If not specified, no JSON file is output.\n\n  -i JSON_INDENT, --json_indent JSON_INDENT\n      Number of indentations in JSON. (default=2)\n```\n\n## 3. In-script Usage\n```python\n\u003e\u003e\u003e from onnx2json import convert\n\u003e\u003e\u003e help(convert)\n\nHelp on function convert in module onnx2json.onnx2json:\n\nconvert(\n  input_onnx_file_path: Union[str, NoneType] = '',\n  onnx_graph: Union[onnx.onnx_ml_pb2.ModelProto, NoneType] = None,\n  output_json_path: Union[str, NoneType] = '',\n  json_indent: Union[int, NoneType] = 2\n)\n\n    Parameters\n    ----------\n    input_onnx_file_path: Optional[str]\n        Input onnx file path.\n        Either input_onnx_file_path or onnx_graph must be specified.\n        Default: ''\n\n    onnx_graph: Optional[onnx.ModelProto]\n        onnx.ModelProto.\n        Either input_onnx_file_path or onnx_graph must be specified.\n        onnx_graph If specified, ignore input_onnx_file_path and process onnx_graph.\n\n    output_json_path: Optional[str]\n        Output JSON file path (*.json) If not specified, no JSON file is output.\n        Default: ''\n\n    json_indent: Optional[int]\n        Number of indentations in JSON.\n        Default: 2\n\n    Returns\n    -------\n    onnx_json: dict\n        Converted JSON dict.\n```\n\n## 4. CLI Execution\n```bash\n$ onnx2json \\\n--input_onnx_file_path NonMaxSuppression.onnx \\\n--output_json_path NonMaxSuppression.json \\\n--json_indent 2\n```\n\n## 5. In-script Execution\n```python\nfrom onnx2json import convert\n\nonnx_json = convert(\n  input_onnx_file_path=\"NonMaxSuppression.onnx\",\n  output_json_path=\"NonMaxSuppression.json\",\n  json_indent=2,\n)\n\n# or\n\nonnx_json = convert(\n  onnx_graph=graph,\n)\n```\n\n## 6. Issues\nhttps://github.com/PINTO0309/simple-onnx-processing-tools/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinto0309%2Fonnx2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinto0309%2Fonnx2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinto0309%2Fonnx2json/lists"}