willprice / flowty

The swiss army knife for extracting optical flow
https://flowty.rtfd.org
16 stars 1 forks source link

Processing all files in a directory #41

Closed ir0nt0ad closed 4 years ago

ir0nt0ad commented 4 years ago

Is this currently supported? *.mp4 threw an error for me.

willprice commented 4 years ago

Hi @sh0gg0th, This is not currently supported, and I probably don't intend to add it. I usually just write a wrapper scrip in bash for this sort of thing:

#!/usr/bin/env bash
set -eu

MEDIA_ROOT="$HOME/videos"
OUTPUT_ROOT="$HOME/flow"
shopt -s globstar

mkdir -p "$OUTPUT_ROOT"
for f in "$MEDIA_ROOT"/**/*.mp4; do
    relative_path="${f#$MEDIA_ROOT/}"
    docker run \
        -it \
        --rm \
        --runtime=nvidia \
        --mount type=bind,source="$MEDIA_ROOT",target=/data/input \
        --mount type=bind,source="$OUTPUT_ROOT",target=/data/output \
        willprice/flowty tvl1 \
        "/data/input/${relative_path}" \
        "/data/output/${relative_path%%.mp4}/{axis}/{index:05d}.jpg" \
        --cuda
done

Hope that helps.

ir0nt0ad commented 4 years ago

@willprice understood, thanks. Would it make sense to run a looping script from within the container instead, or there's not a lot of overhead involved in running the container every time?

willprice commented 4 years ago

Yeah sure, you could modify the script and mount it inside too, that would work well and avoid the additional container startup times, although typically its ~100ms or so which is usually neglible compared to the overall flow computation time.

ir0nt0ad commented 4 years ago

I see, thanks again!