image_processor/process.sh
2024-08-13 17:26:11 +00:00

19 lines
473 B
Bash

#!/bin/bash
# Number of parallel jobs
N=8
# Loop through the images in chunks of $N
for ((i=0; i<$(ls frames/ | wc -l); i+=N)); do
# Launch $N jobs in parallel
for ((j=0; j<N; j++)); do
idx=$((i+j))
if [ $idx -lt $(ls frames/ | wc -l) ]; then
python processor.py "frames/$(ls frames/ | sed -n $((idx+1))p)" "output/$(ls frames/ | sed -n $((idx+1))p)" 3000 1&
fi
done
# Wait for the $N jobs to finish before launching the next batch
wait
done