From ac037e05cef4f62a42c0662c2390796cf05d046b Mon Sep 17 00:00:00 2001 From: davidpagnon Date: Thu, 18 Jul 2024 09:51:42 +0200 Subject: [PATCH] works if no number in camera folder names --- Pose2Sim/common.py | 12 ++++++++---- README.md | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Pose2Sim/common.py b/Pose2Sim/common.py index d536eb0..35a72e5 100644 --- a/Pose2Sim/common.py +++ b/Pose2Sim/common.py @@ -345,12 +345,16 @@ def sort_stringlist_by_last_number(string_list): Sort a list of strings based on the last number in the string. Works if other numbers in the string, if strings after number. Ignores alphabetical order. - Example: ['json1', 'js4on2.b', 'eypoints_0000003.json', 'ajson0', 'json10'] - gives: ['ajson0', 'json1', 'js4on2.b', 'eypoints_0000003.json', 'json10'] + Example: ['json1', 'zero', 'js4on2.b', 'aaaa', 'eypoints_0000003.json', 'ajson0', 'json10'] + gives: ['ajson0', 'json1', 'js4on2.b', 'eypoints_0000003.json', 'json10', 'aaaa', 'zero'] ''' - + def sort_by_last_number(s): - return int(re.findall(r'\d+', s)[-1]) + numbers = re.findall(r'\d+', s) + if numbers: + return (False, int(numbers[-1])) + else: + return (True, s) return sorted(string_list, key=sort_by_last_number) diff --git a/README.md b/README.md index 2d5306d..742c849 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ from Pose2Sim import Pose2Sim Pose2Sim.runAll() ``` -The batch processing structure requires a `Config.toml` file in each of the trial directories. Global parameters are given in the `Config.toml` file of the `BatchSession` folder. They can be altered for specific or `Trials` by uncommenting keys and their values in their respective `Config.toml` files. +The batch processing structure requires a `Config.toml` file in each of the trial directories. Global parameters are given in the `Config.toml` file of the `BatchSession` folder. They can be altered for specific Trials by uncommenting keys and their values in their respective `Config.toml` files. Run Pose2Sim from the `BatchSession` folder if you want to batch process the whole session, or from a `Trial` folder if you want to process only a specific trial. @@ -320,6 +320,8 @@ Pose2Sim.poseEstimation() > Coming soon +
+ ### With DeepLabCut: > If you need to detect specific points on a human being, an animal, or an object, you can also train your own model with [DeepLabCut](https://github.com/DeepLabCut/DeepLabCut). In this case, Pose2Sim is used as an alternative to [AniPose](https://github.com/lambdaloop/anipose). 1. Train your DeepLabCut model and run it on your images or videos (more instruction on their repository)