skillfed

scc4onnx

Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX. Simple Channel Conversion for ONNX.

scc4onnx v1.0.7 83.0K downloads/30d#14,114 on PyPI25
Permissive license MIT License AGING released

What it is and what it does

scc4onnx is a command-line and Python library tool for modifying ONNX model input specifications. It rewrites the dimension order of named input operations and optionally swaps RGB/BGR channel ordering, then inserts Transpose operations after the input to preserve downstream model behavior. The tool works by accepting a source ONNX file, applying the specified transformations, and writing a modified model file—or by accepting an in-memory ONNX graph object for programmatic use.

The package supports arbitrary tensor dimensions (not limited to 4D), allowing flexible reordering of any axis. It is typically used when adapting pre-trained models to different input conventions—for example, converting a model trained on NCHW-format images to accept NHWC input, or swapping color channel order to match a different preprocessing pipeline. The transformations are non-destructive: the model's internal computation graph remains unchanged, with the transpose operations ensuring outputs remain semantically identical.

Use it for:

  • Convert a computer vision model from NCHW to NHWC format to match a different inference framework's input convention.
  • Swap RGB to BGR channel ordering on model inputs to align with preprocessing pipelines that use different color spaces.
  • Adapt stereo or multi-input models by reordering dimensions on multiple named inputs simultaneously.
  • Prepare ONNX models for deployment on hardware or frameworks that expect specific tensor layouts.
  • Batch-process multiple ONNX models via CLI to standardize input formats across a model zoo.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts ONNX model input tensor dimensions and channel ordering (NCHW ↔ NHWC, RGB ↔ BGR) by rewriting input operations and inserting compensating transposes.

Yes, if you work with ONNX models and need to adapt input tensor layouts or channel ordering. The package is lightweight, has no runtime dependencies, and carries permissive licensing. The aging maintenance status (last release 487 days ago) is a minor concern for a stable utility tool, but check whether your ONNX and onnx_graphsurgeon versions are compatible before relying on it in production.

Install

scc4onnx on PyPI

pip

pip install scc4onnx

uv

uv add scc4onnx

poetry

poetry add scc4onnx

Installing scc4onnx

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging (487 days since last release), though the repository remains active and the package has been stable since its 2022 release.

License in practice

MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for most commercial and open-source projects.

Quickstart

# CLI usage
$ pip install scc4onnx
$ scc4onnx --input_onnx_file_path model.onnx --output_onnx_file_path model_converted.onnx --input_op_names_and_order_dims input_op [0,2,3,1]

# Python usage
from scc4onnx import order_conversion
converted = order_conversion(
    input_onnx_file_path='model.onnx',
    output_onnx_file_path='model_converted.onnx',
    input_op_names_and_order_dims={'input_op': [0,2,3,1]}
)

Requires onnx and onnx_graphsurgeon to be installed separately (not listed as package dependencies but referenced in setup documentation).

Verify before relying

  • Whether onnx and onnx_graphsurgeon are truly optional or required at runtime despite not appearing in the dependency list.
  • Scope of tensor dimension support beyond the documented NCHW/NHWC examples.

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 487 days since the last release
Last repo commit
First released
Downloads 82,968/month — #14,114 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: scc4onnx-1.0.7-py3-none-any.whl

Tags

ONNX tensor dimension conversionNCHW NHWC converterONNX channel order conversionRGB BGR swap ONNXONNX input transpose toolONNX model dimension reorderONNX input format converter
onnx-toolsmodel-conversiontensor-layout

More Artificial Intelligence packages