Setup JupyterLab Coding Environment with Google Colab - ika-rwth-aachen/acdc GitHub Wiki
In this unit we will setup the Google colab environment, which is cloud-based notebook environment that can be used alternatively to complete the ACDC Notebook exercises.
- Contents
- List of Notebooks
- Clone acdc-notebooks
- Upload the acdc-notebooks to google drive
- Start the google colab notebook environment in the web-browser
- Mount the data from google drive inside the colab environment
- Install the dependencies to run the acdc-notebooks
- Clone and install the Point pillars github repositories
- Adjust the paths to access the data from acdc-notebooks folder mounted on the drive
- Import the widget to visualize the plots in the colab environment
- Run the the colab file and save the copy in the drive
Note: There are certain notebooks for which we would need the ROS dependent Lanelet model, and since we don't have an ROS support inside the colab, we would not be able to run those notebooks in the Google Colab.
The list of Exercises which can not be run in the Google Colab environment is as follows,
-
Section_4_Vehicle_guidance
>>1_route_planning.ipynb
Start a terminal on your Linux/MacOS system and navigate to a directory where you want to store the acdc-notebooks repository. If you have never used a Unix-Shell (terminal) before, we strongly suggest you to do an online tutorial before you start this course.
We suggest you to navigate to the directory ~/Documents which is located in you ~/home directory,
and clone the acdc-notebooks repository there with the following command
git clone https://github.com/ika-rwth-aachen/acdc-notebooks.git
Note that you can clone the repository to any directory on your machine you want. This might be ~/Documents/acdc-notebooks or ~/acdc-notebooks or some other directory.
- Open the web browser and sign into your gmail account.
- Next to the profile picture, you would see the google apps options, click on that and choose the google drive, and navigate to the google drive or you can directly navigate to this link, Google drive
- Once you are in the google drive, click on the New (+) option and click on the Folder upload, now choose the acdc-notebooks folder on your system, and click upload. Once this folder upload has been completed, you can try setting up the google colab environment from the browser.
- Go to the following link to start the notebook environment google colab link, and click on the new notebook and it will open the new cloud based notebook in the browser and upload the desired notebook there or
- Navigate to that folder in drive,
My Drive >> acdc-notebooks >> <Desired section of the course, i.e, section_1_introduction_and_tools>
and launch that notebook by right clicking on it and click,
Open with >> Google Colabaratory
- You can setup the runtime and use GPU to run your code, Runtime >> Change Runtime type >> choose from the dropdown >> save
- You are supposed to add a few empty code cells by clicking the Code cell button at the beginning of the notebook to mount the acdc-notebooks folder inside the colab environment.
2.You can now mount the Google Drive locally in the colab environment.The example below shows how to mount your Google Drive on your runtime using an authorization code, and how to write and read files there. Once executed, you will be able to see the acdc-notebooks folder at https://drive.google.com/.
To mount the drive, please run the following commands in a code cell,
from google.colab import drive
drive.mount('/content/drive')
Now colab notebook would try to connect to your personal google drive linked to your gmail, for the click on, Connect to the Google Drive
Then select your email address >> Pass the security checks >> click on the "Allow" Button
with these steps, the drive would be mounted inside the google colab, which is confirmed when you see this message at the output,
- Then navigate to the location inside the acdc-notebooks folder where requirements.txt file is located as follows
%cd /content/drive/MyDrive/acdc-notebooks/docker/
!ls
- Install the all the dependencies needed to run the notebooks
!pip install -r requirements.txt
- Now Restart the Runtime to use the newly installed versions,
!pip install git+https://github.com/ika-rwth-aachen/PointPillars.git@fix/ika-changes
Now hereon-wards, you can adjust the paths to access various files in the google drive depending on the exercise you are solving.
We would show you, how you can adjust the paths with the example of the object detection.ipynb notebook,
- First of all, Navigate to the directory, section_2_sensor_data_processing where our object_detection.ipynb exercise is located using the %cd command as follows,
%cd /content/drive/MyDrive/acdc-notebooks/section_2_sensor_data_processing/
!ls
- Now store the path to datsets and pretrained model in the DATA_ROOT and MODEL_ROOT variables as follows,
DATA_ROOT = "/content/drive/MyDrive/acdc-notebooks/section_2_sensor_data_processing/datasets/kitti/"
MODEL_ROOT = "/content/drive/MyDrive/acdc-notebooks/section_2_sensor_data_processing/object_detection/model"
Since %matplotlib widget is not supported in the google colab environment, we need to install custom_widget_manager by runing the below command in the cell above the visualization cell,
from google.colab import output
output.enable_custom_widget_manager()
- Now you can add the solution code in the desired cells and run those cells by clicking the radio button next to it or shift+Enter
- once you are done using the notebook, try to save it in the drive so that you could use it again.
In case, you have any difficulty setting up the environment, do let us know here with the detailed description of your error.