Candle commited on
Commit ·
2abeac8
1
Parent(s): efbb653
thumbnails
Browse files- data/animations/sample-000.plot.jpg +2 -2
- detect_scene.py +23 -1
data/animations/sample-000.plot.jpg
CHANGED
|
|
Git LFS Details
|
|
|
Git LFS Details
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|