|
@echo off
|
|
echo Setting up Traffic Violation Detection System...
|
|
|
|
|
|
net session >nul 2>&1
|
|
if %errorLevel% == 0 (
|
|
echo Running with administrator privileges...
|
|
) else (
|
|
echo Please run this script as administrator
|
|
echo Right-click on setup.bat and select "Run as administrator"
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
|
|
python --version >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Python is not installed. Please install Python 3.8 or higher.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
|
|
if exist venv (
|
|
echo Removing existing virtual environment...
|
|
rmdir /s /q venv
|
|
)
|
|
|
|
|
|
echo Creating virtual environment...
|
|
python -m venv venv
|
|
|
|
|
|
call venv\Scripts\activate
|
|
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
|
|
echo Installing dependencies...
|
|
pip install torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cu118
|
|
pip install -r requirements.txt
|
|
|
|
|
|
if not exist ANPR_IND mkdir ANPR_IND
|
|
if not exist Helmet-Detect-model mkdir Helmet-Detect-model
|
|
if not exist logs mkdir logs
|
|
|
|
|
|
if not exist ANPR_IND\licence_plat.pt (
|
|
echo Warning: ANPR plate detection model not found
|
|
echo Please ensure licence_plat.pt is in the ANPR_IND directory
|
|
)
|
|
|
|
if not exist ANPR_IND\licence_character.pt (
|
|
echo Warning: ANPR character recognition model not found
|
|
echo Please ensure licence_character.pt is in the ANPR_IND directory
|
|
)
|
|
|
|
if not exist Helmet-Detect-model\best.pt (
|
|
echo Warning: Helmet detection model not found
|
|
echo Please ensure best.pt is in the Helmet-Detect-model directory
|
|
)
|
|
|
|
echo Setup completed successfully!
|
|
echo Please run run.bat to start the application.
|
|
pause |