Skip to content

Setup JupyterLab Coding Environment with Google Colab

till.beemelmanns@ika.rwth-aachen.de edited this page Apr 11, 2023 · 2 revisions

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

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

Clone acdc-notebooks

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

image

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.

Upload the acdc-notebooks to google drive

  1. Open the web browser and sign into your gmail account.
  2. 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
  3. 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.

image

Start the google colab notebook environment in the web-browser

  1. 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
  2. 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

image

  1. You can setup the runtime and use GPU to run your code, Runtime >> Change Runtime type >> choose from the dropdown >> save

Mount the data from google drive inside the colab environment

  1. 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. image

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

image

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,

image

Install the dependencies to run the acdc-notebooks

  1. 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

  1. Install the all the dependencies needed to run the notebooks

!pip install -r requirements.txt

  1. Now Restart the Runtime to use the newly installed versions,

image

Clone and install the Point pillars github repositories

!pip install git+https://github.com/ika-rwth-aachen/PointPillars.git@fix/ika-changes

Adjust the paths to access the data from acdc-notebooks folder mounted on the drive

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,

  1. 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
  1. 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"

Import the widget to visualize the plots in the colab environment

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()

image

Run the the colab file and save the copy in the drive

  1. 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
  2. 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.

Clone this wiki locally