vivek9chavan commited on
Commit
bd1218a
·
verified ·
1 Parent(s): a9cec68

Update dino_processor.py

Browse files
Files changed (1) hide show
  1. dino_processor.py +2 -2
dino_processor.py CHANGED
@@ -18,7 +18,7 @@ import vision_transformer as vits
18
 
19
  # --- Helper functions (with your new parameters) ---
20
 
21
- def extract_frames(video_path, output_dir, fps=5): # OPTIMIZATION: Reduced FPS
22
  frames_dir = os.path.join(output_dir, "frames")
23
  os.makedirs(frames_dir, exist_ok=True)
24
  cap = cv2.VideoCapture(video_path)
@@ -60,7 +60,7 @@ def compute_embeddings(frame_paths, model, device, batch_size=32):
60
  embeddings.append(batch_embeddings.cpu().numpy())
61
  return np.concatenate(embeddings, axis=0), frame_names
62
 
63
- def select_representative_frames(embeddings, frame_names, n_clusters=3, pca_dim=32): # OPTIMIZATION: Reduced clusters
64
  n_clusters = min(n_clusters, len(frame_names))
65
  if n_clusters == 0: return []
66
 
 
18
 
19
  # --- Helper functions (with your new parameters) ---
20
 
21
+ def extract_frames(video_path, output_dir, fps=4): # OPTIMIZATION: Reduced FPS
22
  frames_dir = os.path.join(output_dir, "frames")
23
  os.makedirs(frames_dir, exist_ok=True)
24
  cap = cv2.VideoCapture(video_path)
 
60
  embeddings.append(batch_embeddings.cpu().numpy())
61
  return np.concatenate(embeddings, axis=0), frame_names
62
 
63
+ def select_representative_frames(embeddings, frame_names, n_clusters=3, pca_dim=12): # OPTIMIZATION: Reduced clusters
64
  n_clusters = min(n_clusters, len(frame_names))
65
  if n_clusters == 0: return []
66