Initial snapshot: hand motion pipeline (Dyn-HaMR + dex-retargeting + SPIDER)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 14:13:49 +08:00
commit 7e4ef6f98b
7002 changed files with 1452249 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import datetime
class Logger(object):
"""
Static logging class
"""
log_file = None
@staticmethod
def init(log_path):
Logger.log_file = log_path
@staticmethod
def log(write_str, to_stdout=True):
if to_stdout:
print(write_str)
if not Logger.log_file:
print("Logger must be initialized before logging!")
return
time_str = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
with open(Logger.log_file, "a") as f:
f.write(time_str + " ")
f.write(str(write_str) + "\n")
def log_cur_stats(stats_dict, iter=None, to_stdout=True):
loss = stats_dict.pop("total", 0)
Logger.log(f"LOSS: {loss:.04f}", to_stdout=to_stdout)
for k, v in stats_dict.items():
Logger.log(f"{k}: {v:.04f}", to_stdout=to_stdout)
if to_stdout:
if iter is not None:
print("======= iter %d =======" % iter)
else:
print("========")