umuthopeyildirim commited on
Commit
c19a5d3
1 Parent(s): 7ab01ae

omg model loading is going to kill me torch 'just do it'

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -25,10 +25,13 @@ css = """
25
  }
26
  """
27
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
28
- model = NewCRFDepth(version="large07", inv_depth=False,
29
- max_depth=10, pretrained=None).to(DEVICE).eval()
30
- model.load_state_dict(torch.load('checkpoints/nyu_L.pth',
31
- map_location=torch.device(DEVICE)))
 
 
 
32
 
33
  title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
34
  description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.
 
25
  }
26
  """
27
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
28
+ model = NewCRFDepth(version='large07', inv_depth=False,
29
+ max_depth=10).to(DEVICE).eval()
30
+ model = torch.nn.DataParallel(model)
31
+ model.load_state_dict()
32
+ checkpoint = torch.load('checkpoints/nyu_L.pth',
33
+ map_location=torch.device(DEVICE))
34
+ model.load_state_dict(checkpoint['model'])
35
 
36
  title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
37
  description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.