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

Small fixes for notebook to run without issue. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pytorch
name: lensless_learning
channels:
- pytorch
- conda-forge
Expand Down Expand Up @@ -137,6 +137,7 @@ dependencies:
- pytorch=1.0.1=py3.7_cuda9.0.176_cudnn7.4.2_2
- torchvision=0.2.2=py_3
- pip:
- lpips==0.1.4
- dask==1.1.4
- torch==1.0.1.post2
prefix: /home/kristina/anaconda3/envs/pytorch
Expand Down
92 changes: 55 additions & 37 deletions pre-trained reconstructions.ipynb

Large diffs are not rendered by default.

17 changes: 5 additions & 12 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,13 @@ def save_model_summary(model, admm, filename, device, description, test_loader):


import sys
sys.path.append('/home/kristina/PerceptualSimilarity')
from models import dist_model as dm
from lpips import LPIPS
from admm_helper_functions_torch import *


def test_training_images(model, model_admm, test_loader, device):

lpipsloss = dm.DistModel()
lpipsloss.initialize(model='net-lin',net='alex',use_gpu=True,version='0.1')

lpipsloss = LPIPS(net='alex', version='0.1')

mse_loss = torch.nn.MSELoss(size_average=None)

Expand Down Expand Up @@ -326,11 +324,8 @@ def test_training_images(model, model_admm, test_loader, device):
return loss_dict

def test_training_images2(model, test_loader, device):

#model = model.eval()

lpipsloss = dm.DistModel()
lpipsloss.initialize(model='net-lin',net='alex',use_gpu=True,version='0.1')
lpipsloss = LPIPS(net='alex', version='0.1')


mse_loss = torch.nn.MSELoss(size_average=None)
Expand Down Expand Up @@ -428,9 +423,7 @@ def run_timing_test(model, test_loader, device, num_trials = 100):
##### Plotting functions
def preplot(image):
image = np.transpose(image, (1,2,0))
image_color = np.zeros_like(image);
image_color[:,:,0] = image[:,:,2]; image_color[:,:,1] = image[:,:,1]
image_color[:,:,2] = image[:,:,0];
image_color = cv.cvtColor(image, cv.COLOR_BGR2RGB)
out_image = np.flipud(np.clip(image_color, 0,1))
return out_image[60:,62:-38,:]

Expand Down