Welcome to our guide on implementing 3D Object Detection for Autonomous Driving using PyTorch, specifically trained on the KITTI dataset. In this article, we will walk you through the setup and execution of this project, ensuring you can reproduce these results successfully.
Index
- Using a VM on Paperspace
- Used Datasets
- Pretrained Models
- Training a Model on KITTI
- Running a Pretrained Frustum-PointNet Model on KITTI
- Visualization
- Evaluation
Using a VM on Paperspace
To start your journey, you can utilize an Ubuntu 16.04 P4000 VM with 250 GB SSD on Paperspace. Follow these steps:
- Install Docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
CUDA_REPO_PKG=cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
wget -O tmp/$CUDA_REPO_PKG http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/$CUDA_REPO_PKG
sudo dpkg -i tmp/$CUDA_REPO_PKG
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
rm -f tmp/$CUDA_REPO_PKG
sudo apt-get update
sudo apt-get install cuda-drivers
Afterward, continue by installing nvidia-docker and downloading the PyTorch docker image to complete your setup.
Used Datasets
For training and evaluating the models, the following datasets from KITTI were used:
- KITTI Train: 3712 examples (roughly 50%) from the KITTI training set.
- KITTI Val: 3769 examples from the KITTI training set.
- KITTI Test: 7518 examples.
Pretrained Models
You can utilize several pretrained models as listed below:
- Frustum-PointNet trained for 400 epochs on KITTI train random.
- Extended-Frustum-PointNet trained for 400 epochs on KITTI train random.
- Image-Only trained for 400 epochs on KITTI train random.
Training a Model on KITTI
Once you have SSH’d into the Paperspace server, follow these steps:
- Execute the following command to start the Docker image:
sudo sh start_docker_image.sh
python 3DOD_thesis/Frustum-Point-Net/train_frustum_pointnet.py
Running a Pretrained Frustum-PointNet Model on KITTI
Similarly, to run the pretrained model evaluation, follow these steps:
- SSH into the Paperspace server and start Docker:
sudo sh start_docker_image.sh
python 3DOD_thesis/Frustum-PointNet/eval_frustum_pointnet_val.py
Once you run this script, it will output several metrics, including validation loss and accuracy. These metrics help you gauge model performance.
Visualization
To visualize point clouds and detection results, you can use Open3D. Follow these steps:
- Install Open3D:
git clone https://github.com/IntelVCL/Open3D
cd Open3D
scripts/install-deps-ubuntu.sh
mkdir build
cd build
cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python .. src
make -j
python visualization/visualize_eval_val.py
Evaluation
To compute evaluation metrics, ensure to run your pretrained models with the following steps:
- Place the created
eval_dict_val.pkl
in the correct directory and run:
python evaluation/create_txt_files_val.py
This will create metrics that reflect your model’s performance on the KITTI dataset.
Troubleshooting
If you encounter issues while setting up or running the models, consider the following troubleshooting ideas:
- Ensure that all dependencies are installed correctly.
- Check the compatibility of the installed Python version and required libraries.
- Review the provided model paths to ensure they are correctly set.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Analogy to Explain the Code
Imagine you are a chef preparing a gourmet dish. Each recipe step corresponds to a line of code in the training script. You carefully select your ingredients (datasets), follow the recipe precisely (running the code), and adjust temperatures and timings (tuning parameters) based on how the dish is cooking (model validation results).
In this light, your kitchen tools like knives and pans are akin to the libraries and frameworks you leverage in the coding process—essential for creating that perfect dish, just as they are vital for achieving accurate model predictions.