+
Skip to content

A tool that evaluates texture quality loss by scaling images down and up, then measuring perceptual differences between original and processed images.

License

Notifications You must be signed in to change notification settings

RomanVPX/resolution-suggester

Repository files navigation

ResolutionSuggester

Python application License: MIT Python 3.13

A powerful tool for evaluating texture quality loss during scaling. Essentially, it analyzes images by reducing their resolution and then increasing them back to the original size, after which it measures the difference between the original and processed images using various perceptual metrics.

🚀 Features

  • Comprehensive Analysis: Analyze image quality at various resolutions using multiple metrics
  • Multiple Metrics: PSNR, SSIM, MS-SSIM, TDPR, and LPIPS support
  • Optimal Resolution Suggestion: Get recommendations for the best resolution based on quality thresholds
  • Interpolation Methods: Choose between Bilinear, Bicubic, and Mitchell-Netravali interpolations
  • Per-Channel Analysis: Examine quality metrics for individual RGB/RGBA channels
  • Visualization: Generate charts showing quality vs. resolution
  • ML-Powered: Fast quality estimation using machine learning models
  • Export Options: Save results to CSV and JSON formats
  • Multilingual: Supports English and Russian interfaces

📋 Requirements

  • Python 3.10+
  • NumPy, OpenCV, Pillow for image processing
  • PyTorch (optional, for GPU acceleration and LPIPS)
  • Matplotlib for visualization
  • Scikit-learn for ML features

🔧 Installation

From Source

git clone https://github.com/RomanVPX/ResolutionSuggester.git
cd ResolutionSuggester
pip install .

For development installation:

pip install -e ".[dev]"

💻 Usage

ResolutionSuggester provides two command-line interfaces and two subcommands:

  • resolution_suggester {analyze, model} [options] PATHS - main command
  • res-suggest {analyze, model} [options] PATHS - shorthand alias

Interface language could be chosen if not detected automatically:

  • res-suggest analyze {analyze, model} --lang en [options] PATHS - force English as an interface language
  • res-suggest analyze {analyze, model} --lang ru [options] PATHS - force Russian as an interface language

Show Halp Message

# Show help on [analyze] subcommand
res-suggest analyze --help

# Show help on [model] subcommand
res-suggest model --help

Basic Usage

res-suggest analyze /path/to/image.png

Analyze Multiple Images

res-suggest analyze /path/to/textures/folder/

Select Quality Metric

# Choose from: psnr, ssim, ms_ssim, tdpr, lpips
res-suggest analyze image.png -m ssim

Choose LPIPS Neural Network

# Choose from: alex (default/balanced), vgg (memory-hungry), squeeze (fast)
res-suggest analyze image.png -m lpips --lpips-net vgg

Choose Interpolation Method

# Choose from: bilinear, bicubic, mitchell (default)
res-suggest analyze image.png -i bilinear

Per-Channel Analysis

res-suggest analyze image.png -c

Generate Visualization Chart

res-suggest analyze image.png --chart

Switch Theme for Charts

# Choose from: dark (default), light
res-suggest analyze image.png --chart --theme light

Export Results

res-suggest analyze image.png -o # .csv
res-suggest analyze image.png -j # .json

Use ML Model for Fast Estimation

res-suggest analyze image.png --ml

Set Minimum Analysis Size

# Default and minimum is 16
res-suggest analyze image.png --min-size 32

Control Parallel Processing

# Disable parallel processing
res-suggest analyze image.png --no-parallel

# Set specific number of threads
res-suggest analyze image.png -t 4

Save Generated Images

# Save downscaled images
res-suggest analyze image.png --save-im-down

# Save upscaled images after downscaling
res-suggest analyze image.png --save-im-up

# Save all generated images
res-suggest analyze image.png -s

Switch Language

# Choose from: en, ru, auto (default)
res-suggest analyze image.png --lang ru

📊 Example Output

╭───── Analysis (MS_SSIM) ─────╮
│ LevelLight-01_comp_light.exr │
╰──────────────────────────────╯
┏━━━━━━━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Resolution ┃ R    ┃ G    ┃ B    ┃ A    ┃ Min  ┃ Quality         ┃ Quality Bar     ┃
┡━━━━━━━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ 1024x1024  │ 1.00 │ 1.00 │ 1.00 │ 1.00 │ 1.00 │ Original        │                 │
│ 512x512    │ 1.00 │ 1.00 │ 1.00 │ 0.99 │ 0.99 │ Excellent       │ ██████████████░ │
│ 256x256    │ 0.97 │ 0.98 │ 0.97 │ 0.96 │ 0.96 │ Very good       │ ██████████████░ │
│ 128x128    │ 0.91 │ 0.93 │ 0.90 │ 0.87 │ 0.87 │ Noticeable loss │ █████████████░░ │
│ 64x64      │ 0.82 │ 0.86 │ 0.80 │ 0.76 │ 0.76 │ Noticeable loss │ ███████████░░░░ │
│ 32x32      │ 0.75 │ 0.80 │ 0.71 │ 0.64 │ 0.64 │ Noticeable loss │ █████████░░░░░░ │
│ 16x16      │ 0.73 │ 0.78 │ 0.67 │ 0.59 │ 0.59 │ Noticeable loss │ ████████░░░░░░░ │
└────────────┴──────┴──────┴──────┴──────┴──────┴─────────────────┴─────────────────┘

🛠️ Advanced Features

Generate Dataset and Train ML Model

# Genarate dataset
res-suggest model --generate-dataset /path/to/training/images/

# Train ML model using generated dataset
res-suggest model --train-ml /path/to/training/images/

# Generate dataset and train ML model in one go
res-suggest model --generate-dataset --train-ml /path/to/training/images/

Compare Real and ML-Predicted Results

res-suggest analyze image.png --compare-ml

GPU Acceleration Control

# Disable GPU acceleration during analysis
res-suggest analyze image.png --no-gpu

# Disable GPU acceleration during dataset generation
res-suggest model --generate-dataset --no-gpu /path/to/training/images/

🔧 Supported File Formats

  • EXR (.exr)
  • TGA (.tga)
  • PNG (.png)
  • JPEG (.jpg, .jpeg)

🤝 Contributing

Contributions are welcome! Please check out our Contributing Guide.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👥 Authors

  • Roman Vishnyakov - Initial work - RomanVPX

About

A tool that evaluates texture quality loss by scaling images down and up, then measuring perceptual differences between original and processed images.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载