dingkeyan93 / dists Goto Github PK
View Code? Open in Web Editor NEWIQA: Deep Image Structure and Texture Similarity Metric
License: MIT License
IQA: Deep Image Structure and Texture Similarity Metric
License: MIT License
Traceback (most recent call last):
File "E:\Softwares\AI_Tools\Image_Quality_Assesment\DISTS\DISTS_pytorch\DISTS_pt.py", line 139, in
score = model(ref, dist)
File "D:\ProgramData\Anaconda3\envs\DISTS\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "E:\Softwares\AI_Tools\Image_Quality_Assesment\DISTS\DISTS_pytorch\DISTS_pt.py", line 106, in forward
xy_cov = (feats0[k]feats1[k]).mean([2,3],keepdim=True) - x_meany_mean
RuntimeError: The size of tensor a (455) must match the size of tensor b (451) at non-singleton dimension 3
hi, How do I run DISTS on Jetson nano? It gives me an error message "Illegal instruction (core dumped)" . Is it the Jetson nano architecture that doesn't support it?
What is the score range
Thanks for sharing the code. May I ask do you have the code for application of texture classification in your paper?
where can I download the texture database TQD and SynTEX?
I found the TensorFlow implementation causes NaN when I'm using it to train my deep CNN. This turns out to be due to the tf.sqrt(conv)
. Replacing it with return tf.sqrt(tf.maximum(conv, 1e-5))
fixes the problem! I saw the pytorch version does (out + 1e-12).sqrt()
, so maybe that would be the proper way?
Not an issue per se, more like a suggestion.
I see you use pytorch pretrained vgg without correctly normalizing the image (all pytorch pretrained models assume the image was normalized with transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) )
Retraining with the correct normalization might give you even better results.
I think it is amazing! Can you provide the training code? Thank you!
Hi Keyan, super great work! I was wondering could you also provide the training code of DISTS?
It seems that torchvision
needs to be included in the requirements list. I tried to create a conda environment with just pytorch and python3.7, but that didn't work.
Conda environment created with:
conda create --name dists python=3.7
pip install -r requirements.txt
Error:
Traceback (most recent call last):
File "DISTS_pt.py", line 8, in <module>
from torchvision import models, transforms
ModuleNotFoundError: No module named 'torchvision'
Adding the torchvision to the requirements list fix this.
Additionally, when using the conda env, the path to the weights file DISTS_pytorch/weights.pt
seems to point to an incorrect path. The sys.prefix
points to the env directory (example: /home/karinabogdan/anaconda3/envs/dists/
) and not the weights file in DISTS_pytorch/
python DISTS_pt.py --ref ../example_input/12_enh.jpg --dist ../example_input/12_raw.jpg
Traceback (most recent call last):
File "DISTS_pt.py", line 134, in <module>
model = DISTS().to(device)
File "DISTS_pt.py", line 63, in __init__
weights = torch.load(os.path.join(sys.prefix, 'weights.pt'))
File "/home/karinabogdan/anaconda3/envs/dists/lib/python3.7/site-packages/torch/serialization.py", line 581, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/karinabogdan/anaconda3/envs/dists/lib/python3.7/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/home/karinabogdan/anaconda3/envs/dists/lib/python3.7/site-packages/torch/serialization.py", line 211, in __init__
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/home/karinabogdan/anaconda3/envs/dists/weights.pt'
I fixed that by changing the line:
weights = torch.load(os.path.join(sys.prefix, 'weights.pt'))
to
from pathlib import Path, PurePosixPath
weights = torch.load(str(PurePosixPath(Path.cwd()).joinpath('weights.pt')))
but I am not sure if this is the best way to handle this.
I used both:
https://github.com/dingkeyan93/DISTS/commits/master/DISTS_pytorch/DISTS_pt.py
(and)
https://github.com/dingkeyan93/IQA-optimization/commits/master/IQA_pytorch/DISTS.py
And the results are very different so which one is the official one?
(Folder name is irrelevant it is what I named my project without knowing there are similar projects out there with same name, its a custom project has nothing to do with other libraries out there named like it)
I have spent hours and hours trying to figure out why DISTS does not work. It's because I was using mixed precision and it needs full 32 bit for whatever reason. The real issue is that it doesn't fail to run and there are no warnings anywhere or signs of it being a data type issue, leaving you completely clueless on what is going on. I found the problem through brute force.
With DISTS I had to cut my batch size down to 1 even on a 4090 and it trains at half the speed of LPIPS using mixed precision. Practically unusable without mixed precision.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.