Files
R-clone-setup/generator/generate.sh

30 lines
872 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Fake "algorithm3" — produces files the way the real GPU container would:
# a processed anomaly image + a results CSV every $INTERVAL seconds.
INTERVAL="${INTERVAL:-45}"
mkdir -p /out/image_root_dir /out/csv_files
N=0
while true; do
N=$((N + 1))
TS=$(date '+%Y%m%d_%H%M%S')
# Fake "image": random bytes, 100500 KB, so transfers are visible in stats
SIZE_KB=$(( (N * 97) % 400 + 100 ))
dd if=/dev/urandom of="/out/image_root_dir/anomaly_${TS}.jpg" \
bs=1024 count="$SIZE_KB" 2>/dev/null
# Fake results CSV
{
echo "frame,chainage,class,confidence,timestamp"
i=0
while [ $i -lt 5 ]; do
i=$((i + 1))
echo "${N},${i}.$((N % 10)),pothole,0.$((70 + i)),${TS}"
done
} > "/out/csv_files/results_${TS}.csv"
echo "[generator] #${N}: anomaly_${TS}.jpg (${SIZE_KB}KB) + results_${TS}.csv"
sleep "$INTERVAL"
done