---
# System prepended metadata

title: Untitled

---

## Vid Detek
```sh=
# ./vid_detek.sh file_video threshold num_target
# ./vid_detek.sh ikan.mp4 22 50
rm -f *.txt *.avi *.jpg hasil.mp4 a.sh
detikmulai=$(date +"%s")
pilihan_cofindence=$(<data.coef)
echo "Pilihan Confidence = $pilihan_cofindence"
rm -f hasil-lengkap.txt
echo " Penghitungan ikan dalam proses" > hasil-lengkap.txt

rm -f *filtered.jpg
#weight="yolov4-tiny-crowd-16-41-2021-11-05-all"
weight="yolov4-tiny-crowd-15-46-2021-11-15-all"
rm -f total-crowd.txt
rm -f log-crowd.txt
rm -f log-ikan.txt
rm -f result.txt
#python3 fish_detection_yolo.py --video $1 --conf 22 --nms 0.4  --weight yolov4-tiny-ikan-20-55-2021-11-26-all --num_target 0
python3 crowd_filter.py --video $1 --weight $weight
num_clean=$(<num_clean.txt)
echo "Jumlah Frame Clear = $num_clean"
if [ "$num_clean" -lt "3" ]
  then
     echo "RERUN CROWD fILTER" 
     weight="yolov4-tiny-crowd-16-41-2021-11-05-all"
     python3 crowd_filter.py --video $1 --weight $weight
fi  
if [ "$num_clean" == "0" ]
  then 
     echo "VIDEO TERLALU CROWDED" > filter.txt
     exit  
fi  

#echo ""
FILE="$1"
#echo ${FILE##*/}
video=${FILE%.*}
#python3 crowd_filter.py --video ikan-30-4detik.mp4
rm -f extracted-$video.mp4
ffmpeg -y -hide_banner -loglevel error -framerate 30 -pattern_type glob -i '*filtered.jpg'  -c:v libx264 -pix_fmt yuv420p extracted-$video.mp4


#weight=yolov4-tiny-ikan-17-35-2021-11-15-all
#the best
#weight=yolov4-tiny-ikan-20-12-2021-11-16-all
#weight=yolov4-tiny-ikan-18-30-2021-11-17-all
#weight=yolov4-tiny-ikan-18-35-2021-11-18-all
#weight=yolov4-tiny-ikan-21-38-2021-11-18-all
#weight=yolov4-tiny-ikan-17-15-2021-11-22-all
#weight=yolov4-tiny-ikan-16-46-2021-11-23-all
#weight=yolov4-tiny-ikan-19-00-2021-11-24-all
#weight=yolov4-tiny-ikan-14-47-2021-11-25-all
#weight=yolov4-tiny-ikan-18-46-2021-11-25-all
#weight=yolov4-tiny-ikan-16-21-2021-11-26-all
weight=yolov4-tiny-ikan-tgl-2022-04-12-jam-17-26-gray-edge
rm -f extr-$video-$weight-conf_$conf-yolo.avi
conf=$2
echo "Confidence = $conf"
#python3 fish_detection_yolo.py --video extracted-$video.mp4 --conf $conf --nms 0.4  --weight $weight --num_target 0 
python3 fish_detection_yolo.py --video extracted-$video.mp4 --conf $conf --nms 0.4  --weight $weight --num_target 0 
cp hasil-test.txt hasil-lengkap.txt
rm -f *filtered.jpg
rm -f extr-$video-$weight-conf_$conf-yolo.mp4

ffmpeg -hide_banner -loglevel error -y -i extracted-$video-$weight-conf_$conf-yolo.avi extracted-$video-$weight-conf_$conf-yolo.mp4
rm -f extracted-$video-$weight-conf_$conf-yolo.avi
mv extracted-$video-$weight-conf_$conf-yolo.mp4 hasil.mp4

detikakhir=$(date +"%s")
myVal2=$( expr $detikakhir - $detikmulai)
echo "VIDEO SUKSES DIFILTER" > filter.txt
echo "Lama perhitungan adalah $myVal2 detik" > durasi.txt

```
