-
Notifications
You must be signed in to change notification settings - Fork 109
/
train.bat
36 lines (31 loc) · 1.1 KB
/
train.bat
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
@echo off
set CAFFE_DIR=..
set DATA=data
set REISZE_DIM=20
set converttool=%CAFFE_DIR%/build/tools/convert_imageset
set finetunemodel=models/plate999.caffemodel
if exist "lmdb/train_lmdb" (set regenlmdb=0) else (set regenlmdb=1)
::set regenlmdb=1
if %regenlmdb% equ 1 goto regeneratelmdb
goto train
:regeneratelmdb
echo "Creating train lmdb..."
del "lmdb/train_lmdb\*.*" /f /s /q
del "lmdb/val_lmdb\*.*" /f /s /q
rd /s /q "lmdb/train_lmdb"
rd /s /q "lmdb/val_lmdb"
rd /s /q lmdb
mkdir lmdb
"%converttool%" --resize_height=%REISZE_DIM% --resize_width=%REISZE_DIM% --shuffle "%DATA%/" "util/train.txt" "lmdb/train_lmdb"
echo "Creating val lmdb..."
"%converttool%" --resize_height=%REISZE_DIM% --resize_width=%REISZE_DIM% --shuffle "%DATA%/" "util/val.txt" "lmdb/val_lmdb"
echo "Computing mean:"
"%CAFFE_DIR%/build/tools/compute_image_mean" "lmdb/train_lmdb" "models/mean.binaryproto"
:train
rem if exist %finetunemodel% (set extra_cmd="--weights=%finetunemodel%")
rem "%CAFFE_DIR%/build/tools/caffe" train --solver=models/solver.prototxt %extra_cmd%
python3 train.py
:evaluation
python util/evaluation.py
echo "Done"
pause