Welcome to this lab in the computer vision course TEK5030 at the University of Oslo. In this lab we will play with pre-trained models that are available in the Model Zoo For OpenCV DNN.
Make sure to check the prerequisites before getting started.
Start by cloning this repository on your machine.
Initialize the Python environment using uv.
First, install uv:
curl -LsSf https://astral.sh/uv/install.sh | shThen set up the project:
# Clone the lab
git clone https://github.com/tek5030/lab-dnn.git
cd lab-dnn
# Install dependencies
uv sync
# Activate the environment
source .venv/bin/activateAlternatively, using pip:
# Clone the lab
git clone https://github.com/tek5030/lab-dnn.git
cd lab-dnn
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install -r requirements.txt
python -m ipykernel install --user --name=venvThen, download the opencv_zoo within the project directory.
# Pull the model zoo
git clone --depth 1 https://huggingface.co/opencv/opencv_zoo && cd opencv_zoo
git lfs install
git lfs pullOpen the project in PyCharm. If you are uncertain about how this is done, please take a look at the intro lab.
We added some fun examples that use techniques that are relevant for the course. They should be able to run with the environment set up in the previous step. It's anything to complete, but you can run the main.py files, and potentially play around with the code.
The lab is carried out by following these steps:
- Get an overview
- Play around with examples from the OpenCV model zoo
- Play around with examples from the OpenCV dnn tutorials
- Further work
Please start the lab by going to the first step.
If you are on Ubuntu and haven't completed the intro lab, the following should be sufficient for this lab.
sudo apt update
sudo apt install python3 python3-dev python3-distutils python3-venv python-is-python3The OpenCV model zoo repository requires git lfs (Git Large File System):
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt install git-lfs