Skip to main content

Benchmark evaluation for widget code generation — 12 quality metrics across layout, legibility, perceptual, style, and geometry.

Project description

widget2code-bench

Benchmark evaluation for widget code generation — 12 quality metrics across layout, legibility, perceptual, style, and geometry.

Installation

# 1. Install PyTorch with CUDA support first (skip if CPU-only)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126

# 2. Install widget2code-bench
pip install widget2code-bench

Note: PyPI only ships CPU-only PyTorch. To use --cuda, you must install PyTorch from the official index before installing this package.

Usage

Single image mode

Evaluate one GT-prediction pair. Prints JSON results to stdout, no files saved.

widget2code-bench \
  --gt_image /path/to/gt.png \
  --pred_image /path/to/pred.png \
  --cuda

Batch mode

Evaluate all matched pairs in directories.

widget2code-bench \
  --gt_dir /path/to/GT \
  --pred_dir /path/to/predictions \
  --pred_name output.png \
  --cuda

Directory Structure (batch mode)

  • GT dir: flat image files with 4-digit IDs in filenames (e.g. gt_0001.png)
  • Pred dir: subfolders with 4-digit IDs in names, each containing --pred_name file
gt_dir/                     pred_dir/
  gt_0001.png                 image_0001/
  gt_0002.png                   output.png
  ...                         image_0002/
                                output.png

Options

Flag Default Description
--gt_image Single GT image path
--pred_image Single prediction image path
--gt_dir GT directory (flat image files)
--pred_dir Prediction directory (subfolders)
--pred_name output.png Prediction filename inside each subfolder
--output_dir {pred_dir}/.analysis Statistics output directory
--workers 4 Parallel threads
--cuda off Enable GPU
--skip_eval off Skip evaluation, only generate statistics

Output (batch mode)

  1. Evaluation — Saves evaluation.json in each prediction subfolder + evaluation.xlsx in pred_dir
  2. Statistics — Saves metrics_stats.json and metrics.xlsx to {pred_dir}/.analysis/

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

widget2code_bench-0.1.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

widget2code_bench-0.1.1-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file widget2code_bench-0.1.1.tar.gz.

File metadata

  • Download URL: widget2code_bench-0.1.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for widget2code_bench-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bcd7f47da92234ca1f9bb066813706e6301687968fe86b495bc374499dfe622f
MD5 f0cee83ab54f243e04c0214d3d4f36cb
BLAKE2b-256 95ed72e1143efb9f9728e0482716a9dbeef0c10a8a69262221c4ddb1774a6d5a

See more details on using hashes here.

File details

Details for the file widget2code_bench-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for widget2code_bench-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a3293a58437d16b7c50e18d845bdf8f79023529e027e752e4b92d40c7007e10
MD5 ca967eea298379b3b6c6e50f011e55c3
BLAKE2b-256 c6b9d25419bac33e86ff3cf76cf20d5836984f4b68eae628cf48e50ef8b41efc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page