Skip to content

Commit

Permalink
Rename some functions + minor edits in Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpagnon committed Jan 23, 2025
1 parent c903a4c commit f51ff53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Pose2Sim/Pose2Sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def poseEstimation(config=None):
or the function can be called without an argument, in which case it the config directory is the current one.
'''

from Pose2Sim.poseEstimation import rtm_estimator # The name of the function might change
from Pose2Sim.poseEstimation import estimate_pose_all # The name of the function might change

level, config_dicts = read_config_files(config)

Expand Down Expand Up @@ -240,7 +240,7 @@ def poseEstimation(config=None):
logging.info(f"Project directory: {project_dir}")
logging.info("---------------------------------------------------------------------\n")

rtm_estimator(config_dict)
estimate_pose_all(config_dict)

end = time.time()
elapsed = end - start
Expand Down Expand Up @@ -449,7 +449,7 @@ def markerAugmentation(config=None):
or the function can be called without an argument, in which case it the config directory is the current one.
'''

from Pose2Sim.markerAugmentation import augmentTRC
from Pose2Sim.markerAugmentation import augment_markers_all
level, config_dicts = read_config_files(config)

if type(config) == dict:
Expand Down Expand Up @@ -478,7 +478,7 @@ def markerAugmentation(config=None):
logging.info(f"Project directory: {project_dir}")
logging.info("---------------------------------------------------------------------\n")

augmentTRC(config_dict)
augment_markers_all(config_dict)

end = time.time()
elapsed = end-start
Expand Down
2 changes: 1 addition & 1 deletion Pose2Sim/markerAugmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def check_neck_data(trc_file):
return trc_file


def augmentTRC(config_dict):
def augment_markers_all(config_dict):
# get parameters from Config.toml
project_dir = config_dict.get('project').get('project_dir')
pathInputTRCFile = os.path.realpath(os.path.join(project_dir, 'pose-3d'))
Expand Down
6 changes: 3 additions & 3 deletions Pose2Sim/poseEstimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def process_images(image_folder_path, vid_img_extension, pose_tracker, output_fo
cv2.destroyAllWindows()


def rtm_estimator(config_dict):
def estimate_pose_all(config_dict):
'''
Estimate pose from a video file or a folder of images and
write the results to JSON files, videos, and/or images.
Expand Down Expand Up @@ -523,14 +523,14 @@ def rtm_estimator(config_dict):
video_files = glob.glob(os.path.join(video_dir, '*'+vid_img_extension))
if not len(video_files) == 0:
# Process video files
logging.info(f'Found video files with extension {vid_img_extension}.')
logging.info(f'Found video files with {vid_img_extension} extension.')
for video_path in video_files:
pose_tracker.reset()
process_video(video_path, pose_tracker, output_format, save_video, save_images, display_detection, frame_range, multi_person)

else:
# Process image folders
logging.info(f'Found image folders with extension {vid_img_extension}.')
logging.info(f'Found image folders with {vid_img_extension} extension.')
image_folders = [f for f in os.listdir(video_dir) if os.path.isdir(os.path.join(video_dir, f))]
for image_folder in image_folders:
pose_tracker.reset()
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ Pose2Sim.poseEstimation()
# Same approach for hand or face pose estimation, check the RTMLib documentation for more information.
```



<img src="Content/Pose2D.png" width="760">

</br>
Expand Down Expand Up @@ -687,7 +685,7 @@ _**Note that inverse kinematic results are not necessarily better after marker a
**Make sure that `participant_height` is correct in your [Config.toml](https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Demo_SinglePerson/Config.toml) file.** `participant_mass` is mostly optional for IK.\
Only works with models estimating at least the following keypoints (e.g., not COCO):
``` python
["Neck", "RShoulder", "LShoulder", "RHip", "LHip", "RKnee", "LKnee",
["RShoulder", "LShoulder", "RHip", "LHip", "RKnee", "LKnee",
"RAnkle", "LAnkle", "RHeel", "LHeel", "RSmallToe", "LSmallToe",
"RBigToe", "LBigToe", "RElbow", "LElbow", "RWrist", "LWrist"]
```
Expand Down

0 comments on commit f51ff53

Please sign in to comment.