Add taco_analysis: visualization scripts + plots
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- taco_analysis/analyze_taco.py +295 -0
- taco_analysis/plots/action_distribution.png +3 -0
- taco_analysis/plots/action_object_heatmap.png +3 -0
- taco_analysis/plots/collection_timeline.png +3 -0
- taco_analysis/plots/duration_by_action.png +3 -0
- taco_analysis/plots/duration_distribution.png +3 -0
- taco_analysis/plots/epipolar/brushbrushcup_20231026_002_f0000_src4.png +3 -0
- taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0000_src4.png +3 -0
- taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0183_src4.png +3 -0
- taco_analysis/plots/epipolar/brushbrushhelmet_20231027_007_f0000_src5.png +3 -0
- taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src1.png +3 -0
- taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src2.png +3 -0
- taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0137_src1.png +3 -0
- taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0000_src3.png +3 -0
- taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0134_src3.png +3 -0
- taco_analysis/plots/epipolar/brushbrushplate_20230928_044_f0000_src6.png +3 -0
- taco_analysis/plots/epipolar/brushbrushplate_20230929_039_f0000_src8.png +3 -0
- taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0000_src2.png +3 -0
- taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0076_src2.png +3 -0
- taco_analysis/plots/epipolar/brushbrushteapot_20231006_227_f0000_src3.png +3 -0
- taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0000_src0.png +3 -0
- taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0099_src0.png +3 -0
- taco_analysis/plots/epipolar/brusheraserbowl_20231103_031_f0000_src7.png +3 -0
- taco_analysis/plots/epipolar/brusheraserbowl_20231103_045_f0000_src1.png +3 -0
- taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0000_src2.png +3 -0
- taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0103_src2.png +3 -0
- taco_analysis/plots/epipolar/brusheraserpan_20231103_001_f0000_src0.png +3 -0
- taco_analysis/plots/epipolar/brusheraserplate_20231027_049_f0000_src9.png +3 -0
- taco_analysis/plots/epipolar/brushrollerplate_20231019_241_f0000_src5.png +3 -0
- taco_analysis/plots/epipolar/cutspatulabowl_20231027_067_f0000_src6.png +3 -0
- taco_analysis/plots/epipolar/dustbrushkettle_20231103_160_f0000_src3.png +3 -0
- taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0000_src4.png +3 -0
- taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0135_src4.png +3 -0
- taco_analysis/plots/epipolar/measurerulerplate_20231104_075_f0000_src1.png +3 -0
- taco_analysis/plots/epipolar/putinspatulapan_20231020_038_f0000_src9.png +3 -0
- taco_analysis/plots/epipolar/putoutbowlpan_20231015_091_f0000_src0.png +3 -0
- taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0000_src0.png +3 -0
- taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0150_src0.png +3 -0
- taco_analysis/plots/epipolar/screwscrewdriverbox_20231102_047_f0000_src2.png +3 -0
- taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0000_src1.png +3 -0
- taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0203_src1.png +3 -0
- taco_analysis/plots/epipolar/smeargluegunbox_20231010_192_f0000_src4.png +3 -0
- taco_analysis/plots/epipolar/stir-fryspatulaplate_20231104_127_f0000_src7.png +3 -0
- taco_analysis/plots/epipolar/stirspatulabowl_20231024_111_f0000_src8.png +3 -0
- taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0000_src3.png +3 -0
- taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0168_src3.png +3 -0
- taco_analysis/plots/frame_count_distribution.png +3 -0
- taco_analysis/plots/frames_by_action.png +3 -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|
| 7 |
+
|
| 8 |
+
import argparse
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
import matplotlib
|
| 12 |
+
matplotlib.use("Agg")
|
| 13 |
+
import matplotlib.pyplot as plt
|
| 14 |
+
import numpy as np
|
| 15 |
+
import pandas as pd
|
| 16 |
+
import seaborn as sns
|
| 17 |
+
|
| 18 |
+
sns.set_theme(style="whitegrid", font_scale=1.1)
|
| 19 |
+
FIGSIZE = (12, 6)
|
| 20 |
+
DPI = 150
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def plot_action_distribution(df: pd.DataFrame, out_dir: Path):
|
| 24 |
+
"""Bar chart of sequences per action verb."""
|
| 25 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 26 |
+
counts = df["action"].value_counts().sort_values(ascending=True)
|
| 27 |
+
counts.plot.barh(ax=ax, color=sns.color_palette("viridis", len(counts)))
|
| 28 |
+
ax.set_xlabel("Number of sequences")
|
| 29 |
+
ax.set_title("Sequences per Action")
|
| 30 |
+
for i, v in enumerate(counts):
|
| 31 |
+
ax.text(v + 1, i, str(v), va="center", fontsize=9)
|
| 32 |
+
plt.tight_layout()
|
| 33 |
+
fig.savefig(out_dir / "action_distribution.png", dpi=DPI)
|
| 34 |
+
plt.close(fig)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def plot_tool_distribution(df: pd.DataFrame, out_dir: Path):
|
| 38 |
+
"""Bar chart of sequences per tool."""
|
| 39 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 40 |
+
counts = df["tool"].value_counts().sort_values(ascending=True)
|
| 41 |
+
counts.plot.barh(ax=ax, color=sns.color_palette("mako", len(counts)))
|
| 42 |
+
ax.set_xlabel("Number of sequences")
|
| 43 |
+
ax.set_title("Sequences per Tool")
|
| 44 |
+
for i, v in enumerate(counts):
|
| 45 |
+
ax.text(v + 1, i, str(v), va="center", fontsize=9)
|
| 46 |
+
plt.tight_layout()
|
| 47 |
+
fig.savefig(out_dir / "tool_distribution.png", dpi=DPI)
|
| 48 |
+
plt.close(fig)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def plot_object_distribution(df: pd.DataFrame, out_dir: Path):
|
| 52 |
+
"""Bar chart of sequences per object."""
|
| 53 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 54 |
+
counts = df["object"].value_counts().sort_values(ascending=True)
|
| 55 |
+
counts.plot.barh(ax=ax, color=sns.color_palette("rocket", len(counts)))
|
| 56 |
+
ax.set_xlabel("Number of sequences")
|
| 57 |
+
ax.set_title("Sequences per Object")
|
| 58 |
+
for i, v in enumerate(counts):
|
| 59 |
+
ax.text(v + 1, i, str(v), va="center", fontsize=9)
|
| 60 |
+
plt.tight_layout()
|
| 61 |
+
fig.savefig(out_dir / "object_distribution.png", dpi=DPI)
|
| 62 |
+
plt.close(fig)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def plot_triplet_heatmap(df: pd.DataFrame, out_dir: Path):
|
| 66 |
+
"""Heatmap of (action, object) combinations."""
|
| 67 |
+
pivot = df.groupby(["action", "object"]).size().reset_index(name="count")
|
| 68 |
+
pivot = pivot.pivot(index="action", columns="object", values="count").fillna(0).astype(int)
|
| 69 |
+
fig, ax = plt.subplots(figsize=(14, 8))
|
| 70 |
+
sns.heatmap(pivot, annot=True, fmt="d", cmap="YlOrRd", ax=ax, linewidths=0.5)
|
| 71 |
+
ax.set_title("Sequences per (Action, Object) Combination")
|
| 72 |
+
plt.tight_layout()
|
| 73 |
+
fig.savefig(out_dir / "action_object_heatmap.png", dpi=DPI)
|
| 74 |
+
plt.close(fig)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def plot_frame_count_distribution(df: pd.DataFrame, out_dir: Path):
|
| 78 |
+
"""Histogram of frame counts across sequences."""
|
| 79 |
+
valid = df[df["n_frames"] > 0]
|
| 80 |
+
if valid.empty:
|
| 81 |
+
return
|
| 82 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 83 |
+
ax.hist(valid["n_frames"], bins=50, color=sns.color_palette("deep")[0], edgecolor="white", alpha=0.8)
|
| 84 |
+
ax.axvline(valid["n_frames"].median(), color="red", linestyle="--", label=f'Median: {valid["n_frames"].median():.0f}')
|
| 85 |
+
ax.axvline(valid["n_frames"].mean(), color="orange", linestyle="--", label=f'Mean: {valid["n_frames"].mean():.0f}')
|
| 86 |
+
ax.set_xlabel("Number of frames")
|
| 87 |
+
ax.set_ylabel("Number of sequences")
|
| 88 |
+
ax.set_title("Frame Count Distribution")
|
| 89 |
+
ax.legend()
|
| 90 |
+
plt.tight_layout()
|
| 91 |
+
fig.savefig(out_dir / "frame_count_distribution.png", dpi=DPI)
|
| 92 |
+
plt.close(fig)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def plot_duration_distribution(df: pd.DataFrame, out_dir: Path):
|
| 96 |
+
"""Histogram of sequence durations."""
|
| 97 |
+
valid = df[df["duration_s"] > 0]
|
| 98 |
+
if valid.empty:
|
| 99 |
+
return
|
| 100 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 101 |
+
ax.hist(valid["duration_s"], bins=50, color=sns.color_palette("deep")[1], edgecolor="white", alpha=0.8)
|
| 102 |
+
ax.axvline(valid["duration_s"].median(), color="red", linestyle="--", label=f'Median: {valid["duration_s"].median():.1f}s')
|
| 103 |
+
ax.axvline(valid["duration_s"].mean(), color="orange", linestyle="--", label=f'Mean: {valid["duration_s"].mean():.1f}s')
|
| 104 |
+
ax.set_xlabel("Duration (seconds)")
|
| 105 |
+
ax.set_ylabel("Number of sequences")
|
| 106 |
+
ax.set_title("Sequence Duration Distribution")
|
| 107 |
+
ax.legend()
|
| 108 |
+
plt.tight_layout()
|
| 109 |
+
fig.savefig(out_dir / "duration_distribution.png", dpi=DPI)
|
| 110 |
+
plt.close(fig)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def plot_duration_by_action(df: pd.DataFrame, out_dir: Path):
|
| 114 |
+
"""Box plot of duration per action."""
|
| 115 |
+
valid = df[df["duration_s"] > 0]
|
| 116 |
+
if valid.empty:
|
| 117 |
+
return
|
| 118 |
+
order = valid.groupby("action")["duration_s"].median().sort_values(ascending=False).index
|
| 119 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 120 |
+
sns.boxplot(data=valid, x="action", y="duration_s", order=order, ax=ax, palette="viridis")
|
| 121 |
+
ax.set_xlabel("Action")
|
| 122 |
+
ax.set_ylabel("Duration (seconds)")
|
| 123 |
+
ax.set_title("Sequence Duration by Action")
|
| 124 |
+
plt.xticks(rotation=45, ha="right")
|
| 125 |
+
plt.tight_layout()
|
| 126 |
+
fig.savefig(out_dir / "duration_by_action.png", dpi=DPI)
|
| 127 |
+
plt.close(fig)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def plot_modality_completeness(df: pd.DataFrame, out_dir: Path):
|
| 131 |
+
"""Bar chart of modality availability."""
|
| 132 |
+
modality_cols = [
|
| 133 |
+
"has_egocentric_rgb", "has_egocentric_depth", "has_hand_poses",
|
| 134 |
+
"has_object_poses", "has_segmentation", "has_alloc_cam_params",
|
| 135 |
+
"has_ego_cam_params",
|
| 136 |
+
]
|
| 137 |
+
labels = [c.replace("has_", "").replace("_", " ").title() for c in modality_cols]
|
| 138 |
+
counts = [df[c].sum() for c in modality_cols]
|
| 139 |
+
pcts = [100 * c / len(df) for c in counts]
|
| 140 |
+
|
| 141 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 142 |
+
bars = ax.barh(labels, pcts, color=sns.color_palette("Greens_d", len(labels)))
|
| 143 |
+
ax.set_xlabel("Availability (%)")
|
| 144 |
+
ax.set_title("Modality Availability Across Sequences")
|
| 145 |
+
ax.set_xlim(0, 105)
|
| 146 |
+
for i, (p, c) in enumerate(zip(pcts, counts)):
|
| 147 |
+
ax.text(p + 0.5, i, f"{p:.1f}% ({c}/{len(df)})", va="center", fontsize=9)
|
| 148 |
+
plt.tight_layout()
|
| 149 |
+
fig.savefig(out_dir / "modality_completeness.png", dpi=DPI)
|
| 150 |
+
plt.close(fig)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def plot_sequences_per_triplet(df: pd.DataFrame, out_dir: Path):
|
| 154 |
+
"""Histogram of how many sequences each triplet has."""
|
| 155 |
+
triplet_counts = df["triplet"].value_counts()
|
| 156 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 157 |
+
ax.hist(triplet_counts, bins=range(1, triplet_counts.max() + 2), color=sns.color_palette("deep")[2],
|
| 158 |
+
edgecolor="white", alpha=0.8, align="left")
|
| 159 |
+
ax.set_xlabel("Sequences per triplet")
|
| 160 |
+
ax.set_ylabel("Number of triplets")
|
| 161 |
+
ax.set_title(f"Sequences per Triplet ({df['triplet'].nunique()} unique triplets)")
|
| 162 |
+
ax.axvline(triplet_counts.median(), color="red", linestyle="--",
|
| 163 |
+
label=f"Median: {triplet_counts.median():.0f}")
|
| 164 |
+
ax.legend()
|
| 165 |
+
plt.tight_layout()
|
| 166 |
+
fig.savefig(out_dir / "sequences_per_triplet.png", dpi=DPI)
|
| 167 |
+
plt.close(fig)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def plot_date_timeline(df: pd.DataFrame, out_dir: Path):
|
| 171 |
+
"""Sequences collected over time."""
|
| 172 |
+
dates = pd.to_datetime(df["date"], format="%Y%m%d", errors="coerce")
|
| 173 |
+
valid = dates.dropna()
|
| 174 |
+
if valid.empty:
|
| 175 |
+
return
|
| 176 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 177 |
+
daily = valid.groupby(valid.dt.date).size()
|
| 178 |
+
daily.plot(kind="bar", ax=ax, color=sns.color_palette("deep")[3], width=0.8)
|
| 179 |
+
ax.set_xlabel("Date")
|
| 180 |
+
ax.set_ylabel("Sequences recorded")
|
| 181 |
+
ax.set_title("Data Collection Timeline")
|
| 182 |
+
# Reduce x-tick clutter
|
| 183 |
+
n_ticks = len(daily)
|
| 184 |
+
if n_ticks > 20:
|
| 185 |
+
step = max(1, n_ticks // 15)
|
| 186 |
+
ticks = ax.get_xticks()
|
| 187 |
+
ax.set_xticks(ticks[::step])
|
| 188 |
+
plt.xticks(rotation=45, ha="right")
|
| 189 |
+
plt.tight_layout()
|
| 190 |
+
fig.savefig(out_dir / "collection_timeline.png", dpi=DPI)
|
| 191 |
+
plt.close(fig)
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def plot_frames_by_action(df: pd.DataFrame, out_dir: Path):
|
| 195 |
+
"""Box plot of frame counts per action."""
|
| 196 |
+
valid = df[df["n_frames"] > 0]
|
| 197 |
+
if valid.empty:
|
| 198 |
+
return
|
| 199 |
+
order = valid.groupby("action")["n_frames"].median().sort_values(ascending=False).index
|
| 200 |
+
fig, ax = plt.subplots(figsize=FIGSIZE)
|
| 201 |
+
sns.boxplot(data=valid, x="action", y="n_frames", order=order, ax=ax, palette="mako")
|
| 202 |
+
ax.set_xlabel("Action")
|
| 203 |
+
ax.set_ylabel("Frame count")
|
| 204 |
+
ax.set_title("Frame Count by Action")
|
| 205 |
+
plt.xticks(rotation=45, ha="right")
|
| 206 |
+
plt.tight_layout()
|
| 207 |
+
fig.savefig(out_dir / "frames_by_action.png", dpi=DPI)
|
| 208 |
+
plt.close(fig)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def print_summary(df: pd.DataFrame):
|
| 212 |
+
"""Print text summary to console."""
|
| 213 |
+
print(f"\n{'='*70}")
|
| 214 |
+
print("TACO DATASET ANALYSIS SUMMARY")
|
| 215 |
+
print(f"{'='*70}")
|
| 216 |
+
print(f"Total sequences: {len(df)}")
|
| 217 |
+
print(f"Unique triplets: {df['triplet'].nunique()}")
|
| 218 |
+
print(f"Unique actions: {df['action'].nunique()}: {sorted(df['action'].unique())}")
|
| 219 |
+
print(f"Unique tools: {df['tool'].nunique()}: {sorted(df['tool'].unique())}")
|
| 220 |
+
print(f"Unique objects: {df['object'].nunique()}: {sorted(df['object'].unique())}")
|
| 221 |
+
print(f"All 12 cameras: {(df['n_allocentric_cameras'] == 12).sum()}/{len(df)}")
|
| 222 |
+
complete = df["all_modalities_complete"].sum()
|
| 223 |
+
print(f"Fully complete: {complete}/{len(df)} ({100*complete/len(df):.1f}%)")
|
| 224 |
+
|
| 225 |
+
valid = df[df["n_frames"] > 0]
|
| 226 |
+
if len(valid) > 0:
|
| 227 |
+
print(f"\nVideo statistics ({len(valid)} sequences with video info):")
|
| 228 |
+
print(f" FPS: {valid['fps'].mode().iloc[0]}")
|
| 229 |
+
print(f" Frames: min={valid['n_frames'].min()}, median={valid['n_frames'].median():.0f}, "
|
| 230 |
+
f"mean={valid['n_frames'].mean():.0f}, max={valid['n_frames'].max()}")
|
| 231 |
+
print(f" Duration: min={valid['duration_s'].min():.1f}s, median={valid['duration_s'].median():.1f}s, "
|
| 232 |
+
f"mean={valid['duration_s'].mean():.1f}s, max={valid['duration_s'].max():.1f}s")
|
| 233 |
+
print(f" Total: {valid['duration_s'].sum()/3600:.1f} hours")
|
| 234 |
+
|
| 235 |
+
# Top triplets
|
| 236 |
+
top = df["triplet"].value_counts().head(10)
|
| 237 |
+
print(f"\nTop 10 triplets by sequence count:")
|
| 238 |
+
for triplet, count in top.items():
|
| 239 |
+
print(f" {triplet}: {count}")
|
| 240 |
+
|
| 241 |
+
print(f"{'='*70}")
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
def main():
|
| 245 |
+
parser = argparse.ArgumentParser(description="Analyze TACO dataset and generate plots")
|
| 246 |
+
parser.add_argument(
|
| 247 |
+
"--csv", type=Path,
|
| 248 |
+
default=Path(__file__).resolve().parent.parent / "taco_dataset" / "taco_info.csv",
|
| 249 |
+
help="Path to taco_info.csv",
|
| 250 |
+
)
|
| 251 |
+
parser.add_argument(
|
| 252 |
+
"--output-dir", type=Path,
|
| 253 |
+
default=Path(__file__).resolve().parent / "plots",
|
| 254 |
+
help="Directory to save plots",
|
| 255 |
+
)
|
| 256 |
+
args = parser.parse_args()
|
| 257 |
+
|
| 258 |
+
df = pd.read_csv(args.csv)
|
| 259 |
+
out_dir = args.output_dir
|
| 260 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 261 |
+
|
| 262 |
+
print(f"Loaded {len(df)} sequences from {args.csv}")
|
| 263 |
+
print(f"Saving plots to {out_dir}/")
|
| 264 |
+
|
| 265 |
+
print_summary(df)
|
| 266 |
+
|
| 267 |
+
print("\nGenerating plots...")
|
| 268 |
+
plot_action_distribution(df, out_dir)
|
| 269 |
+
print(" action_distribution.png")
|
| 270 |
+
plot_tool_distribution(df, out_dir)
|
| 271 |
+
print(" tool_distribution.png")
|
| 272 |
+
plot_object_distribution(df, out_dir)
|
| 273 |
+
print(" object_distribution.png")
|
| 274 |
+
plot_triplet_heatmap(df, out_dir)
|
| 275 |
+
print(" action_object_heatmap.png")
|
| 276 |
+
plot_frame_count_distribution(df, out_dir)
|
| 277 |
+
print(" frame_count_distribution.png")
|
| 278 |
+
plot_duration_distribution(df, out_dir)
|
| 279 |
+
print(" duration_distribution.png")
|
| 280 |
+
plot_duration_by_action(df, out_dir)
|
| 281 |
+
print(" duration_by_action.png")
|
| 282 |
+
plot_modality_completeness(df, out_dir)
|
| 283 |
+
print(" modality_completeness.png")
|
| 284 |
+
plot_sequences_per_triplet(df, out_dir)
|
| 285 |
+
print(" sequences_per_triplet.png")
|
| 286 |
+
plot_date_timeline(df, out_dir)
|
| 287 |
+
print(" collection_timeline.png")
|
| 288 |
+
plot_frames_by_action(df, out_dir)
|
| 289 |
+
print(" frames_by_action.png")
|
| 290 |
+
|
| 291 |
+
print(f"\nDone! {11} plots saved to {out_dir}/")
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
if __name__ == "__main__":
|
| 295 |
+
main()
|
taco_analysis/plots/action_distribution.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/action_object_heatmap.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/collection_timeline.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/duration_by_action.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/duration_distribution.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushcup_20231026_002_f0000_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0000_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushcup_20231026_006_f0183_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushhelmet_20231027_007_f0000_src5.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0000_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushkettle_20231006_169_f0137_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0000_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushkettle_20231103_161_f0134_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushplate_20230928_044_f0000_src6.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushplate_20230929_039_f0000_src8.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0000_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushplate_20231005_184_f0076_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushbrushteapot_20231006_227_f0000_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0000_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserbowl_20231103_027_f0099_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserbowl_20231103_031_f0000_src7.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserbowl_20231103_045_f0000_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0000_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserkettle_20231103_110_f0103_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserpan_20231103_001_f0000_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brusheraserplate_20231027_049_f0000_src9.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/brushrollerplate_20231019_241_f0000_src5.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/cutspatulabowl_20231027_067_f0000_src6.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/dustbrushkettle_20231103_160_f0000_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0000_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/measurerulerbowl_20231104_088_f0135_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/measurerulerplate_20231104_075_f0000_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/putinspatulapan_20231020_038_f0000_src9.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/putoutbowlpan_20231015_091_f0000_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0000_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/scrapeoffknifeplate_20231015_210_f0150_src0.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/screwscrewdriverbox_20231102_047_f0000_src2.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0000_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/skimoffspoonplate_20231024_069_f0203_src1.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/smeargluegunbox_20231010_192_f0000_src4.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/stir-fryspatulaplate_20231104_127_f0000_src7.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/stirspatulabowl_20231024_111_f0000_src8.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0000_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/epipolar/stirspoonpan_20231020_079_f0168_src3.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/frame_count_distribution.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/frames_by_action.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0000.png
ADDED
|
Git LFS Details
|
taco_analysis/plots/mesh_overlay/dustrollerpan_20231019_214_f0116.png
ADDED
|
Git LFS Details
|