umuthopeyildirim
commited on
Commit
•
92224a7
1
Parent(s):
7a8232f
Update model initialization and add print statements for parameter counts
Browse files
app.py
CHANGED
@@ -26,11 +26,19 @@ css = """
|
|
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 |
checkpoint = torch.load('checkpoints/nyu_L.pth',
|
32 |
map_location=torch.device(DEVICE))
|
33 |
model.load_state_dict(checkpoint['model'])
|
|
|
34 |
|
35 |
title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
|
36 |
description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.
|
|
|
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.train()
|
31 |
+
num_params = sum([np.prod(p.size()) for p in model.parameters()])
|
32 |
+
print("== Total number of parameters: {}".format(num_params))
|
33 |
+
num_params_update = sum([np.prod(p.shape)
|
34 |
+
for p in model.parameters() if p.requires_grad])
|
35 |
+
print("== Total number of learning parameters: {}".format(num_params_update))
|
36 |
+
|
37 |
model = torch.nn.DataParallel(model)
|
38 |
checkpoint = torch.load('checkpoints/nyu_L.pth',
|
39 |
map_location=torch.device(DEVICE))
|
40 |
model.load_state_dict(checkpoint['model'])
|
41 |
+
print("== Loaded checkpoint '{}'".format('checkpoints/nyu_L.pth'))
|
42 |
|
43 |
title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
|
44 |
description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.
|