Vehicle detection and classification project (2024)
In this project, the aim is to train machine learning models for detection and classification of vehicles and run them in a web application for real-time inference. The project focuses on utilizing computer vision techniques to automatically identify vehicles in a road and classify vehicles based on their make and model.
Prior to installing WSL in Windows
Steps to install WSL in Windows
wsl --status
sudo apt update && sudo apt install git
Open a new terminal in VS Code and execute:
git clone https://github.com/carvarsou/Vehicle-Classification
Execute these commands to install Miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
Check if Miniconda is added to the PATH:
nano ~/.bashrc
export PATH="$HOME/miniconda3/bin:$PATH"
Reload the Shell Configuration:
source ~/.bashrc
Verify installation:
conda --version
Install a new environment:
conda create --name env python=3.10
If you already have an environment to use, downgrade the version as so:
conda activate <your_env>
conda install python=3.10
Activate the Environment:
conda init
conda activate env
To deactivate:
conda deactivate env
Install the requirements:
Make sure Conda Environment is now activated. Then install Torch and other packages:
pip install -r requirements.txt
Install npm and node.js:
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
cd ~/.nvm && nvm install 22
npm install -g pnpm
python -m core.detect_vehicles.yolov5.train
python -m core.detect_vehicles.yolov8.train
python -m core.classify_vehicles.efficientnet_b1.train
python -m core.classify_vehicles.yolov8.train
...
cd <path_to>/Vehicle-Classification
# Generates .env file for local settings
echo -e "DJANGO_KEY='$(python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')'\nDEBUG=True" > .env
# Runs SQLite server
./webapp/vc_backend/manage.py makemigrations
./webapp/vc_backend/manage.py migrate
./webapp/vc_backend/manage.py runserver
The app uses Vue.js 3 + Vite as the frontend framework.
Open another terminal:
cd <path_to>/Vehicle_Classification/webapp/vc_frontend/perseidai
pnpm up
pnpm dev
This project is released under the Apache 2.0 License. For more information, check: https://www.apache.org/licenses/LICENSE-2.0.
Carlos Varela Soult (carvarsou)