Spaces:
Running
on
T4
Running
on
T4
fix height
Browse files
app.py
CHANGED
@@ -98,6 +98,7 @@ def resize_fix_aspect_ratio(img, field, target_width=None, target_height=None):
|
|
98 |
|
99 |
|
100 |
def inference(img, model_type):
|
|
|
101 |
if model_type is None:
|
102 |
return None, ""
|
103 |
perspective_cfg_list = setup_cfg(model_zoo[model_type])
|
@@ -138,7 +139,7 @@ def inference(img, model_type):
|
|
138 |
pred['pred_rel_cx'].cpu().item(),
|
139 |
pred['pred_rel_cy'].cpu().item(),
|
140 |
]
|
141 |
-
param = f"roll {pred['pred_roll'].cpu().item() :.2f}\npitch {pred['pred_pitch'].cpu().item() :.2f}\
|
142 |
param += f"principal point {pred['pred_rel_cx'].cpu().item() :.2f} {pred['pred_rel_cy'].cpu().item() :.2f}"
|
143 |
pred_vis = draw_from_r_p_f_cx_cy(
|
144 |
img[:,:,::-1],
|
|
|
98 |
|
99 |
|
100 |
def inference(img, model_type):
|
101 |
+
img_h = img.shape[0]
|
102 |
if model_type is None:
|
103 |
return None, ""
|
104 |
perspective_cfg_list = setup_cfg(model_zoo[model_type])
|
|
|
139 |
pred['pred_rel_cx'].cpu().item(),
|
140 |
pred['pred_rel_cy'].cpu().item(),
|
141 |
]
|
142 |
+
param = f"roll {pred['pred_roll'].cpu().item() :.2f}\npitch {pred['pred_pitch'].cpu().item() :.2f}\nvirtical fov {pred['pred_general_vfov'].cpu().item() :.2f}\nfocal_length {pred['pred_rel_focal'].cpu().item()*img_h.shape[0] :.2f}\n"
|
143 |
param += f"principal point {pred['pred_rel_cx'].cpu().item() :.2f} {pred['pred_rel_cy'].cpu().item() :.2f}"
|
144 |
pred_vis = draw_from_r_p_f_cx_cy(
|
145 |
img[:,:,::-1],
|