jinlinyi commited on
Commit
61d15bc
1 Parent(s): aadf06d

run on cpu

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -45,6 +45,9 @@ article = """
45
  <p style='text-align: center'><a href='https://arxiv.org/abs/2212.03239' target='_blank'>Perspective Fields for Single Image Camera Calibrations</a> | <a href='https://github.com/jinlinyi/PerspectiveFields' target='_blank'>Github Repo</a></p>
46
  """
47
 
 
 
 
48
  def setup_cfg(args):
49
  cfgs = []
50
  configs = args['config_file'].split('#')
@@ -146,23 +149,24 @@ for img_name in glob('assets/imgs/*.*g'):
146
  examples.append([img_name])
147
  print(examples)
148
 
 
149
  model_zoo = {
150
  'PersNet-360Cities': {
151
  'weights': ['https://www.dropbox.com/s/czqrepqe7x70b7y/cvpr2023.pth'],
152
- 'opts': ['MODEL.WEIGHTS', 'models/cvpr2023.pth'],
153
  'config_file': 'models/cvpr2023.yaml',
154
  'param': False,
155
  },
156
  'PersNet_Paramnet-GSV-uncentered': {
157
  'weights': ['https://www.dropbox.com/s/ufdadxigewakzlz/paramnet_gsv_rpfpp.pth'],
158
- 'opts': ['MODEL.WEIGHTS', 'models/paramnet_gsv_rpfpp.pth'],
159
  'config_file': 'models/paramnet_gsv_rpfpp.yaml',
160
  'param': True,
161
  },
162
  # trained on GSV dataset, predicts Perspective Fields + camera parameters (roll, pitch, fov), assuming centered principal point
163
  'PersNet_Paramnet-GSV-centered': {
164
  'weights': ['https://www.dropbox.com/s/g6xwbgnkggapyeu/paramnet_gsv_rpf.pth'],
165
- 'opts': ['MODEL.WEIGHTS', 'models/paramnet_gsv_rpf.pth'],
166
  'config_file': 'models/paramnet_gsv_rpf.yaml',
167
  'param': True,
168
  },
 
45
  <p style='text-align: center'><a href='https://arxiv.org/abs/2212.03239' target='_blank'>Perspective Fields for Single Image Camera Calibrations</a> | <a href='https://github.com/jinlinyi/PerspectiveFields' target='_blank'>Github Repo</a></p>
46
  """
47
 
48
+
49
+
50
+
51
  def setup_cfg(args):
52
  cfgs = []
53
  configs = args['config_file'].split('#')
 
149
  examples.append([img_name])
150
  print(examples)
151
 
152
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
153
  model_zoo = {
154
  'PersNet-360Cities': {
155
  'weights': ['https://www.dropbox.com/s/czqrepqe7x70b7y/cvpr2023.pth'],
156
+ 'opts': ['MODEL.WEIGHTS', 'models/cvpr2023.pth', 'MODEL.DEVICE', device,],
157
  'config_file': 'models/cvpr2023.yaml',
158
  'param': False,
159
  },
160
  'PersNet_Paramnet-GSV-uncentered': {
161
  'weights': ['https://www.dropbox.com/s/ufdadxigewakzlz/paramnet_gsv_rpfpp.pth'],
162
+ 'opts': ['MODEL.WEIGHTS', 'models/paramnet_gsv_rpfpp.pth', 'MODEL.DEVICE', device,],
163
  'config_file': 'models/paramnet_gsv_rpfpp.yaml',
164
  'param': True,
165
  },
166
  # trained on GSV dataset, predicts Perspective Fields + camera parameters (roll, pitch, fov), assuming centered principal point
167
  'PersNet_Paramnet-GSV-centered': {
168
  'weights': ['https://www.dropbox.com/s/g6xwbgnkggapyeu/paramnet_gsv_rpf.pth'],
169
+ 'opts': ['MODEL.WEIGHTS', 'models/paramnet_gsv_rpf.pth', 'MODEL.DEVICE', device,],
170
  'config_file': 'models/paramnet_gsv_rpf.yaml',
171
  'param': True,
172
  },