Candle commited on
Commit
2abeac8
·
1 Parent(s): efbb653

thumbnails

Browse files
data/animations/sample-000.plot.jpg CHANGED

Git LFS Details

  • SHA256: 9a6503d28174e36d0df3e7bf6d375fd1bdf064de02e689d555a4b145829be936
  • Pointer size: 130 Bytes
  • Size of remote file: 28.1 kB

Git LFS Details

  • SHA256: 01afda6090db676c5e7750a0a9fae8b506301f1083bd44461797d37af8cfbe67
  • Pointer size: 130 Bytes
  • Size of remote file: 36.4 kB
detect_scene.py CHANGED
@@ -92,10 +92,32 @@ for file in files:
92
  match = re.search(r"sample-(\d+)", file.name)
93
  sample_num = match.group(1) if match else "unknown"
94
  plot_filename = file.parent / f"sample-{sample_num}.plot.jpg"
95
- # Plot single_frame_pred
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  plt.figure(figsize=(12, 4))
97
  plt.title(f"Single Frame Predictions: {file.name}")
98
  plt.plot(result["single_frame_pred"])
 
 
 
 
 
 
 
 
99
  plt.xlabel("Frame")
100
  plt.ylabel("Prediction")
101
  plt.tight_layout()
 
92
  match = re.search(r"sample-(\d+)", file.name)
93
  sample_num = match.group(1) if match else "unknown"
94
  plot_filename = file.parent / f"sample-{sample_num}.plot.jpg"
95
+
96
+ # Load original frames for thumbnails
97
+ from PIL import Image
98
+ im = Image.open(file)
99
+ original_frames = []
100
+ try:
101
+ while True:
102
+ original_frames.append(im.convert("RGB"))
103
+ im.seek(im.tell() + 1)
104
+ except EOFError:
105
+ pass
106
+
107
+ import matplotlib.pyplot as plt
108
+ from matplotlib.offsetbox import OffsetImage, AnnotationBbox
109
+
110
  plt.figure(figsize=(12, 4))
111
  plt.title(f"Single Frame Predictions: {file.name}")
112
  plt.plot(result["single_frame_pred"])
113
+ ax = plt.gca()
114
+ # Add thumbnails at regular intervals (e.g., every 20 frames)
115
+ interval = 5
116
+ for idx in range(0, len(original_frames), interval):
117
+ thumb = original_frames[idx].resize((64, 64))
118
+ imagebox = OffsetImage(np.array(thumb), zoom=0.5)
119
+ ab = AnnotationBbox(imagebox, (idx, result["single_frame_pred"][idx]), frameon=False, box_alignment=(0.5, -0.1))
120
+ ax.add_artist(ab)
121
  plt.xlabel("Frame")
122
  plt.ylabel("Prediction")
123
  plt.tight_layout()