model.pth
Browse files
video_super_resolution/scripts/inference_sr.sh
CHANGED
|
@@ -1,56 +1,56 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
# Folder paths
|
| 4 |
-
video_folder_path='./input/video'
|
| 5 |
-
txt_file_path='./input/text/prompt.txt'
|
| 6 |
-
|
| 7 |
-
# Get all .mp4 files in the folder using find to handle special characters
|
| 8 |
-
mapfile -t mp4_files < <(find "$video_folder_path" -type f -name "*.mp4")
|
| 9 |
-
|
| 10 |
-
# Print the list of MP4 files
|
| 11 |
-
echo "MP4 files to be processed:"
|
| 12 |
-
for mp4_file in "${mp4_files[@]}"; do
|
| 13 |
-
echo "$mp4_file"
|
| 14 |
-
done
|
| 15 |
-
|
| 16 |
-
# Read lines from the text file, skipping empty lines
|
| 17 |
-
mapfile -t lines < <(grep -v '^\s*$' "$txt_file_path")
|
| 18 |
-
|
| 19 |
-
# List of frame counts
|
| 20 |
-
frame_length=32
|
| 21 |
-
|
| 22 |
-
# Debugging output
|
| 23 |
-
echo "Number of MP4 files: ${#mp4_files[@]}"
|
| 24 |
-
echo "Number of lines in the text file: ${#lines[@]}"
|
| 25 |
-
|
| 26 |
-
# Ensure the number of video files matches the number of lines
|
| 27 |
-
if [ ${#mp4_files[@]} -ne ${#lines[@]} ]; then
|
| 28 |
-
echo "Number of MP4 files and lines in the text file do not match."
|
| 29 |
-
exit 1
|
| 30 |
-
fi
|
| 31 |
-
|
| 32 |
-
# Loop through video files and corresponding lines
|
| 33 |
-
for i in "${!mp4_files[@]}"; do
|
| 34 |
-
mp4_file="${mp4_files[$i]}"
|
| 35 |
-
line="${lines[$i]}"
|
| 36 |
-
|
| 37 |
-
# Extract the filename without the extension
|
| 38 |
-
file_name=$(basename "$mp4_file" .mp4)
|
| 39 |
-
|
| 40 |
-
echo "Processing video file: $mp4_file with prompt: $line"
|
| 41 |
-
|
| 42 |
-
# Run Python script with parameters
|
| 43 |
-
python \
|
| 44 |
-
./video_super_resolution/scripts/inference_sr.py \
|
| 45 |
-
--solver_mode 'fast' \
|
| 46 |
-
--steps 15 \
|
| 47 |
-
--input_path "${mp4_file}" \
|
| 48 |
-
--model_path /mnt/bn/videodataset/VSR/pretrained_models/STAR/model.
|
| 49 |
-
--prompt "${line}" \
|
| 50 |
-
--upscale 4 \
|
| 51 |
-
--max_chunk_len ${frame_length} \
|
| 52 |
-
--file_name "${file_name}.mp4" \
|
| 53 |
-
--save_dir ./results
|
| 54 |
-
done
|
| 55 |
-
|
| 56 |
echo "All videos processed successfully."
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Folder paths
|
| 4 |
+
video_folder_path='./input/video'
|
| 5 |
+
txt_file_path='./input/text/prompt.txt'
|
| 6 |
+
|
| 7 |
+
# Get all .mp4 files in the folder using find to handle special characters
|
| 8 |
+
mapfile -t mp4_files < <(find "$video_folder_path" -type f -name "*.mp4")
|
| 9 |
+
|
| 10 |
+
# Print the list of MP4 files
|
| 11 |
+
echo "MP4 files to be processed:"
|
| 12 |
+
for mp4_file in "${mp4_files[@]}"; do
|
| 13 |
+
echo "$mp4_file"
|
| 14 |
+
done
|
| 15 |
+
|
| 16 |
+
# Read lines from the text file, skipping empty lines
|
| 17 |
+
mapfile -t lines < <(grep -v '^\s*$' "$txt_file_path")
|
| 18 |
+
|
| 19 |
+
# List of frame counts
|
| 20 |
+
frame_length=32
|
| 21 |
+
|
| 22 |
+
# Debugging output
|
| 23 |
+
echo "Number of MP4 files: ${#mp4_files[@]}"
|
| 24 |
+
echo "Number of lines in the text file: ${#lines[@]}"
|
| 25 |
+
|
| 26 |
+
# Ensure the number of video files matches the number of lines
|
| 27 |
+
if [ ${#mp4_files[@]} -ne ${#lines[@]} ]; then
|
| 28 |
+
echo "Number of MP4 files and lines in the text file do not match."
|
| 29 |
+
exit 1
|
| 30 |
+
fi
|
| 31 |
+
|
| 32 |
+
# Loop through video files and corresponding lines
|
| 33 |
+
for i in "${!mp4_files[@]}"; do
|
| 34 |
+
mp4_file="${mp4_files[$i]}"
|
| 35 |
+
line="${lines[$i]}"
|
| 36 |
+
|
| 37 |
+
# Extract the filename without the extension
|
| 38 |
+
file_name=$(basename "$mp4_file" .mp4)
|
| 39 |
+
|
| 40 |
+
echo "Processing video file: $mp4_file with prompt: $line"
|
| 41 |
+
|
| 42 |
+
# Run Python script with parameters
|
| 43 |
+
python \
|
| 44 |
+
./video_super_resolution/scripts/inference_sr.py \
|
| 45 |
+
--solver_mode 'fast' \
|
| 46 |
+
--steps 15 \
|
| 47 |
+
--input_path "${mp4_file}" \
|
| 48 |
+
--model_path /mnt/bn/videodataset/VSR/pretrained_models/STAR/model.pth \
|
| 49 |
+
--prompt "${line}" \
|
| 50 |
+
--upscale 4 \
|
| 51 |
+
--max_chunk_len ${frame_length} \
|
| 52 |
+
--file_name "${file_name}.mp4" \
|
| 53 |
+
--save_dir ./results
|
| 54 |
+
done
|
| 55 |
+
|
| 56 |
echo "All videos processed successfully."
|