From 48de41f346e6c6831d040a4c450951c98dead8b6 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Tue, 16 Jan 2024 19:58:35 -0600 Subject: [PATCH 1/2] Revert FacemapPoseModel to FacemapModel --- element_facemap/facemap_inference.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/element_facemap/facemap_inference.py b/element_facemap/facemap_inference.py index f10574e..f703657 100644 --- a/element_facemap/facemap_inference.py +++ b/element_facemap/facemap_inference.py @@ -123,7 +123,7 @@ class BodyPart(dj.Lookup): @schema -class FacemapPoseModel(dj.Manual): +class FacemapModel(dj.Manual): """Trained Models stored for facial pose inference Attributes: @@ -154,7 +154,7 @@ class File(dj.Part): """Relative paths of facemap models with respect to facemap_root_data_dir Attributes: - FacemapPoseModel (foreign key): FacemapPoseModel primary key. + FacemapModel (foreign key): FacemapModel primary key. model_file ( attach ): file attachment of facemap model, stored as binary in the database. @@ -206,7 +206,7 @@ class FacemapInferenceTask(dj.Manual): Attributes: fbe.VideoRecording (foreign key) : Primary key for VideoRecording table. - FacemapPoseModel (foreign key) : Primary key for the facemap model table + FacemapModel (foreign key) : Primary key for the facemap model table facemap_inference_output_dir ( varchar(255), optional) : output dir storing the results of pose analysis. task_mode (enum) : Default 'load'. 'load' or 'trigger' analysis. @@ -217,7 +217,7 @@ class FacemapInferenceTask(dj.Manual): definition = """ # Staging table for pairing of recording and Facemap parameters before processing. -> fbe.VideoRecording - -> FacemapPoseModel + -> FacemapModel --- facemap_inference_output_dir : varchar(255) # output dir - stores results of Facemap inference analysis task_description : varchar(128) # Optional. Addtional task description @@ -313,14 +313,14 @@ class BodyPartPosition(dj.Part): Attributes: FacemapInference (foreign key): FacemapInference primary key. - FacemapPoseModel.BodyPart (foreign key): BodyPart primary key. + FacemapModel.BodyPart (foreign key): BodyPart primary key. x_pos (longblob): X position. y_pos (longblob): Y position. likelihood (longblob): Model confidence.""" definition = """ # uses facemap h5 output for body part position -> master - -> FacemapPoseModel.BodyPart + -> FacemapModel.BodyPart --- x_pos : longblob # x position y_pos : longblob # y position @@ -386,9 +386,9 @@ def make(self, key): model_id = (FacemapInferenceTask & key).fetch("model_id") # Fetch model(.pt) file attachment to present working directory - facemap_model_name = ( - FacemapPoseModel.File & f'model_id="{model_id}"' - ).fetch1("model_file") + facemap_model_name = (FacemapModel.File & f'model_id="{model_id}"').fetch1( + "model_file" + ) facemap_model_path = Path.cwd() / facemap_model_name models_root_dir = model_loader.get_models_dir() @@ -427,9 +427,7 @@ def get_trajectory(cls, key: dict, body_parts: list = "all") -> pd.DataFrame: and x/y coordinates of each body part for a camera_id, similar to output of facemap inference data. """ - model_name = (FacemapPoseModel & f'model_id={key["model_id"]}').fetch1( - "model_name" - ) + model_name = (FacemapModel & f'model_id={key["model_id"]}').fetch1("model_name") if body_parts == "all": body_parts = (cls.BodyPartPosition & key).fetch("body_part") From c4c55f9a147fbd5cd914c34da77ff0ae5d0f7506 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Tue, 16 Jan 2024 20:02:16 -0600 Subject: [PATCH 2/2] Change `inference_start_time` to `inference_completion_time` --- element_facemap/facemap_inference.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/element_facemap/facemap_inference.py b/element_facemap/facemap_inference.py index f703657..a17ef0d 100644 --- a/element_facemap/facemap_inference.py +++ b/element_facemap/facemap_inference.py @@ -295,7 +295,7 @@ class FacemapInference(dj.Computed): Attributes: FacemapInferenceTask (foreign key): FacemapInferenceTask primary key. - inference_start_time (datetime): time of generation of this set of facemap results. + inference_completion_time (datetime): time of generation of this set of facemap results. inference_run_duration (datetime): duration of model. total_frame_count (int): Number of frames in all video files. """ @@ -303,7 +303,7 @@ class FacemapInference(dj.Computed): definition = """ -> FacemapInferenceTask --- - inference_start_time: datetime # time of generation of this set of facemap results + inference_completion_time: datetime # time of generation of this set of facemap results inference_run_duration: float # seconds total_frame_count: int # frame count across all video files """ @@ -369,7 +369,7 @@ def make(self, key): self.insert1( { **key, - "inference_start_time": creation_time, + "inference_completion_time": creation_time, "inference_run_duration": inference_duration, "total_frame_count": total_frame_count, }