Image Segmentation Tutorial#

Run on Google Colab View source on GitHub Download notebook

Start EVA server#

We are reusing the start server notebook for launching the EVA server.

!wget -nc "https://raw.githubusercontent.com/georgia-tech-db/eva/master/tutorials/00-start-eva-server.ipynb"
!pip install timm
%run 00-start-eva-server.ipynb
stop_eva_server()
cursor = connect_to_server()
File ‘00-start-eva-server.ipynb’ already there; not retrieving.
Requirement already satisfied: timm in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (0.6.13)
Requirement already satisfied: huggingface-hub in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from timm) (0.14.1)
Requirement already satisfied: pyyaml in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from timm) (6.0)
Requirement already satisfied: torchvision in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from timm) (0.14.0)
Requirement already satisfied: torch>=1.7 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from timm) (1.13.0)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torch>=1.7->timm) (11.7.99)
Requirement already satisfied: typing-extensions in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torch>=1.7->timm) (4.4.0)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torch>=1.7->timm) (11.7.99)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torch>=1.7->timm) (11.10.3.66)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torch>=1.7->timm) (8.5.0.96)
Requirement already satisfied: wheel in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.7->timm) (0.38.4)
Requirement already satisfied: setuptools in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.7->timm) (65.6.0)
Requirement already satisfied: packaging>=20.9 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from huggingface-hub->timm) (23.0)
Requirement already satisfied: requests in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from huggingface-hub->timm) (2.28.1)
Requirement already satisfied: fsspec in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from huggingface-hub->timm) (2023.4.0)
Requirement already satisfied: filelock in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from huggingface-hub->timm) (3.8.0)
Requirement already satisfied: tqdm>=4.42.1 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from huggingface-hub->timm) (4.64.1)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torchvision->timm) (9.0.1)
Requirement already satisfied: numpy in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from torchvision->timm) (1.23.4)
Requirement already satisfied: certifi>=2017.4.17 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from requests->huggingface-hub->timm) (2022.9.24)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from requests->huggingface-hub->timm) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from requests->huggingface-hub->timm) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/jarulraj3/eva/test_evadb/lib/python3.10/site-packages (from requests->huggingface-hub->timm) (1.26.12)
[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Note: you may need to restart the kernel to use updated packages.
nohup eva_server > eva.log 2>&1 &
[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Note: you may need to restart the kernel to use updated packages.

Download the Videos#

# # Getting the video files
!wget -nc "https://www.dropbox.com/s/k00wge9exwkfxz6/ua_detrac.mp4?raw=1" -O ua_detrac.mp4
File ‘ua_detrac.mp4’ already there; not retrieving.

Load sample video from DAVIS dataset for analysis#

cursor.execute('DROP TABLE IF EXISTS VideoForSegmentation;')
response = cursor.fetch_all()
response.as_df()
cursor.execute('LOAD VIDEO "ua_detrac.mp4" INTO VideoForSegmentation')
response = cursor.fetch_all()
response.as_df()
0
0 Number of loaded VIDEO: 1

Visualize Video#

from IPython.display import Video
Video("ua_detrac.mp4", embed=True)