File size: 1,967 Bytes
44abec2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@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