Closed ykk648 closed 2 years ago
I'm not sure I understand your problem, can you be a little more specific?
These Try/Except lines try to triangulate from the pose2D-tracked folder, but if the tracking step has not been completed it reverts to triangulating from the pose2d folder. Normally it should take your json files in order, regardless of their names.
Example: if you have weird json file names and two cameras like:
pose2d
cam1_json
001.json 1000.json 2.json a.json
cam2_json
008.json 009.json 010.json 011.json
It will triangulate 001 and 008, 1000 and 009, 2 and 010, a and 011.
The only thing is that your json folders must end with the string 'json' (but you can change this string in Config.toml
).
An other possible cause of malfunction is if you just didn't use the right OpenPose model.
Did you use body_25 or body_25b ? You must specify it in the Config.toml
file.
I had the same problem. The body_25B skeleton is not the same as body_25. And we can easily find just the body_25 skeleton description.
@ykk648 take a look at the file skeleton.py, you will find your answer there 😃
thanks for your reply, it may caused by different json name format.
here's codes I modified, I specifed the sort way for json files, if not, the json file sequence will be like 1.json
, 3.json
,2.json
, now it's 1.json
2.json
3.json
json_file_sorted_probe = lambda x: int(x.split('.')[0])
try:
json_files_names = []
for js_dir in json_dirs_names:
before_sort = fnmatch.filter(os.listdir(os.path.join(poseTracked_dir, js_dir)), '*.json')
before_sort.sort(key=json_file_sorted_probe)
json_files_names.append(before_sort)
# print(json_files_names)
json_tracked_files = [[os.path.join(poseTracked_dir, j_dir, j_file) for j_file in json_files_names[j]] for j, j_dir in enumerate(json_dirs_names)]
except:
json_files_names = []
for js_dir in json_dirs_names:
before_sort = fnmatch.filter(os.listdir(os.path.join(pose_dir, js_dir)), '*.json')
before_sort.sort(key=json_file_sorted_probe)
json_files_names.append(before_sort)
json_tracked_files = [[os.path.join(pose_dir, j_dir, j_file) for j_file in json_files_names[j]] for j, j_dir in enumerate(json_dirs_names)]
It may caused by rename of OpenPose results, I would like close this issue , thank you again.
Because dont know the names of 2d/2d-tracked json files, I used my own name format
N.json
, but the codes intriangulate_3d.py
may not sort the json files right , causing disorder 3d joints shown in OpenSim before I modified these codes.https://github.com/perfanalytics/pose2sim/blob/2113aa5f4aad097cb40465ee79eaa8d48abe2955/Pose2Sim/triangulate_3d.py#L389