Demo module for IQA/VQA Metrics Robustness Benchmark.
Project description
Metrics Robustness Benchmark
Repository for "Comparing the robustness of modern image- and video-quality metrics to adversarial attacks" paper
General requirements
Python3, Jypyter, GPU (with CUDA), Docker (if you want to launch adversarial attacks)
Repository structure
robustness_benchmark/methods/- adversarial attacks and utilsrobustness_benchmark/methods/utils/- supportive functions for attacksrobustness_benchmark/models/- domain transformation model weightsrobustness_benchmark/interface.py- benchmark module interface. Main functions arerun_attacks(), collect_results(), domain_transform(), evaluate_robustness(), run_full_pipeline(). More details on usage in functions' docstrings and demo Notebooklib_demo.ipynb.subjects/- metrics code (only MANIQA metric for demo)res/- precomputed results (only MANIQA metric for demo)test_dataset/- small test set of images to test module functionalitytest_results/- results fortest_dataset(MANIQA)
Demo code:
lib_demo.ipynb- benchmark module usagedemo_scoring.ipynb- calculate robustness scores for MANIQA (using precomputed results from /res/)
Supplementary code:
robustness_benchmark/score_methods.py- functions to calculate attack efficiency scores (described in paper in "Methodology" section)robustness_benchmark/NOT.py- functions to perform Neural Optimal Transport for mapping metrics values to one domain
Running the demo code
Robusness Benchmark pip module
Module installation
Note: It is recommended to install PyTorch version suitable for your Python/CUDA installation from official website before installing the library.
Direct install via pip install robustness_benchmark will be available soon. To install the latest version of the module you can clone the repo and pip install it:
git clone https://github.com/msu-video-group/MSU_Metrics_Robustness_Benchmark/tree/main
pip install -r requirements.txt
pip install -e .
Demo metric setup
To install demo metric MANIQA you can use following commands in benchmark's root directory:
git submodule update --init --recursive
cd subjects/maniqa/src && git apply ../patches/maniqa.patch -v
cd subjects/maniqa && cp model.py src
Launch adversarial attacks
Example usage of module can be found in lib_demo.ipynb Notebook. To run the attacks and evaluate metric's robustness you can run it cell-by-cell. You can also test other metrics and attacks if they follow the module interface. Main library funtions are listed below, for more details check functions' docstrings.
robustness_benchmark.interface functions
run_attacks()- Run given attacks on metric on specified datasets.collect_results()- Given the path to directory with raw results produced byrun_attack(), collects them into single DataFrame.domain_transform()- Apply domain transformation to collected attack results fromcollect_results(). Works only with supported metrics.evaluate_robustness()- Evaluate metric's robustness to attacks and return table with results on each type of attack.run_full_pipeline()- Run full benchmark pipeline: run attacks, save results, collect them, apply domain transform (if needed), evaluate.
Using precomputed results
- Download precomputed results used in article from here (password: 'neurips_benchmark_2023')
- Clone this repo:
git clone https://github.com/msu-video-group/MSU_Metrics_Robustness_Benchmark/tree/main - Install requirements:
pip install -r requirements.txt - Launch Jupyter noteboor or jupyter lab
- Launch demo_scoring.ipynb cell-by-cell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robustness_benchmark-0.0.2.tar.gz.
File metadata
- Download URL: robustness_benchmark-0.0.2.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d73296d22c35ac3b01a501cb10e14fc5c8b4b27d23f85312992f076c7fb68c6
|
|
| MD5 |
4073dbfc9e9c704b5a23debd4d4d02e8
|
|
| BLAKE2b-256 |
08658bbd3e77011056644d353826590d850cacdd7d040bff3cc705c6179d6b19
|
File details
Details for the file robustness_benchmark-0.0.2-py3-none-any.whl.
File metadata
- Download URL: robustness_benchmark-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af5e82b63c39cdeaeacec6449c5fc233f789dc03b140a566c415778f439e1c0b
|
|
| MD5 |
a841ab65fef1a11458ff09a066a381d1
|
|
| BLAKE2b-256 |
bbb2f4b0e06a41869fec17880a4e49ed465ea56725007642b30ed5b1904f7fa8
|