chaofengc / IQA-PyTorch

👁️ 🖼️ 🔥PyTorch Toolbox for Image Quality Assessment, including LPIPS, FID, NIQE, NRQM(Ma), MUSIQ, TOPIQ, NIMA, DBCNN, BRISQUE, PI and more...
https://iqa-pytorch.readthedocs.io/
Other
1.89k stars 166 forks source link

Is Ubuntu really required? #107

Closed CrHasher closed 1 year ago

CrHasher commented 1 year ago

I managed to install this lib on Windows, but no matter what method I use 'MAD', 'LPIPS', 'DISTS' I always get different errors with every single one, so for me this lib on windows is unusable. Is Ubuntu a hard requirement to make this lib work?

Most frequent errors: AssertionError: Input and reference images should have the same shape, but got torch.Size([1, 4, 1440, 2560]) and torch. Which is not true all other methods from other libraries I tested work. RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 1 Probably some pytorch thing.

To test I used inference_iqa.py

inference_iqa.py -r D:\OneDrive\Documents\Data\Projects\PyIQA\reference-gs.png -i D:\OneDrive\Documents\Data\Projects\PyIQA\imagesx_1\ewa_lanczos.png --metric_mode FR -m DISTS

Thank you!

CrHasher commented 1 year ago

Also noticed you probably don't support *.png files, is that true?

chaofengc commented 1 year ago

Thanks for your interest. The problem is neither because of OS nor the file format.

The metrics do not support images with 4 channels which have an extra alpha channel for transparency. I have updated the codes to make it read RGB format by default, you may use the latest codes with:

# Install latest github version
pip uninstall pyiqa # if have older version installed already 
pip install git+https://github.com/chaofengc/IQA-PyTorch.git

# Install with git clone
git clone https://github.com/chaofengc/IQA-PyTorch.git
cd IQA-PyTorch
pip install -r requirements.txt
python setup.py develop

Besides, the codes are only tested with Ubuntu. It may also work on windows but I cannot guarantee that.