Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'dist_model' #1

Open
tianjiaozeng opened this issue May 27, 2020 · 9 comments
Open

ImportError: cannot import name 'dist_model' #1

tianjiaozeng opened this issue May 27, 2020 · 9 comments

Comments

@tianjiaozeng
Copy link

Thanks for sharing the pre-trained model.
I'm very interested in this work but are facing a problem when running the code.
Below is the error that occurs.

I'd really appreciate it if you could help me solve this problem.
Many thanks!

ImportError Traceback (most recent call last)
in ()
9
10
---> 11 from utils import *
12
13 sys.path.append('models/')

/content/drive/My Drive/LenslessLearning-master/utils.py in ()
234 import sys
235 sys.path.append('/home/kristina/PerceptualSimilarity')
--> 236 from models import dist_model as dm
237 from admm_helper_functions_torch import *
238

ImportError: cannot import name 'dist_model'

@antipa
Copy link

antipa commented May 27, 2020

it looks like it's just having issues finding paths to various packages. The code is still looking for a specific path on someone else's computer--try modifying line 235 to point to whichever directory you installed PerceptualSimilarity and see if that helps? Maybe @monakhova could chime in and help out.

@monakhova
Copy link
Contributor

The package is from the Perceptual Similarity repo and calls the LPIPS loss. You can find this here: https://github.com/richzhang/PerceptualSimilarity

@tianjiaozeng
Copy link
Author

Thanks! It works now.
Can I ask another question? I notice that in the admm_model.py, class ADMM_Net needs a parameter "h" for initialization. what should this "h" be if I'd like to retrain the models?

class ADMM_Net(nn.Module):
def init(self, batch_size, h, iterations, learning_options = {'learned_vars': []},
cuda_device = torch.device('cpu'), le_admm_s = False, denoise_model = []):

Thank you!

The package is from the Perceptual Similarity repo and calls the LPIPS loss. You can find this here: https://github.com/richzhang/PerceptualSimilarity

@tianjiaozeng
Copy link
Author

Thanks! It works now.
Can I ask another question? I notice that in the admm_model.py, class ADMM_Net needs a parameter "h" for initialization. what should this "h" be if I'd like to retrain the models?

class ADMM_Net(nn.Module):
def init(self, batch_size, h, iterations, learning_options = {'learned_vars': []},
cuda_device = torch.device('cpu'), le_admm_s = False, denoise_model = []):

Thank you!

@tianjiaozeng
Copy link
Author

it looks like it's just having issues finding paths to various packages. The code is still looking for a specific path on someone else's computer--try modifying line 235 to point to whichever directory you installed PerceptualSimilarity and see if that helps? Maybe @monakhova could chime in and help out.

Can I ask another question? I notice that in the admm_model.py, class ADMM_Net needs a parameter "h" for initialization. what should this "h" be if I'd like to retrain the models?

class ADMM_Net(nn.Module):
def init(self, batch_size, h, iterations, learning_options = {'learned_vars': []},
cuda_device = torch.device('cpu'), le_admm_s = False, denoise_model = []):

Thank you so much!

@monakhova
Copy link
Contributor

h is the point spread function of the imaging system.

@tianjiaozeng
Copy link
Author

h is the point spread function of the imaging system.

I notice in the DiffuserCam project, there's a mat file "example_psf.mat". Is this the same psf that should be used here?

Thank you so much!

@JayShaun
Copy link

The package is from the Perceptual Similarity repo and calls the LPIPS loss. You can find this here: https://github.com/richzhang/PerceptualSimilarity

Sorry, I don't know if I miss something, but I don't find 'dist_model' in directory 'models'. I'd really appreciate it if you could help me solve this problem.

@BaIGaO
Copy link

BaIGaO commented Nov 21, 2022

The package is from the Perceptual Similarity repo and calls the LPIPS loss. You can find this here: https://github.com/richzhang/PerceptualSimilarity

Sorry, I don't know if I miss something, but I don't find 'dist_model' in directory 'models'. I'd really appreciate it if you could help me solve this problem.

The latest repo of LPIPS has changed a lot. You can pull history repo ,here :https://github.com/richzhang/PerceptualSimilarity/releases/tag/1.0 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants