Alessio Grancini
commited on
Update monocular_depth_estimator.py
Browse files- monocular_depth_estimator.py +18 -24
monocular_depth_estimator.py
CHANGED
@@ -17,30 +17,24 @@ MODEL_FILE_URL = {
|
|
17 |
|
18 |
class MonocularDepthEstimator:
|
19 |
def __init__(self,
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
# Model will be loaded in make_prediction
|
40 |
-
self.model = None
|
41 |
-
self.transform = None
|
42 |
-
self.net_w = None
|
43 |
-
self.net_h = None
|
44 |
|
45 |
# Download model if not exists
|
46 |
if not os.path.exists(model_weights_path+model_type+".pt"):
|
|
|
17 |
|
18 |
class MonocularDepthEstimator:
|
19 |
def __init__(self,
|
20 |
+
model_type="midas_v21_small_256",
|
21 |
+
model_weights_path="models/",
|
22 |
+
optimize=False,
|
23 |
+
side_by_side=False,
|
24 |
+
height=None,
|
25 |
+
square=False,
|
26 |
+
grayscale=False):
|
27 |
+
|
28 |
+
# Store parameters but don't initialize CUDA
|
29 |
+
self.model_type = model_type
|
30 |
+
self.model_weights_path = model_weights_path
|
31 |
+
self.is_optimize = optimize
|
32 |
+
self.is_square = square
|
33 |
+
self.is_grayscale = grayscale
|
34 |
+
self.height = height
|
35 |
+
self.side_by_side = side_by_side
|
36 |
+
self.model = None # Model will be loaded in make_prediction
|
37 |
+
self.transform = None
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# Download model if not exists
|
40 |
if not os.path.exists(model_weights_path+model_type+".pt"):
|