Skip to content

Commit

Permalink
A bit smarter test script to figure out number of batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Cho committed Dec 28, 2016
1 parent c1efc99 commit 25bc6da
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/c3d_ucf101/test_ucf101.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

# get the last model (latest)
LASTMODEL=$(ls -1t examples/c3d_ucf101/c3d_ucf101_iter_*.caffemodel | head -n 1)
echo "[Info] The caffemodel to be used: ${LASTMODEL}"

# check the # test samples and batch_size: 41822/30=1395
NUMITERS=1395
echo "[Info] Tested for ${NUMITERS} iterations"
# model architecture
MODELDEF=examples/c3d_ucf101/c3d_ucf101_test.prototxt
BATCHSIZE=$(egrep batch_size ${MODELDEF} | awk '{print $2}')
NUMTESTEXAMPLES=$(wc -l $(egrep source ${MODELDEF} | awk '{print $2}' | tr -d '"') | awk '{print $1}')
let NUMITERS=(${NUMTESTEXAMPLES}+${BATCHSIZE}-1)/${BATCHSIZE}

echo "[Info] Tested for ${NUMITERS} iterations (${NUMTESTEXAMPLES}/${BATCHSIZE})"

if [ -z "${LASTMODEL}" ]; then
echo "[Error] Can not find the model. Check the caffemodel name."
else
build/tools/caffe \
test \
--model=examples/c3d_ucf101/c3d_ucf101_test.prototxt \
--model=${MODELDEF} \
--weights=${LASTMODEL} \
--iterations=${NUMITERS} \
--gpu=0 \
Expand Down

0 comments on commit 25bc6da

Please sign in to comment.