zamba.models.depth_estimation.depth_manager¶
Attributes¶
MODELS = dict(depth=dict(private_weights_url='s3://drivendata-client-zamba/depth_estimation_winner_weights/second_place/tf_efficientnetv2_l_in21k_2_5_pl4/model_best.pt', weights='zamba_depth_30aaa90525.pt'))
module-attribute
¶
Classes¶
DepthDataset
¶
Bases: torch.utils.data.Dataset
Source code in zamba/models/depth_estimation/depth_manager.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
Attributes¶
cached_frames = cached_frames
instance-attribute
¶
channels = 3
instance-attribute
¶
detection_dict = detection_dict
instance-attribute
¶
detection_indices = list(detection_dict.keys())
instance-attribute
¶
fps = 1
instance-attribute
¶
height = 270
instance-attribute
¶
num_frames = self.window_size * 2 + 1
instance-attribute
¶
order = [-1, -2, 0, 1, 2]
instance-attribute
¶
width = 480
instance-attribute
¶
window_size = 2
instance-attribute
¶
Functions¶
__init__(filepaths)
¶
Source code in zamba/models/depth_estimation/depth_manager.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
DepthEstimationManager
¶
Source code in zamba/models/depth_estimation/depth_manager.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
Attributes¶
batch_size = batch_size
instance-attribute
¶
device = 'cuda'
instance-attribute
¶
gpus = gpus
instance-attribute
¶
model_weights = model_cache_dir / model['weights']
instance-attribute
¶
num_workers = num_workers
instance-attribute
¶
tta = tta
instance-attribute
¶
Functions¶
__init__(model_cache_dir: Path, gpus: int, weight_download_region: RegionEnum = RegionEnum('us'), batch_size: int = 64, tta: int = 2, num_workers: int = 8)
¶
Create a depth estimation manager object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_cache_dir |
Path
|
Path for downloading and saving model weights. |
required |
gpus |
int
|
Number of GPUs to use for inference. |
required |
weight_download_region |
str
|
s3 region to download pretrained weights from. Options are "us" (United States), "eu" (Europe), or "asia" (Asia Pacific). Defaults to "us". |
RegionEnum('us')
|
batch_size |
int
|
Batch size to use for inference. Defaults to 64. Note: a batch is a set of frames, not videos, for the depth model. |
64
|
tta |
int
|
Number of flips to apply for test time augmentation. |
2
|
num_workers |
int
|
Number of subprocesses to use for data loading. The maximum value is the number of CPUs in the system. Defaults to 8. |
8
|
Source code in zamba/models/depth_estimation/depth_manager.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
predict(filepaths)
¶
Generate predictions for a list of video filepaths.
Source code in zamba/models/depth_estimation/depth_manager.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
Functions¶
depth_transforms(size)
¶
Source code in zamba/models/depth_estimation/depth_manager.py
26 27 28 29 30 31 32 33 34 |
|