8000 GitHub - yumiian/vehicle-reid: A Streamlit-based application designed for Vehicle Re-Identification (Re-ID) tasks.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

yumiian/vehicle-reid

Repository files navigation

Vehicle Re-identification for Traffic Impact Assessment using Deep Learning

A Streamlit-based application designed for Vehicle Re-Identification (Re-ID) tasks, featuring tasks like Data Preparation, Image Comparison, Data Augmentation, Dataset Split, Model Training, Model Testing and Visualization.

Disclaimer

This code only works in Linux OS. If you are using Windows, you can use WSL (Windows Subsystem for Linux) to install Ubuntu OS on your Windows.

WSL Installation (for Windows)

If you already have Linux OS, you can skip this step.

Install WSL using Windows PowerShell:

wsl --install

or

wsl.exe --install ubuntu

If encounter any error, make sure Windows Subsystem For Linux is turned on in Turn Windows Features On and Off. Then, restart Windows.

Update all packages in Ubuntu:

sudo apt update && sudo apt upgrade

Make sure Python are installed:

sudo apt install python3 python3-pip

Getting Started

There are two methods to install and use the application.

1. Local Method

First, clone the repo or download the latest source code from releases.

Create new virtual environment:

$ python3 -m venv reid
$ source reid/bin/activate

Install CUDA from Nvidia to utilize the power of GPU to train and test the model.

Check your installed CUDA version using this command (cmd):

nvcc --version

Then, install PyTorch based on your installed CUDA version. Example for installing PyTorch for CUDA version 12.1:

$ pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Install the required libraries:

$ pip3 install -r requirements.txt

Finally, open Streamlit GUI:

$ streamlit run gui/app.py

Now you can view the application in your browser. By default, the app local URL is at http://localhost:8501/.

2. Docker Method

If you prefer using Docker instead, make sure you have Docker installed by running this command:

$ sudo docker run hello-world

Note that you have to install PyTorch in your Docker container based on your installed CUDA version.

An example for installing PyTorch for CUDA version 12.1:

Edit the Dockerfile file by adding this line after line 15:

RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Then, build the Docker image for this application:

$ sudo docker build -t vehicle_reid .

Finally, run the Docker container:

$ sudo docker run -p 8501:8501 vehicle_reid

Navigate to http://localhost:8501/ using your browser to view the application.

Screenshots

Image Comparison

compare

Visualization

visualization

Troubleshoot

This message may showed up after opening the Streamlit GUI using WSL.

gio: http://localhost:8501: Operation not supported

Apparently this issue occurs when WSL is trying to open WSL browser instead of Windows Browser. You can safely ignore this or run this command:

$ sudo apt-get install wslu

Acknowledgments

0