From e41025dc456c918c8a0f162ab09f31a5d5c720a9 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 20 Aug 2024 15:21:06 -0500 Subject: [PATCH] feat: store output files from `analyze_videos()` as `filepath` --- element_deeplabcut/model.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/element_deeplabcut/model.py b/element_deeplabcut/model.py index 2c02843..51dd2fb 100644 --- a/element_deeplabcut/model.py +++ b/element_deeplabcut/model.py @@ -704,6 +704,14 @@ class BodyPartPosition(dj.Part): likelihood : longblob """ + class File(dj.Part): + definition = """ + -> master + file_name: varchar(255) + --- + file: filepath@dlc-processed + """ + def make(self, key): """.populate() method will launch training for each PoseEstimationTask""" # ID model and directories @@ -835,6 +843,18 @@ def do_analyze_videos(): self.insert1({**key, "pose_estimation_time": creation_time}) self.BodyPartPosition.insert(body_parts) + # Insert result files + self.File.insert( + [ + { + **key, + "file_name": f.relative_to(output_dir).as_posix(), + "file": f, + } + for f in output_dir.rglob("*") + if f.is_file() + ] + ) @classmethod def get_trajectory(cls, key: dict, body_parts: list = "all") -> pd.DataFrame: