Skip to content

Commit

Permalink
updated run and cleanup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Martijnsvb committed Jun 16, 2022
1 parent 9001922 commit 9d10ddc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 3 additions & 1 deletion cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ input_dir=$(pwd)/imgs
output_dir=$(pwd)/output
mask=$(pwd)/input_mask
yolo_mask=$(pwd)/YoloV5/yolov5/runs/detect/exp
yolo_txt=$(pwd)/YoloV5/yolov5/runs/detect/exp/labels
display_dir=$(pwd)/steps

while getopts ":a" option; do
case $option in
a) # Add input dir to cleaning
a)
rm $input_dir/*.png
esac
done

rm $mask/*.png
rm $yolo_mask/*.png
rm $yolo_txt/*.txt
rm $display_dir/*.png
rm $output_dir/*.png
5 changes: 4 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ lama_dir=$(pwd)/lama
input_dir=$(pwd)/imgs
output_dir=$(pwd)/output

# Run yolo
cd $yolo_dir
python3 detect.py --weights runs/train/exp10/weights/best.pt --source $input_dir --hide-labels --hide-conf --exist-ok --save-txt --nosave
python3 detect.py --weights runs/train/exp29/weights/best.pt --source $input_dir --hide-labels --hide-conf --exist-ok --save-txt --nosave

# Generate masks
cd $start_dir
python3 mask.py $input_dir $input_dir

# Run lama
cd $lama_dir
export TORCH_HOME=$(pwd) && export PYTHONPATH=.
python3 bin/predict.py model.path=$(pwd)/big-lama indir=$input_dir outdir=$output_dir
10 changes: 2 additions & 8 deletions run_display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ mask=$(pwd)/input_mask
yolo_mask=$(pwd)/YoloV5/yolov5/runs/detect/exp
display_dir=$(pwd)/steps

# Copy input files to display dir and give suffix _a
#cp -a $input_dir/. $display_dir
#cd $display_dir
#for file in *.png; do mv "$file" "${file%.png}_a.png"; done


cd $yolo_dir
python3 detect.py --weights runs/train/exp10/weights/best.pt --source $input_dir --hide-labels --hide-conf --exist-ok --save-txt
python3 detect.py --weights runs/train/exp29/weights/best.pt --source $input_dir --hide-labels --hide-conf --exist-ok --save-txt

# Copy masks
cp -a $input_dir/. $mask
cp -a $input_dir/. $display_dir
cd $start_dir
python3 mask.py $input_dir $mask
cp -a $mask/. $display_dir

# Rename yolo files and copy to display dir
cd $yolo_mask
Expand Down

0 comments on commit 9d10ddc

Please sign in to comment.