kornelski / dssim

Image similarity comparison simulating human perception (multiscale SSIM in Rust)
https://kornel.ski/dssim
GNU Affero General Public License v3.0
1.07k stars 69 forks source link

Feature request: set `scale_weights` in CLI #121

Open homm opened 2 years ago

homm commented 2 years ago

In my understanding this is a key parameter which should not be hardcoded, since it mostly depends on how the image is showed to the user. At least I believe scale_weights should be different for 2x and 1x images.

The possible syntax:

dssim --weights 0.028,0.197,0.322,0.298,0.155 file.png modified1.png

As a bonus, this unleashes the easy way to turn multiple-resolution comparison to single-resolution just by defining --weights 1.

By the way I'm wondering how the current DEFAULT_WEIGHTS was chosen. There is a comment in the code: "inspired by the IW-SSIM, but details of the algorithm and weights are different" but without details.

kornelski commented 2 years ago

These hyperparameters are dependent on viewing conditions indeed. They've been tuned (or overfitted 😄) for the TID2013 dataset.

It would be nice to have something for 2x images. Perhaps just shifting them by one would be okay? But without a dataset to validate this, it'd be only guessing.

I'd rather not expose that in CLI as raw numbers, because if I don't have a way to set better values, I don't expect users to be able to either.

homm commented 2 years ago

Perhaps just shifting them by one would be okay?

Hmm, this will mean that the best 2x image is a good quality 1x image scale up bicubically :-)

To be honest, I'm surprised that the first layer is 7 times less significant than second. This is the first thing I'd like to experiment with if this functionality will be available.

kornelski commented 2 years ago

You can experiment with it by recompiling the program. Compiling Rust is a bit slow, but not difficult.

igv commented 2 years ago

To be honest, I'm surprised that the first layer is 7 times less significant than second.

Agree. I've experimented with only 2 scales (WEIGHTS = [0.2, 0.8]) and it shows reasonable results.

kornelski commented 2 years ago

How did you verify "reasonable"? The weights affect the TID benchmark by about 3%, so it's not something you can eyeball.

igv commented 2 years ago

I've used images from this comparison and compared results to VIFp (I think now I prefer this metric over MS-SSIM).

homm commented 2 years ago

I'm sure you've already seen this thread, but I'd like to add it here for others who will read the issue.

There's no excuse for using 1x density in any modern codec test, unless you're testing specifically for a minority of users. Jake Archibald, Developer advocate working on Chrome

https://twitter.com/jaffathecake/status/1531337906027102210