Last active
November 30, 2019 20:28
-
-
Save kiyoon/25b2a3d2483a21d8239c823cca355b14 to your computer and use it in GitHub Desktop.
Chooses 20 samples from the input directory and run Faster R-CNN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 2 ] | |
then | |
echo "usage: $0 [input_dir] [output_dir]" | |
echo "chooses 20 video files randomly from the input directory and run Faster R-CNN" | |
exit 1 | |
fi | |
input_dir="$1" | |
output_dir="$2" | |
files=$(find "$input_dir" -type f -name "*.avi" -o -name "*.mp4" -o -name "*.MP4" | shuf | head -20) | |
input_dir_parent=$(dirname "$input_dir") | |
while read line | |
do | |
input_file="$line" | |
output_file=$(echo "$input_file" | sed "s|$input_dir_parent|$output_dir|") | |
echo "Processing $input_file" | |
echo "Saving to $output_file" | |
mkdir -p $(dirname "$output_file") | |
python3 /detectron2_repo/demo/demo.py --config-file /detectron2_repo/configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml --video-input "$input_file" --confidence-threshold 0.6 --output "$output_file" --opts MODEL.WEIGHTS detectron2://COCO-Detection/faster_rcnn_R_101_FPN_3x/137851257/model_final_f6e8b1.pkl | |
done <<< "$files" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment