Gary Sieling

Loop over a randomized list of files in bash

You can do this using a combination of “shuf” and “head”:

for IMAGE in $(ls -c --format=single-column logos/images | shuf | head -n 10);
do
        echo logos/images/$IMAGE        
        python3 predict.py -m ./output.h5 -i logos/images/$IMAGE --confidence 0.5 --labels logos/retinanet_classes.csv
done
Exit mobile version