Abs6187's picture
Upload 13 files
44abec2 verified
@echo off
echo Setting up Traffic Violation Detection System...
REM Check if running with admin privileges
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
)
REM Check if Python is installed
python --version >nul 2>&1
if errorlevel 1 (
echo Python is not installed. Please install Python 3.8 or higher.
pause
exit /b 1
)
REM Remove existing venv if it exists
if exist venv (
echo Removing existing virtual environment...
rmdir /s /q venv
)
REM Create new virtual environment
echo Creating virtual environment...
python -m venv venv
REM Activate virtual environment
call venv\Scripts\activate
REM Install/upgrade pip
python -m pip install --upgrade pip
REM Install requirements with specific torch version
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
REM Create necessary directories if they don't exist
if not exist ANPR_IND mkdir ANPR_IND
if not exist Helmet-Detect-model mkdir Helmet-Detect-model
if not exist logs mkdir logs
REM Check for model files
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