{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":31234,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# **INSTALL MASt3R**","metadata":{}},{"cell_type":"markdown","source":"\n**MASt3R** (Matching and Stereo 3D Reconstruction) is an AI model that **reconstructs 3D shapes from two or more images**.\n\n## Key Features\n\n### 1. **3D Reconstruction from Images**\n- Takes multiple photos as input and generates 3D models (point clouds or meshes) of objects or scenes\n- Simultaneously estimates camera positions and angles\n\n### 2. **High-Precision Matching**\n- Accurately finds corresponding points between images from different viewpoints\n- Improves upon DUSt3R (predecessor model) for more precise 3D reconstruction\n\n### 3. **Use Cases**\n- **3D Scanning**: Create 3D models by photographing objects from multiple angles\n- **AR/VR**: Reconstruct real-world environments in 3D\n- **Robotics**: 3D understanding of surroundings\n- **Photogrammetry**: Measurement of buildings and terrain\n\n## Technical Features\n\n- **ViT (Vision Transformer)** based architecture\n- **Metric depth estimation**: Estimates 3D coordinates at actual scale\n- **End-to-end learning**: Camera pose estimation and 3D reconstruction in a single model\n- **No need for camera calibration**: Works without prior camera parameters\n\n## Model Variants\n\n- **ViTLarge_BaseDecoder_512**: High-quality standard model (the one you downloaded)\n- Different input resolutions available (512x512 pixels)\n\n## Advantages\n\n- Simple to use (just input images)\n- Fast processing\n- High accuracy even with sparse viewpoints\n- Open source and freely available\n\nIt's particularly powerful for creating 3D content from regular photographs without specialized equipment.","metadata":{}},{"cell_type":"code","source":"import sys\nimport os","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Remove the existing mast3r directory to start fresh\nos.chdir('/kaggle/working')\n!rm -rf mast3r\n\n# Re-clone the repository\n!git clone --recursive https://github.com/naver/mast3r\nos.chdir('/kaggle/working/mast3r')\n\n# Check the dust3r directory for setup.py\n!ls -la dust3r/\n\n# Verify if setup.py exists\n!test -f dust3r/setup.py && echo \"setup.py exists\" || echo \"setup.py NOT found\"\n\n# If setup.py is missing, install manually\n!cd dust3r && python -m pip install -e .\n\n# Do the same for croco\n!cd dust3r/croco && python -m pip install -e .\n\n# Install dependencies from requirements.txt\n!pip install -r requirements.txt\n\n# Download the model weights\n!mkdir -p checkpoints\n!wget -P checkpoints/ https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth\n\n# Verification\nsys.path.insert(0, '/kaggle/working/mast3r')\nsys.path.insert(0, '/kaggle/working/mast3r/dust3r')\n\nfrom mast3r.model import AsymmetricMASt3R\nprint(\"✓ Success!\")\n\n!pip install trimesh matplotlib roma","metadata":{"trusted":true,"_kg_hide-output":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}