robocar-tools/run_training.sh

49 lines
1.4 KiB
Bash
Raw Normal View History

2022-06-10 10:35:01 +00:00
#! /bin/bash
set +e
set +x
RECORDS_PATH=~/src/robocars/data/viva20/viva12/
#TRAINING_OPTS="--horizon=50"
2022-06-10 10:35:01 +00:00
TRAINING_OPTS=""
2022-08-18 17:15:16 +00:00
MODEL_TYPE="categorical"
#MODEL_TYPE="linear"
2022-06-10 10:35:01 +00:00
IMG_WIDTH=160
IMG_HEIGHT=120
HORIZON=20
TRAINING_DIR=~/src/robocars/trainings
TRAINING_DATA_DIR=${TRAINING_DIR}/data
TRAINING_OUTPUT_DIR=${TRAINING_DIR}/output
2022-06-10 10:35:01 +00:00
TRAIN_ARCHIVE=${TRAINING_DATA_DIR}/train.zip
#######################
rm -rf ${TRAINING_DATA_DIR} ${TRAINING_OUTPUT_DIR}
mkdir -p ${TRAINING_DATA_DIR}
mkdir -p ${TRAINING_OUTPUT_DIR}
printf "Build archive %s\n\n" "${TRAIN_ARCHIVE}"
go run ./cmd/rc-tools training archive \
-record-path ${RECORDS_PATH} \
-output ${TRAIN_ARCHIVE} \
-image-height ${IMG_HEIGHT} \
-image-width ${IMG_WIDTH}
printf "\n\nRun training\n\n"
podman run --rm -it \
-v /trainings/data:/opt/ml/input/data/train \
-v /trainings/output:/opt/ml/model/ \
localhost/tensorflow_without_gpu:old \
2022-06-10 10:35:01 +00:00
python /opt/ml/code/train.py \
--img_height=${IMG_HEIGHT} \
--img_width=${IMG_WIDTH} \
--batch_size=32 \
--model_type=${MODEL_TYPE} \
--horizon=${HORIZON} \
${TRAINING_OPTS}
printf "\n\nConvert model\n\n"
edgetpu_compiler -o ${TRAINING_OUTPUT_DIR} ${TRAINING_OUTPUT_DIR}/model_*.tflite