chore: drop helper scripts/ move, trim docs/scripts.md refs
This commit is contained in:
1 parent
fbba169507
commit
508bee736d
3 files changed
+3
-108
No files matched your search
+3
-4
@@ -18,18 +18,17 @@
|
||||
- `archive/get_coordinates.py` / `archive/get_calib_frame.py` — zone calibration
|
||||
(`calib_frame.jpg`, `zones.json`); `archive/capture_frame_native.py` — grab
|
||||
native frames (`live_frame_native.png`).
|
||||
- `scripts/extract_random_frames.py` — sample frames for labeling; `archive/check_*.py`
|
||||
- `extract_random_frames.py` — sample frames for labeling; `archive/check_*.py`
|
||||
(`check_20_23`, `check_20_aug`, `check_all_after`) — batch verification passes.
|
||||
- `archive/test_bytetrack.py`, `archive/test_track_crash.py` — tracker experiments/crash repro.
|
||||
|
||||
## DB / ops helpers
|
||||
`counter_dashboard.py` (dashboard), `scripts/check_jetson_db.py`,
|
||||
`counter_dashboard.py` (dashboard), `check_jetson_db.py`,
|
||||
`archive/backup.py`, `archive/dump_db.py`,
|
||||
`archive/migrate_jetson_db.py`, `archive/merge_batches_20_23.py`,
|
||||
`archive/merge_batches_28_35.py`, `archive/update_batches.py`,
|
||||
`archive/diagnose_truck_jetson.py`, `deploy_to_jetson.py`,
|
||||
`export_model.py` / `archive/export_v4.py` (TensorRT export),
|
||||
`scripts/generate_guide_pdf.py` (operator guide PDF).
|
||||
`export_model.py` / `archive/export_v4.py` (TensorRT export).
|
||||
|
||||
## Ignored at runtime (`.gitignore`)
|
||||
`.env`, `*.db`, state JSONs, `batch_history_folder/`, media (`*.mp4/*.jpg/*.png`),
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import paramiko
|
||||
import base64
|
||||
|
||||
def run():
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect('192.168.192.96', username='jetson', password='jetson', timeout=10)
|
||||
|
||||
code = """
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('/opt/jetson-counter/jetson_counter.db')
|
||||
conn.row_factory = sqlite3.Row
|
||||
cur = conn.cursor()
|
||||
|
||||
for dt in ['2026-08-21', '2026-08-22']:
|
||||
print(f'=== BATCHES FOR {dt} ===')
|
||||
rows = cur.execute('SELECT * FROM batches WHERE counting_date = ? ORDER BY batch_number', (dt,)).fetchall()
|
||||
for r in rows:
|
||||
d = dict(r)
|
||||
print(f"Batch {d['batch_number']:02d}: count={d['count']}, start={d['start_time']}, end={d['end_time']}")
|
||||
|
||||
print(f'=== DAILY SUMMARY FOR {dt} ===')
|
||||
rows = cur.execute('SELECT * FROM daily_summaries WHERE counting_date = ?', (dt,)).fetchall()
|
||||
for r in rows:
|
||||
print(dict(r))
|
||||
"""
|
||||
b64 = base64.b64encode(code.encode()).decode()
|
||||
stdin, stdout, stderr = client.exec_command(f"python3 -c \"import base64; exec(base64.b64decode('{b64}'))\"")
|
||||
print(stdout.read().decode())
|
||||
print("ERR:", stderr.read().decode())
|
||||
client.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
@@ -1,69 +0,0 @@
|
||||
import os
|
||||
import random
|
||||
import cv2
|
||||
|
||||
def extract_random_frames(video_path, output_dir, num_frames=500):
|
||||
# Ensure output directory exists
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Open the video file
|
||||
cap = cv2.VideoCapture(video_path)
|
||||
if not cap.isOpened():
|
||||
print(f"Error: Gagal membuka video '{video_path}'")
|
||||
return
|
||||
|
||||
# Get total number of frames
|
||||
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
fps = cap.get(cv2.CAP_PROP_FPS)
|
||||
duration_sec = total_frames / fps if fps > 0 else 0
|
||||
|
||||
print(f"Video Info:")
|
||||
print(f" - Path: {video_path}")
|
||||
print(f" - Total Frame: {total_frames}")
|
||||
print(f" - FPS: {fps:.2f}")
|
||||
print(f" - Durasi: {duration_sec:.2f} detik (~{duration_sec/60:.2f} menit)")
|
||||
print(f" - Mengambil {num_frames} frame secara acak...\n")
|
||||
|
||||
if total_frames < num_frames:
|
||||
print(f"Warning: Total frame pada video ({total_frames}) lebih kecil dari jumlah frame yang diminta ({num_frames}).")
|
||||
print("Akan mengekstrak semua frame yang tersedia.")
|
||||
selected_frames = list(range(total_frames))
|
||||
else:
|
||||
# Select 500 unique random frames
|
||||
selected_frames = random.sample(range(total_frames), num_frames)
|
||||
|
||||
# Sort the indices so we seek sequentially (faster and more stable)
|
||||
selected_frames.sort()
|
||||
|
||||
count = 0
|
||||
for idx, frame_id in enumerate(selected_frames):
|
||||
# Set the frame position
|
||||
cap.set(cv2.CAP_PROP_POS_FRAMES, frame_id)
|
||||
ret, frame = cap.read()
|
||||
|
||||
if not ret:
|
||||
print(f"Warning: Gagal membaca frame ke-{frame_id}. Mencoba membaca frame selanjutnya...")
|
||||
# Try reading the next frame sequentially
|
||||
ret, frame = cap.read()
|
||||
if not ret:
|
||||
print(f"Error: Tetap gagal membaca frame setelah frame ke-{frame_id}. Melewati...")
|
||||
continue
|
||||
|
||||
# Save frame as image
|
||||
output_filename = os.path.join(output_dir, f"frame_{frame_id:06d}.jpg")
|
||||
cv2.imwrite(output_filename, frame)
|
||||
count += 1
|
||||
|
||||
# Print progress every 50 frames or at the end
|
||||
if count % 50 == 0 or count == len(selected_frames):
|
||||
print(f"Progress: [{count}/{len(selected_frames)}] Berhasil mengekstrak {output_filename}")
|
||||
|
||||
cap.release()
|
||||
print(f"\nSelesai! Berhasil mengekstrak {count} frame acak ke folder '{output_dir}'.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
video_file = "0727.mp4"
|
||||
output_directory = "extracted_frames"
|
||||
number_of_frames = 500
|
||||
|
||||
extract_random_frames(video_file, output_directory, number_of_frames)
|
||||
Reference in new issue
Block a user