json2onnx


Namejson2onnx JSON
Version 2.0.3 PyPI version JSON
download
home_pagehttps://github.com/PINTO0309/json2onnx
SummaryConverts a JSON file to an ONNX file.
upload_time2023-09-02 04:41:14
maintainer
docs_urlNone
authorKatsuya Hyodo
requires_python>=3.6
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # json2onnx
Converts a JSON file to an ONNX file. Click here for **[onnx2json](https://github.com/PINTO0309/onnx2json)**.

https://github.com/PINTO0309/simple-onnx-processing-tools

[![PyPI - Downloads](https://img.shields.io/pypi/dm/json2onnx?color=2BAF2B&label=Downloads%EF%BC%8FInstalled)](https://pypistats.org/packages/json2onnx) ![GitHub](https://img.shields.io/github/license/PINTO0309/json2onnx?color=2BAF2B) [![PyPI](https://img.shields.io/pypi/v/json2onnx?color=2BAF2B)](https://pypi.org/project/json2onnx/)

<p align="center">
  <img src="https://user-images.githubusercontent.com/33194443/170163032-14b9f769-6f71-41b7-a67b-db168cff949e.png" />
</p>

## 1. Setup
### 1-1. HostPC
```bash
### option
$ echo export PATH="~/.local/bin:$PATH" >> ~/.bashrc \
&& source ~/.bashrc

### run
$ pip install -U onnx protobuf \
&& python3 -m pip install -U onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com \
&& pip install -U json2onnx
```
### 1-2. Docker
https://github.com/PINTO0309/simple-onnx-processing-tools#docker

## 2. CLI Usage
```
usage:
  json2onnx [-h]
  --ij INPUT_JSON_PATH
  -of OUTPUT_ONNX_FILE_PATH

optional arguments:
  -h, --help
      show this help message and exit

  -ij INPUT_JSON_PATH, --input_json_path INPUT_JSON_PATH
      Input JSON file path (*.json)

  -of OUTPUT_ONNX_FILE_PATH, --output_onnx_file_path OUTPUT_ONNX_FILE_PATH
      Output ONNX model path (*.onnx)
```

## 3. In-script Usage
```python
>>> from json2onnx import convert
>>> help(convert)

Help on function convert in module json2onnx.json2onnx:

convert(
  input_json_path: Union[str, NoneType] = '',
  json_dict: Union[dict, NoneType] = None,
  output_onnx_file_path: Union[str, NoneType] = ''
)

    Parameters
    ----------
    input_json_path: Optional[str]
        Input onnx file path.
        Either input_json_path or json_dict must be specified.
        Default: ''

    json_dict: Optional[dict]
        onnx.ModelProto.
        Either input_onnx_file_path or json_dict must be specified.
        json_dict If specified, ignore input_json_path and process json_dict.

    output_onnx_file_path: Optional[str]
        Output onnx file path. If not specified, no ONNX file is output.
        Default: ''

    Returns
    -------
    onnx_graph: onnx.ModelProto
        Converted ONNX.
```

## 4. CLI Execution
```bash
$ json2onnx \
--input_json_path NonMaxSuppression.json \
--output_onnx_file_path NonMaxSuppression.onnx
```

## 5. In-script Execution
```python
from json2onnx import convert

onnx_graph = convert(
  input_json_path="NonMaxSuppression.json",
  output_onnx_file_path="NonMaxSuppression.onnx",
)

# or

onnx_graph = convert(
  input_json_path="NonMaxSuppression.json",
)

# or

onnx_graph = convert(
  json_dict=json_data,
  output_onnx_file_path="NonMaxSuppression.onnx",
)

# or

onnx_graph = convert(
  json_dict=json_data,
)
```

## 6. Issues
https://github.com/PINTO0309/simple-onnx-processing-tools/issues

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PINTO0309/json2onnx",
    "name": "json2onnx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Katsuya Hyodo",
    "author_email": "rmsdh122@yahoo.co.jp",
    "download_url": "https://files.pythonhosted.org/packages/9b/59/9584dfd06ac0a1f552e25ab9d2d5354346b7a3da1897c09239d27ba46bda/json2onnx-2.0.3.tar.gz",
    "platform": "linux",
    "description": "# json2onnx\nConverts a JSON file to an ONNX file. Click here for **[onnx2json](https://github.com/PINTO0309/onnx2json)**.\n\nhttps://github.com/PINTO0309/simple-onnx-processing-tools\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/json2onnx?color=2BAF2B&label=Downloads%EF%BC%8FInstalled)](https://pypistats.org/packages/json2onnx) ![GitHub](https://img.shields.io/github/license/PINTO0309/json2onnx?color=2BAF2B) [![PyPI](https://img.shields.io/pypi/v/json2onnx?color=2BAF2B)](https://pypi.org/project/json2onnx/)\n\n<p align=\"center\">\n  <img src=\"https://user-images.githubusercontent.com/33194443/170163032-14b9f769-6f71-41b7-a67b-db168cff949e.png\" />\n</p>\n\n## 1. Setup\n### 1-1. HostPC\n```bash\n### option\n$ echo export PATH=\"~/.local/bin:$PATH\" >> ~/.bashrc \\\n&& source ~/.bashrc\n\n### run\n$ pip install -U onnx protobuf \\\n&& python3 -m pip install -U onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com \\\n&& pip install -U json2onnx\n```\n### 1-2. Docker\nhttps://github.com/PINTO0309/simple-onnx-processing-tools#docker\n\n## 2. CLI Usage\n```\nusage:\n  json2onnx [-h]\n  --ij INPUT_JSON_PATH\n  -of OUTPUT_ONNX_FILE_PATH\n\noptional arguments:\n  -h, --help\n      show this help message and exit\n\n  -ij INPUT_JSON_PATH, --input_json_path INPUT_JSON_PATH\n      Input JSON file path (*.json)\n\n  -of OUTPUT_ONNX_FILE_PATH, --output_onnx_file_path OUTPUT_ONNX_FILE_PATH\n      Output ONNX model path (*.onnx)\n```\n\n## 3. In-script Usage\n```python\n>>> from json2onnx import convert\n>>> help(convert)\n\nHelp on function convert in module json2onnx.json2onnx:\n\nconvert(\n  input_json_path: Union[str, NoneType] = '',\n  json_dict: Union[dict, NoneType] = None,\n  output_onnx_file_path: Union[str, NoneType] = ''\n)\n\n    Parameters\n    ----------\n    input_json_path: Optional[str]\n        Input onnx file path.\n        Either input_json_path or json_dict must be specified.\n        Default: ''\n\n    json_dict: Optional[dict]\n        onnx.ModelProto.\n        Either input_onnx_file_path or json_dict must be specified.\n        json_dict If specified, ignore input_json_path and process json_dict.\n\n    output_onnx_file_path: Optional[str]\n        Output onnx file path. If not specified, no ONNX file is output.\n        Default: ''\n\n    Returns\n    -------\n    onnx_graph: onnx.ModelProto\n        Converted ONNX.\n```\n\n## 4. CLI Execution\n```bash\n$ json2onnx \\\n--input_json_path NonMaxSuppression.json \\\n--output_onnx_file_path NonMaxSuppression.onnx\n```\n\n## 5. In-script Execution\n```python\nfrom json2onnx import convert\n\nonnx_graph = convert(\n  input_json_path=\"NonMaxSuppression.json\",\n  output_onnx_file_path=\"NonMaxSuppression.onnx\",\n)\n\n# or\n\nonnx_graph = convert(\n  input_json_path=\"NonMaxSuppression.json\",\n)\n\n# or\n\nonnx_graph = convert(\n  json_dict=json_data,\n  output_onnx_file_path=\"NonMaxSuppression.onnx\",\n)\n\n# or\n\nonnx_graph = convert(\n  json_dict=json_data,\n)\n```\n\n## 6. Issues\nhttps://github.com/PINTO0309/simple-onnx-processing-tools/issues\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Converts a JSON file to an ONNX file.",
    "version": "2.0.3",
    "project_urls": {
        "Homepage": "https://github.com/PINTO0309/json2onnx"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "310a60e7581ffe96b5739858797f0c635b27c289465c3467c7930d2182369dd6",
                "md5": "4c932a65f56091dfd110a5e5b2156165",
                "sha256": "4f43a8982d3611c6884b6a035e58e31f4f50c60d0b3ea00dc9a510ffa2328982"
            },
            "downloads": -1,
            "filename": "json2onnx-2.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c932a65f56091dfd110a5e5b2156165",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4983,
            "upload_time": "2023-09-02T04:41:12",
            "upload_time_iso_8601": "2023-09-02T04:41:12.877830Z",
            "url": "https://files.pythonhosted.org/packages/31/0a/60e7581ffe96b5739858797f0c635b27c289465c3467c7930d2182369dd6/json2onnx-2.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b599584dfd06ac0a1f552e25ab9d2d5354346b7a3da1897c09239d27ba46bda",
                "md5": "a90bd17d0eea93bc95a40561dee6126a",
                "sha256": "69a0a25ae80b843dbfabc4d288a1e4265a1e79ee3d61ba65c1c7d455ee110170"
            },
            "downloads": -1,
            "filename": "json2onnx-2.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a90bd17d0eea93bc95a40561dee6126a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4157,
            "upload_time": "2023-09-02T04:41:14",
            "upload_time_iso_8601": "2023-09-02T04:41:14.251278Z",
            "url": "https://files.pythonhosted.org/packages/9b/59/9584dfd06ac0a1f552e25ab9d2d5354346b7a3da1897c09239d27ba46bda/json2onnx-2.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-02 04:41:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PINTO0309",
    "github_project": "json2onnx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "json2onnx"
}
        
Elapsed time: 0.10604s