Skip to main content

onnigiri

onnx-divider

The purpose of this package is to create subgraphs by partitioning computational graphs in order to facilitate the development of applications.

One of the problems in developing applications using deep learning models is that the DL model is not applicable by itself. For example, they may be have unnecessary nodes and some nodes are not supported some DL tools. This tool enable us to edit an onnx model freely and easily.

Installation

From PyPI:

$ pip3 install onnigiri

From Dockerhub

$ docker pull idein/onnigiri:20231114

Usage

SSD

$ onnigiri ssd-10.onnx -o ssd-10-main.onnx --from image --to Transpose_472 Transpose_661
$ onnigiri ssd-10.onnx -o ssd-10-post.onnx --from Transpose_472 Transpose_661 --to bboxes labels scores

With docker:

$ docker run --rm -it -u $UID:$GID -v $(pwd):/work idein/onnigiri:20221014 ssd-10.onnx -o ssd-10-main.onnx --from image --to Transpose_472 Transpose_661
$ docker run --rm -it -u $UID:$GID -v $(pwd):/work idein/onnigiri:20221014 ssd-10.onnx -o ssd-10-post.onnx  --from Transpose_472 Transpose_661 --to bboxes labels scores

UltraFace

$ onnigiri version-RFB-640.onnx -o version-RFB-640-main.onnx --from input --to 460 scores
$ onnigiri version-RFB-640.onnx -o version-RFB-640-post.onnx --from 460 --to boxes

tiny-yolov3

$ onnigiri tiny-yolov3-11.onnx --fix-input-shape 'input_1' '1,3,256,256' 'image_shape' '1,2' -o tiny-yolov3-11-main.onnx --from input_1 --to 'TFNodes/yolo_evaluation_layer_1/Reshape_3:0' 'model_1/leaky_re_lu_10/LeakyRelu:0' 'model_1/leaky_re_lu_5/LeakyRelu:0'
$ onnigiri tiny-yolov3-11.onnx --fix-input-shape 'input_1' '1,3,256,256' 'image_shape' '1,2' -o tiny-yolov3-11-post.onnx --from image_shape 'TFNodes/yolo_evaluation_layer_1/Reshape_3:0' 'model_1/leaky_re_lu_10/LeakyRelu:0' 'model_1/leaky_re_lu_5/LeakyRelu:0' --to 'yolonms_layer_1' 'yolonms_layer_1:1' 'yolonms_layer_1:2'

Q&A

  • How to get the name of values?

Use Netron.

  • Why is the extracted subgraph different from the original subgraph?

onnigiri apply onnx-simplifier before extraction. You can disable the graph optimization by the onnx-simplifier using the --no-optimization option.

Development Guide

$ poetry install

Build docker image

$ nix build '.#dockerimage' -o image
$ docker load < ./image

Related project

Metadata

Release files for onnigiri 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onnigiri 0.4.0
File Size Uploaded Provenance
onnigiri-0.4.0.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for onnigiri 0.4.0
File Interpreter ABI Platform
onnigiri-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / onnigiri-0.4.0.tar.gz

Download URL onnigiri-0.4.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bcb5f67d23d094e0698a454151e83fb1473c211a8253fc76571ea58c97ee226b
BLAKE2b-256 checksum
How to use checksums
d56eb740e671073dbd62aee68cfa845fe1295e36f9993f3290de7bab703a0485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.9.18 Linux/5.15.0-1039-aws

Release files / onnigiri-0.4.0-py3-none-any.whl

Download URL onnigiri-0.4.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e29eb2ef08346932ca6e4c24eff2bd4463f8985f42c08b6501af1bfb1b13445
BLAKE2b-256 checksum
How to use checksums
ba3e511cc6e167b0ec3cebdfd1789ce9719dafb3f53fee595c35bfecd3f6109b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.9.18 Linux/5.15.0-1039-aws

Security for onnigiri 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page