works if no number in camera folder names

This commit is contained in:
davidpagnon 2024-07-18 09:51:42 +02:00
parent 644ce103b8
commit ac037e05ce
2 changed files with 11 additions and 5 deletions

View File

@ -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. 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. Works if other numbers in the string, if strings after number. Ignores alphabetical order.
Example: ['json1', 'js4on2.b', 'eypoints_0000003.json', 'ajson0', 'json10'] Example: ['json1', 'zero', 'js4on2.b', 'aaaa', 'eypoints_0000003.json', 'ajson0', 'json10']
gives: ['ajson0', 'json1', 'js4on2.b', 'eypoints_0000003.json', 'json10'] gives: ['ajson0', 'json1', 'js4on2.b', 'eypoints_0000003.json', 'json10', 'aaaa', 'zero']
''' '''
def sort_by_last_number(s): 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) return sorted(string_list, key=sort_by_last_number)

View File

@ -258,7 +258,7 @@ from Pose2Sim import Pose2Sim
Pose2Sim.runAll() 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. 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 > Coming soon
</br>
### With DeepLabCut: ### 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). > 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) 1. Train your DeepLabCut model and run it on your images or videos (more instruction on their repository)