Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iaverypadberg/3423b1aa7d448e0ddd009a9787398a5b to your computer and use it in GitHub Desktop.
Save iaverypadberg/3423b1aa7d448e0ddd009a9787398a5b to your computer and use it in GitHub Desktop.
ssd_mobilenet training on ubuntu 20.04-with gpu - conda & pip

Configuring a tensorflow environment to work with gpu's is really annoying. Thankfully, conda & pipmake it a lot less annoying.

Here are the core dependencies for getting this to work.

  • cudatoolkit=11.6.0
  • cudnn=8.2.1.32
  • tensorflow=2.7.0
  • tensorflow-gpu=2.7.0
  • tensorflow-io=0.25.0
  • python=3.9
  • keras=2.7.0

You could probably try to install each of these individually, but you might run into some issues. Give it a shot or follow how I did it below.

Update your nvidia drivers to the latest version. You can check your driver version by using the nvidia-smi command and looking at the top. Here is my current setup: Driver Version: 510.60.02 CUDA Version: 11.6

Configure your conda environment

  1. Install miniconda
  2. Create a conda environment with tensorflow-gpu support.
conda create --name tensorflow-27 tensorflow-gpu

This should create an environment which has almost all of the right dependencies, but the wrong versions. Use the conda list command to see what packages you have installed.

  1. Install tensorflow 2.7.0 with pip install tensorflow==2.7.0
  2. Install/upgrade tensorflow-io with pip install tensorflow-io=0.25.0
  3. Install tensorflow-gpu with conda-forge conda install -c conda-forge tensorflow-gpu=2.7.0(this will ask to change a bunch of packages around, accept it.)
  4. Should be good to go! Install the tensorflow Object Detection API
  5. Verify the install by running python object_detection/builders/model_builder_tf2_test.py
  6. Point Python to Object Detection API export PYTHONPATH=$PYTHONPATH:/home/da/Documents/git-repos/models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment