This repository contains a comprehensive pipeline for training and clustering Gaussian models using DINO features. The project is designed to work on CUDA version 11.8 and has been tested on a Windows environment. Below, you will find a detailed guide on the structure of the repository, the purpose of each script, and the order in which to run them.
This project aims to train and cluster Gaussian models using DINO features. The pipeline includes several steps:
- Image Conversion: Convert images from a dataset into a format suitable for training.
- Feature Extraction: Extract DINO features from the images.
- Model Training: Train a Gaussian model using the extracted features.
- Clustering: Cluster the trained Gaussian model for further analysis.
- Python 3.8 or higher
- CUDA 11.8
- Windows OS
-
Clone the repository:
git clone https://github.com/yourusername/sequential-training.git cd sequential-training -
Install the required Python packages:
pip install -r requirements.txt
-
Ensure you have CUDA 11.8 installed and properly configured.
The first step is to convert your images into a format suitable for training. This is done using the convert.py script.
python convert.py --source_path path/to/your/images --camera OPENCV --colmap_executable path/to/colmap --resizeNext, extract DINO features from the converted images using the dino-feature-extraction/extract.py script.
python dino-feature-extraction/extract.py --dir_images path/to/converted/images --dir_dst path/to/save/features --model_path path/to/dino_model.pthOnce the features are extracted, you can train the Gaussian model using the train.py script.
python train.py --model_path path/to/save/model --source_path path/to/converted/images --iterations 25000Finally, cluster the trained Gaussian model using the cluster.py script.
python cluster.py --model_path path/to/trained/model --save_path path/to/save/clusters --k 4This script converts images from a dataset into a format suitable for training. It uses COLMAP for feature extraction, matching, and bundle adjustment, followed by image undistortion.
This script extracts DINO features from the images. It uses a pre-trained DINO model to extract features and applies PCA for dimensionality reduction.
This script trains a Gaussian model using the extracted DINO features. It initializes the model, sets up the training parameters, and runs the training loop.
This script clusters the trained Gaussian model. It uses K-means or Mean Shift clustering to group the Gaussian components and saves the results.
This directory contains various utility scripts for handling scenes, cameras, and datasets.
This directory contains utility scripts for general operations, image processing, and loss calculations.
- Custom Scene Training: If you are training with a new scene, you must update the
dataset_readers.pyfile. Specifically, change the path to the DINO features file on line 75:Update the path to point to your specific DINO features file.dino_feats = torch.load("C:\\Users\\ykirc\\Desktop\\input-scenes\\1_snacks\\1_snacks.pt", weights_only=True)
This project builds upon the code from the following paper:
- @Article{kerbl3Dgaussians, author = {Kerbl, Bernhard and Kopanas, Georgios and Leimk{"u}hler, Thomas and Drettakis, George}, title = {3D Gaussian Splatting for Real-Time Radiance Field Rendering}, journal = {ACM Transactions on Graphics}, number = {4}, volume = {42}, month = {July}, year = {2023}, url = {https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/} }
GitHub. (2023). 3D Gaussian Splatting for Real-Time Radiance Field Rendering. [online] Available at: https://github.com/graphdeco-inria/gaussian-splatting.
This code has been inspired by the repository:
- Harshavardhan-Pandurangan (2024). GitHub - Harshavardhan-Pandurangan/Segmentation-In-Gaussian-Splatting: Using DiNO image features along with respective sparse 3D radiance field images to train Gaussian Splats with feature understanding. The implemented method is directly inspired from ‘Interactive Segmentation of Radiance Fields’ (ISRF). The feature trained Gaussian Splats can be clustered through both physical and feature distance for segmentation. [online] GitHub. Available at: https://github.com/Harshavardhan-Pandurangan/Segmentation-In-Gaussian-Splatting/tree/main [Accessed 22 Sep. 2024].