dl-colab-notebooks for hrnet 2d pose detector ? extension
basicvisual opened this issue · 4 comments
Hi following , your example for open-pose
we are trying to implement, a simiar dl-colab for 2d pose detector hrnet
. We are having some issues , for implementing it , by splitting the input video into frames and applying the model. But for some reason I dont seem to get it working.
The github repository we are following are
https://github.com/lxy5513/hrnet
From initial inspection it looks like the model is called here
https://github.com/lxy5513/hrnet/blob/f89986411e47749a9ea7eb13b6f3d0f703d03231/pose_estimation/video.py#L140
But we are unable to move forward on this.
https://colab.research.google.com/drive/0B0nSo-sEMGvvamtlbl9ucW1ycVF5OWg0QVc3d0E3dmVIQ3FJ
Tips would be appreciated!
thank you ! I had some queries. I wanted to dump the keypoint co/ordinates to a json file in a created folder . I think preds
is the parameter which returns the keypoint co ordinates. I wanted something similar to open pose format per frame
{"people": [{"pose_keypoints": [374, 460, 374, 516, 324, 518, 296, 596, 336, 636, 424, 512, 446, 590, 424, 604, 340, 660, 324, 776, 308, 890, 400, 660, 402, 792, 400, 904, 364, 448, 382, 450, 348, 450, 396, 450]}]}
to have keypoins files similar as 00000000001_keypoints.json
or anything similar with per frame
So for every frame i can store it in a json file for analysis .
Also is it possible to also store the overlaid images as png
in a different folder / per frame ?
to have keypoins files similar as 00000000001_keypoints.json
you have to investigate what does the function plot_keypoint(origin_img, preds, maxvals, 0.1)
and dump it to a JSON file
Also is it possible to also store the overlaid images as png in a different folder / per frame ?
yes, instead of video_writer.write(image[:,:,::-1])
use cv2.imwrite
Hi Thanks for the tips . I tried to create a folder trying to have a format as needed. Json keypoints per second. I am having some issues , and i am not sure what exactly is the issue as i checked in in python enviroment it seemed to work fine . I am a bit lost but i think the issue lies in the following
try:
os.makedirs('output_json_dir')
except OSError as e:
if e.errno != errno.EEXIST:
raise
dc = {"people":[]}
dc["people"].append({"pose_keypoints" : list(preds_rearrange_mod.ravel())})
if 'output_json_dir':
#Writing perframe
with open(os.path.join('output_json_dir', '{0}_keypoints.json'.format(str(frame).zfill(12))), 'w') as outfile:
json.dump(dc, outfile)
'''
The colab notebook is as follows
https://colab.research.google.com/drive/1xJ4ePiskFYGQ6h7l7xfGmdPHqBGquti2
Help and tips are greatly appreicated!