E2A2 image codec for compressionkit
E2A2 (Encoding Efficient Asymmetric Autoencoders) image is an image codec for 8-bit RGB images; rates are bits per pixel. This repository holds its weights in the layout that compressionkit v0.3 reads, with an encoder half and a decoder half that load separately.
Source and permission
The weights are redistributed from their original public release, danjacobellis/E2A2, subfolder image/, revision 2c4f517c, with the permission of the author, Dan Jacobellis. Ambiq did not train this codec. Its description, development and evaluation are documented at the original source and on the codec's page, https://danjacobellis.net/compressors/E2A2_image. The entropy coder is GGDLPC (https://danjacobellis.net/GGDLPC/).
Every tensor here equals the tensor of the same name at that revision; this repository divides them into the encoder and decoder halves listed below and adds the files compressionkit uses.
Files
encoder/config.json,encoder/weights.safetensors(themerged.{op}.encoders.*tensors) andencoder/entropy.json(the GGDLPC tables): everything needed to encode.decoder/config.json,decoder/weights.safetensors(themerged.{op}.decoder.*tensors): everything needed to decode. Eachconfig.jsonis the full source configuration, so each half constructs alone.rd.json: the rate–distortion curve of the original release, byte-identical to it. The curve is on the 24 Kodak images, bits per pixel, PSNR on the RGB image mapped to [0, 1]. Nothing in the codec or its entropy coder was trained or fitted on Kodak.web/: the decoder of each operating point that the compressionkit browser demo offers, as LiteRT files (section below). The compressionkit loaders do not downloadweb/.
| file | bytes | SHA-256 |
|---|---|---|
decoder/config.json |
1,705 | 6903c5761232f47cc403c346f3de62cf146479dc5e3fa1466ad1c060731a9ad8 |
decoder/weights.safetensors |
2,129,494,748 | 7b67591da5286f595d1cebb0ddc3fefb854df60c18ae6181369e57425c1faa5b |
encoder/config.json |
1,705 | 6903c5761232f47cc403c346f3de62cf146479dc5e3fa1466ad1c060731a9ad8 |
encoder/entropy.json |
8,617 | a2f231e659315bcd6de5b227252fb2d32fd62b0ebb54f95672996454ac87e7d2 |
encoder/weights.safetensors |
280,812 | ad615d04ea5ef07de2e3133cf6a05ac54329ef3261990db664561b324c32c820 |
rd.json |
865 | c9aad3b3ee342712b3b8df36e0bd4a398f4ca96e964820fecda993d5b86f73f0 |
Input, output and operating points
Input: float32 (3, H, W) = 8-bit sRGB / 127.5 − 1, cropped to whole 64-pixel macroregions. Output: a reconstruction in the same form. Operating points (cumulative latent channels): [3, 9, 15, 21, 27]. The stream of a lower operating point is a literal bit-prefix of the stream of the highest, and the rates are entropy-coded bits. compressionkit converts nothing: each codec states its input type and range.
Using it with compressionkit
compressionkit v0.3 is in pre-release; these loaders are part of it.
from compressionkit.e2a2 import hub
# both halves
config, weights, coder, ops = hub.load_split_from_hub('image')
model = hub.load_codec(config=config, weights=weights, n_ch=ops[-1])
# one half (encode-only shown; half='decoder' for decode-only)
cfg, w, coder, ops = hub.load_split_from_hub('image', half='encoder')
encoder = hub.build_partial(cfg, w, ops[-1])
Status and limitations
- A reference codec for evaluation and development with compressionkit, redistributed as released; not a production model, and not qualified for any product or regulated use.
- Its quality on data unlike the data of its original release is not characterized here; measure it on your own data (
compressionkit.calibratefits an input map on your training split). - Maintainer for compressionkit: Dan Jacobellis (Ambiq). Questions about the codec itself: the original source.
Browser decoders (web/)
For each operating point the compressionkit browser demo offers, its decoder as a LiteRT .tflite window decoder, which runs in a web browser on LiteRT.js (CPU), with a .json beside it that gives its shapes and windowing. A window decodes chunk output samples (pixels along each side for the image codec) with margin of context on each side; the latent grid is cut into overlapping windows and the outputs joined. The PSNR column is the largest difference between the PSNR of the joined output, decoded in LiteRT.js in Chromium, and that of the full-size PyTorch decode, over the example recordings of the demo. The compressionkit loaders do not download web/.
| file | operating point | chunk | margin | bytes | PSNR difference (dB, rows) | decoder weights (SHA-256) |
|---|---|---|---|---|---|---|
web/image_op3_chunk256_m64.tflite |
3 | 256 pixels | 64 | 228,033,684 | 1.9e-03 (1) | 7b67591da528 |
web/image_op9_chunk256_m64.tflite |
9 | 256 pixels | 64 | 228,199,572 | 1.2e-04 (1) | 7b67591da528 |
web/image_op15_chunk256_m64.tflite |
15 | 256 pixels | 64 | 455,569,908 | 1.0e-05 (1) | 7b67591da528 |
web/image_op21_chunk256_m64.tflite |
21 | 256 pixels | 64 | 607,703,092 | 1.9e-04 (1) | 7b67591da528 |
web/image_op27_chunk256_m64.tflite |
27 | 256 pixels | 64 | 610,357,300 | 1.3e-04 (1) | 7b67591da528 |
Weights fp32, converted from decoder/weights.safetensors with litert-torch 0.10.0. The last column gives the start of the SHA-256 of the decoder/weights.safetensors it was converted from, which is this repository's.
- Downloads last month
- 32