Tasks

Tasks#

What a basis is used for, one module per task. A task transforms through forward_transform and inverse_transform, never through the circuit, so it runs on every basis. Compression keeps the largest coefficients of an image and rebuilds it from them (upstream’s compression.jl, with its JSON form). Completion fills in an image from the pixels that were observed, by iterative hard thresholding in the basis; completion_loss() is the objective for training a basis through that solver. Both take a colour image as a stack of channel planes, with one budget over the planes; pdft.color makes the stack.

What a basis is used for: one module per task.

A task takes a basis and data and transforms through forward_transform and inverse_transform, never through the circuit, so it runs on every basis in the package.

  • tasks.compression — keep the largest coefficients of an image and rebuild it from them. Mirror of upstream src/compression.jl.

  • tasks.completion — fill in an image from the pixels that were observed, and the objective for training a basis to do so. Not in upstream.

Contents

compress

Compress image under basis, keeping top (1 - ratio) fraction.

compress_with_k

Compress keeping exactly k coefficients.

recover

Reconstruct real-valued image from a compressed representation.

CompressedImage

Sparse frequency-domain representation of an image.

compression_stats

Summary of compression ratio + kept coefficients.

save_compressed

Write a CompressedImage to path as JSON; returns the path.

load_compressed

Read a CompressedImage written by save_compressed.

compressed_to_dict

Convert to the JSON-ready dict form.

dict_to_compressed

Inverse of compressed_to_dict.

complete

Reconstruct a real image from its pixels under mask.

completion_loss

(basis, images, masks) -> scalar: the mean squared error of complete over a batch.