first commit
This commit is contained in:
commit
b680e09bbe
568 files changed
+54067
No files matched your search
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
MODEL="$ROOT_DIR/weights/uav_drone_yolov8s_best.pt"
|
||||
LOGO="$ROOT_DIR/ykz.png"
|
||||
OUTPUT="$ROOT_DIR/outputs"
|
||||
|
||||
mkdir -p "$OUTPUT"
|
||||
|
||||
COMMON_ARGS=(
|
||||
--model "$MODEL"
|
||||
--logo "$LOGO"
|
||||
--classes 0
|
||||
--display-class-name drone
|
||||
--imgsz 1280
|
||||
--conf 0.12
|
||||
--display-conf 0.32
|
||||
--display-min-hits 4
|
||||
--det-iou 0.50
|
||||
--tracker motion
|
||||
--max-missed 45
|
||||
--max-match-gap 60
|
||||
--reconnect-buffer 45
|
||||
--min-hits 8
|
||||
--new-track-conf 0.34
|
||||
--smooth-alpha 0.75
|
||||
--track-nms-iou 0.45
|
||||
--track-nms-center 0.75
|
||||
--stitch-ids
|
||||
--stitch-buffer 45
|
||||
--stitch-min-gap 15
|
||||
--trail-length 180
|
||||
)
|
||||
|
||||
python3 run_detect_track.py \
|
||||
--input "$ROOT_DIR/test_video/test_video_1.mp4" \
|
||||
--output "$OUTPUT" \
|
||||
--rescue-detections \
|
||||
--rescue-conf 0.45 \
|
||||
--rescue-max-missed 20 \
|
||||
"${COMMON_ARGS[@]}"
|
||||
|
||||
for video in "$ROOT_DIR"/test_video/test_video_{2,3,4}.mp4; do
|
||||
python3 run_detect_track.py \
|
||||
--input "$video" \
|
||||
--output "$OUTPUT" \
|
||||
"${COMMON_ARGS[@]}"
|
||||
done
|
||||
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import csv
|
||||
import cv2
|
||||
import collections
|
||||
|
||||
root = Path.cwd()
|
||||
out = root / "outputs"
|
||||
for video in sorted(out.glob("*_tracked.mp4")):
|
||||
cap = cv2.VideoCapture(str(video))
|
||||
frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) if cap.isOpened() else 0
|
||||
fps = cap.get(cv2.CAP_PROP_FPS) if cap.isOpened() else 0
|
||||
cap.release()
|
||||
csv_path = out / video.name.replace("_tracked.mp4", "_tracks.csv")
|
||||
ids = set()
|
||||
rows = 0
|
||||
by_frame = collections.defaultdict(list)
|
||||
if csv_path.exists():
|
||||
with csv_path.open(newline="", encoding="utf-8") as f:
|
||||
for row in csv.DictReader(f):
|
||||
rows += 1
|
||||
ids.add(row["track_id"])
|
||||
by_frame[int(row["frame"])].append(row["track_id"])
|
||||
duplicate_same_id = 0
|
||||
for frame_ids in by_frame.values():
|
||||
duplicate_same_id += sum(1 for count in collections.Counter(frame_ids).values() if count > 1)
|
||||
print(f"{video.name}: frames={frames}, fps={fps:.3f}, rows={rows}, ids={len(ids)}, duplicate_same_id_frames={duplicate_same_id}")
|
||||
PY
|
||||
Reference in new issue
Block a user