From 61a680e6047f80c4bb8318dd3d9a19eae08b31c8 Mon Sep 17 00:00:00 2001 From: davidpagnon Date: Sun, 17 Sep 2023 20:48:13 +0200 Subject: [PATCH] set up for new goals --- Pose2Sim/Pose2Sim.py | 43 ++++++++++++++++++++++++++++++++++++++++--- README.md | 4 ++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Pose2Sim/Pose2Sim.py b/Pose2Sim/Pose2Sim.py index 26d4003..73256ef 100644 --- a/Pose2Sim/Pose2Sim.py +++ b/Pose2Sim/Pose2Sim.py @@ -86,6 +86,28 @@ def base_params(config_dict): return project_dir, seq_name, frames +def poseEstimation(config=os.path.join('User', 'Config.toml')): + ''' + Estimate pose using BlazePose, OpenPose, AlphaPose, or DeepLabCut + ''' + + from Pose2Sim.poseEstimation import pose_estimation_all + + config_dict = read_config_file(config) + project_dir, seq_name, frames = base_params(config_dict) + + logging.info("\n\n---------------------------------------------------------------------") + logging.info("Pose estimation") + logging.info("---------------------------------------------------------------------") + logging.info(f"\nProject directory: {project_dir}") + start = time.time() + + pose_estimation_all(config_dict) + + end = time.time() + logging.info(f'Pose estimation took {end-start:.2f} s.') + + def calibration(config=os.path.join('User', 'Config.toml')): ''' Cameras calibration from checkerboards or from qualisys files. @@ -110,10 +132,25 @@ def calibration(config=os.path.join('User', 'Config.toml')): def synchronization(config=os.path.join('User', 'Config.toml')): ''' - Synchronize if needed + Synchronize cameras if needed ''' - pass - + + from Pose2Sim.synchronization import synchronize_cams_all + + config_dict = read_config_file(config) + project_dir, seq_name, frames = base_params(config_dict) + + logging.info("\n\n---------------------------------------------------------------------") + logging.info("Camera synchronization") + logging.info("---------------------------------------------------------------------") + logging.info(f"\nProject directory: {project_dir}") + start = time.time() + + synchronize_cams_all(config_dict) + + end = time.time() + logging.info(f'Synchronization took {end-start:.2f} s.') + def personAssociation(config=os.path.join('User', 'Config.toml')): ''' diff --git a/README.md b/README.md index 1ebd161..cc9e31a 100644 --- a/README.md +++ b/README.md @@ -855,6 +855,9 @@ If you want to contribute to Pose2Sim, please follow [this guide](https://docs.g
> - [x] **Demo:** Provide Demo data for users to test the code. +> - [ ] **Demo:** Add videos for users to experiment with other pose detecction frameworks +> - [ ] **Demo:** Time shift videos and json to demonstrate synchronization +> - [ ] **Demo:** Add another virtual person to demonstrate personAssociation > - [ ] **Tutorials:** Make video tutorials. > - [ ] **Doc:** Use [Sphinx](https://www.sphinx-doc.org/en/master) or [MkDocs](https://www.mkdocs.org) for clearer documentation. @@ -864,5 +867,6 @@ If you want to contribute to Pose2Sim, please follow [this guide](https://docs.g > - [x] **Pip package** > - [ ] **Conda package** > - [ ] **Docker image** +> - [ ] **** Run pose estimation and OpenSim from within Pose2Sim > - [ ] **Run from command line via click or typer** > - [ ] **Utilities**: Export other data from c3d files into .mot or .sto files (angles, powers, forces, moments, GRF, EMG...)