Instead of using the traditional way, namely, the simple stereo or horizontal stereo, to recover the 3D structure of a scene from two 2D images, we perfer to obtain the 3D object position directly from 2D images with Machine Learning methods.
The project is divided into two stages.
- Generate ourselves training dataset with the python library Kubric.
- Train ResNet model according to the dataset we generated in the first step.
- Visualize the output of our model.
The whole project is developed in Linux operating system. With Windows platform, it is necessary to install wsl and use Ubuntu on Windows to run the program. The instruction of installation only contains instructions for Linux OS.
-
Set up the repository
sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Install Docker Engine
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
-
Validation the installation
sudo docker run hello-world
-
Install Kubirc
git clone https://github.com/google-research/kubric.git cd kubric
-
Deploy Docker
docker pull kubricdockerhub/kubruntu
-
Validation the installation
docker run --rm --interactive \ --user $(id -u):$(id -g) \ --volume "$(pwd):/kubric" \ kubricdockerhub/kubruntu \ /usr/bin/python3 examples/helloworld.py ls output
After installed all necessary enviroment, put the folder ML_Project and Models into the current working path. ML_Project contains all developed codes and output. Models contains the probe construction data which will be used in dataset generation part.
All used resources in the generation procedure is stored in the Google Store.
- kubasic assets: gs://kubric-public/assets/KuBasic/
- HDRI assets: gs://kubric-public/assets/HDRI_haven/
The code for generating is located in folder ML_Project with file name Dataset_Generation.py. The generation code is:
cd kubric
docker run --rm --interactive \
--user $(id -u):$(id -g) \
--volume "$(pwd):/kubric" \
kubricdockerhub/kubruntu \
/usr/bin/python3 ML_Project/Dataset_Generation.py
It is also possible to set parameters in dataset generation process.
--r_interval: value of distance change between different r
--r_change_number: change time of parameter r
--phi_change_number: change time of parameter phi
--theta_change_number: change time of parameter theta
--bg_change_number: change time of background
--backgrounds_split: select to use backgrounds in training or test sets
- Xingchen Li
- JackRuihang
- shcSteven