Table of Contents

Python and PyTorch Development

This page is based on the one of RPZ course.

Common Issues and Solutions

Assignment Templates

This setup is recommended by Dmytro Mishkin
1. Install Miniconda, Python version 3.X.
2. Run conda CLI.
3. For Linux users run

git clone https://gitlab.fel.cvut.cz/mishkdmy/mpv-python-assignment-templates
cd mpv-python-assignment-templates/conda_env_yaml
conda env create -f environment-cpu.yml 

3* For Windows users:

git clone https://gitlab.fel.cvut.cz/mishkdmy/mpv-python-assignment-templates
conda create --name mpv-assignments-cpu-only python=3.6
conda activate mpv-assignments-cpu-only
conda install pytorch torchvision cpuonly -c pytorch
pip install kornia tqdm notebook matplotlib opencv-contrib-python seaborn tensorboard tensorboardX
conda install -c conda-forge widgetsnbextension
conda install -c conda-forge ipywidgets

 

4. a) Activate the environment with

conda activate mpv-assignments-cpu-only
and work in the python interactive interpreter.
5. b) Use the IDE of your choice (IntelliJ PyCharm, of course) and set the interpreter of your project to the python executable/binary in your environment's path. Run your scripts using PyCharm's configurations.How to find the path to your environment's interpreter?

Running the assignments in Google Colab

It is possible to do all the work in cloud Google Colab without installing anything. You would need to have Google account though.

  1. Git clone or download the assignment templates from the repository
  2. Click File → Upload notebook and upload the notebook for the the relevant assignment
  3. Click of the files icon (in gray ellipse on the screenshot) and then on “Upload”
  4. Upload relevant assignment .py together with all relevant input data such as images.
  5. In the beginning of the first cell add
     !pip install kornia
  6. Work in Google Colab as if you were in Jupyter notebook. In the end of the session download the functions you developed with File → Download
  7. If you need to use GPU, go to Edit→Notebook settings. Select Hardware accelerator to be GPU. Note, that you are limited to 6 hours of GPU use per day (this info might be obsolete, as Google policy on free GPUs may change)