Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Pysjtu | 36 | 3 days ago | 8 | December 21, 2020 | 1 | gpl-3.0 | HTML | |||
The Python iSJTU client for Humans. | ||||||||||
Onnx2json | 18 | 4 months ago | mit | Python | ||||||
Exports the ONNX file to a JSON file and JSON dict. | ||||||||||
Json2onnx | 13 | 9 months ago | mit | Python | ||||||
Converts a JSON file to an ONNX file. | ||||||||||
Sed4onnx | 5 | 1 | 5 months ago | 2 | May 25, 2022 | mit | Python | |||
Simple ONNX constant encoder/decoder. Since the constant values in the JSON files generated by onnx2json are Base64-encoded values, ASCII <-> Base64 conversion is required when rewriting JSON constant values. |
Simple ONNX constant encoder/decoder.
PINTO0309/simple-onnx-processing-tools
### option
$ echo export PATH="~/.local/bin:$PATH" >> ~/.bashrc \
&& source ~/.bashrc
### run
$ pip install -U sed4onnx
PINTO0309/simple-onnx-processing-tools
$ sed4onnx -h
usage:
sed4onnx [-h]
-cs CONSTANT_STRING
[-d {float16,float32,float64,uint8,int8,int16,int32,int64,string}]
[-m {encode,decode}]
optional arguments:
-h, --help
show this help message and exit.
-cs CONSTANT_STRING, --constant_string CONSTANT_STRING
Strings to be encoded and decoded for ONNX constants.
-d {float16,float32,float64,uint8,int8,int16,int32,int64,string}, \
--dtype {float16,float32,float64,uint8,int8,int16,int32,int64,string}
Data type.
-m {encode,decode}, --mode {encode,decode}
encode: Converts the string specified in constant_string to a Base64 format string
that can be embedded in ONNX constants.
decode: Converts a Base64 string specified in constant_string to ASCII like
Numpy string or pure string.
>>> from sed4onnx import encode
>>> from sed4onnx import decode
>>> help(encode)
Help on function encode in module sed4onnx.onnx_constant_encoder_decoder:
encode(constant_string: str) -> str
Parameters
----------
constant_string: str
ASCII string to be encoded.
dtype: str
'float16' or 'float32' or 'float64' or 'uint8'
or 'int8' or 'int16' or 'int32' or 'int64' or 'string'
Returns
-------
encoded_string: str
Base64-encoded ASCII string.
>>> help(decode)
Help on function decode in module sed4onnx.onnx_constant_encoder_decoder:
decode(constant_string: str, dtype: str) -> numpy.ndarray
Parameters
----------
constant_string: str
Base64 string to be decoded.
dtype: str
'float16' or 'float32' or 'float64' or 'uint8'
or 'int8' or 'int16' or 'int32' or 'int64' or 'string'
Returns
-------
decoded_ndarray: np.ndarray
Base64-decoded numpy.ndarray.
$ sed4onnx \
--constant_string [-1,3,224,224] \
--dtype int64 \
--mode encode
$ sed4onnx \
--constant_string '//////////8DAAAAAAAAAOAAAAAAAAAA4AAAAAAAAAA=' \
--dtype int64 \
--mode decode
from sed4onnx import encode
from sed4onnx import decode
base64_string = encode(
constant_string='[-1,3,224,224]',
dtype='int64',
)
numpy_ndarray = decode(
constant_string='//////////8DAAAAAAAAAOAAAAAAAAAA4AAAAAAAAAA=',
dtype='int64',
)
$ sed4onnx \
--constant_string [-1,3,224,224] \
--dtype int64 \
--mode encode
//////////8DAAAAAAAAAOAAAAAAAAAA4AAAAAAAAAA=
$ sed4onnx \
--constant_string '//////////8DAAAAAAAAAOAAAAAAAAAA4AAAAAAAAAA=' \
--dtype int64 \
--mode decode
[-1,3,224,224]
https://github.com/PINTO0309/simple-onnx-processing-tools/issues