Main function with argument parsing and execution.
()
| 155 | return depth_colored |
| 156 | |
| 157 | def main(): |
| 158 | """Main function with argument parsing and execution.""" |
| 159 | parser = argparse.ArgumentParser( |
| 160 | description='LingBot-Depth Example: Refine depth maps using the model', |
| 161 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 162 | epilog=""" |
| 163 | Examples: |
| 164 | # Run with default settings (example 0) |
| 165 | python example.py |
| 166 | |
| 167 | # Use a different example directory |
| 168 | python example.py --example 1 |
| 169 | |
| 170 | # Use Hugging Face model |
| 171 | python example.py --model robbyant/lingbot-depth-postrain-dc-vitl14 |
| 172 | |
| 173 | # Use local checkpoint |
| 174 | python example.py --model ckpt/model.pt |
| 175 | |
| 176 | # Custom output directory |
| 177 | python example.py --output my_results |
| 178 | """ |
| 179 | ) |
| 180 | |
| 181 | parser.add_argument( |
| 182 | '--example', type=str, default='0', |
| 183 | help='Example directory number (default: 0)' |
| 184 | ) |
| 185 | parser.add_argument( |
| 186 | '--model', type=str, |
| 187 | default='robbyant/lingbot-depth-pretrain-vitl-14-v0.5', |
| 188 | help='Model path or Hugging Face ID (default: robbyant/lingbot-depth-pretrain-vitl-14)' |
| 189 | ) |
| 190 | parser.add_argument( |
| 191 | '--output', type=str, default='result', |
| 192 | help='Output directory (default: result)' |
| 193 | ) |
| 194 | parser.add_argument( |
| 195 | '--device', type=str, default='auto', |
| 196 | choices=['auto', 'cuda', 'cpu'], |
| 197 | help='Device to use (default: auto - uses CUDA if available)' |
| 198 | ) |
| 199 | parser.add_argument( |
| 200 | '--no-mask', action='store_true', |
| 201 | help='Disable masking of invalid regions' |
| 202 | ) |
| 203 | |
| 204 | args = parser.parse_args() |
| 205 | |
| 206 | # Print header |
| 207 | print("=" * 70) |
| 208 | print("LingBot-Depth Example: Depth Refinement".center(70)) |
| 209 | print("=" * 70) |
| 210 | |
| 211 | # Setup device |
| 212 | if args.device == 'auto': |
| 213 | device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') |
| 214 | else: |
no test coverage detected