The goal of this section is to get hands-on experience with a simple object detection model and the first step towards object detection.. i.e, Environment Setup
In this section, you will set up the environment using TensorFlow or PyTorch.
To set up the required environment, we’ll use Conda, a powerful package and environment management tool. If you haven't installed Conda yet, download and install Miniconda (lightweight version) or Anaconda (comes with additional data science packages).
[Frankly, I prefer miniconda as it's lighter and allows you to configure environments from scratch]
Once Conda is installed, open your terminal or command prompt and create a new environment with the necessary libraries for object detection.
conda create -n object-detection python=3.9
conda activate object-detection
We will be using either TensorFlow or PyTorch, along with the required dependencies.
Using PyTorch: If you want to use PyTorch, follow these steps to install PyTorch and other necessary libraries.
pip install torch
Using TensorFlow: Alternatively, you can install TensorFlow if you prefer it for this project.
pip install tensorflow
To leverage a GPU for faster processing, you have two main options:
Just download the installer and run it, it will install the software on your system.
Do it for both CUDA and cuDNN installers.
conda install -c conda-forge cudatoolkit=12.6 cudnn=9.1.0
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
python -m pip install "tensorflow<2.11"
But recently there has been a problem with the compatibility of tensorflow with numpy as TF has stopped GPU compatibility for Windows Native after tf.version 2.10.0. If you are wondering why Windows native compatibility is absent in the latest tenserflow version, it is because almost the entire industry uses unix-based operating systems like ubuntu, where such problems do not exist.
To fix that Install a numpy version < 2.0.0
pip install numpy==1.26.0
Runtime > Change runtime type > GPU
).
On a different note, somehow you become a huge fan of the google colab UI (it is similar to jupyter notebook UI), and wish to use your local GPU with google colab, then follow the instructions on this video.
Here is the document explained in the video for using local GPU on colab.
Main Page | Previous Page(Intro) | Next Section(First Object Detector)