Closed frankkim1108 closed 4 years ago
If it works in terminal then it's a limitation of Pycharm which we'll not investigate.
I apologize for my question being not clear. My question is about where can I find 3D coordinates when I do
python apply_net.py dump configs/densepose_rcnn_R_50_FPN_s1x.yaml DensePose_ResNet50_FPN_s1x-e2e.pkl "Jongwook_F2.jpg" --output results.pkl -v
When I opened the results.pkl file I couldn't see the coordinates.
Thank you for reading my questions.
The output file results.pkl
should contain the list of results per image, for each image the result is a dictionary. DensePose results are stored under pred_densepose
key, it is an instance of DensePoseResult class. It contains the list of results in the results
attribute. Each result is encoded as a string. So to extract the result one needs to decode the string using DensePoseResult.decode_png_data
, e.g.
(densepose_shape, densepose_data_encoded), bbox_xywh = densepose_results[i]
iuv_arr = DensePoseResult.decode_png_data(densepose_shape, densepose_data_encoded)
Thank you for your response. However, due to my lack of knowledge I couldn't follow your steps properly.
To open the pkl file I used
with open('/home/elysium/detectron2/projects/DensePose/result3.pkl', 'rb') as f:
data_list = []
while True:
try:
data = pickle.load(f)
except EOFError:
break
data_list.append(data)
{'file_name': 'Jongwook_F2.jpg', 'scores': tensor([0.9999, 0.3534]), 'pred_boxes_XYXY': tensor([[ 10.4258, 358.9859, 2114.6133, 2578.4807],
[ 816.5173, 855.3380, 1347.3788, 2662.1370]]), 'pred_densepose': <densepose.structures.DensePoseResult object at 0x7f841b9f9150>}
print(data_list[0][0]['pred_densepose']
and I got
DensePoseResult: N=2 [[3, 2219, 2104], [3, 1806, 530]]
DensePoseResult.decode_png_data
nor
(densepose_shape, densepose_data_encoded), bbox_xywh = densepose_results[i]
iuv_arr = DensePoseResult.decode_png_data(densepose_shape, densepose_data_encoded)
I'm very sorry for asking too much... I was frustrated because I got stuck on this stage for a long time.
https://github.com/facebookresearch/detectron2/issues/165#issuecomment-561943932 I got answers from here Thank You for helping me!
I am trying to use the ApplyNet and get the estimated U,V coordinates. I successfully did apply_net show and got the result visually. However I want to get the coordinates. I tried using apply_net dump and got a results.pkl file. However when I tried to open the pkl file from Pycharm I got an error that says "ModuleNotFoundError: No module named 'densepose.structures'" It works fine when I open the file with terminal.
I want to know where I can get the coordinates from a file.