Open wangsen1312 opened 4 years ago
@wangsen1312 thanks for pointing this out! Indeed, recently DensePose types were refactored to bring more clarify in terms of what is stored inside the outputs and results. The documentation of apply_net
tool has not been updated.
Now the results.pkl
file is structured as follows:
data[img_id]['pred_densepose']
is a list of instances of DensePoseChartResultWithConfidences
. Those instances contain the following fields:
labels
- a tensor of size [H, W]
of type torch.long
which contains fine segmentation labels (previously called I
)uv
- a tensor of size [2, H, W]
of type torch.float
which contains U
and V
coordinatessigma_1
, sigma_2
, kappa_u
, kappa_v
, fine_segm_confidence
, coarse_segm_confidence
)So what was previously called IUV
is now labels
and uv
. If you would like to obtain quantized values, i.e. IUV
expressed as an uint8
array with labels and U
and V
coordinates quantized , you can call quantize_densepose_chart_result
on an instance of DensePoseChartResultWithConfidences
. This will give you an instance of DensePoseChartResultQuantized
and IUV
values will be stored in its attribute labels_uv_uint8
.
Documentation needs to be updated.
@vkhalidov Thank you for your reply.
Hi, do you know why there're multiple DensePoseChartResultWithConfidences
predicted for a single image even if there's only one person in the image?
I want to decode the results.pkl From the Densepose APPLY_NET documents: it shows:
from densepose.data.structures import DensePoseResult img_id, instance_id = 0, 0 # Look at the first image and the first detected instance bbox_xyxy = data[img_id]['pred_boxes_XYXY'][instance_id] result_encoded = data[img_id]['pred_densepose'].results[instance_id] iuv_arr = DensePoseResult.decode_png_data(*result_encoded)
But for the latest scripts, DensePoseResult part has been removed, so how to get the iuv_arr from the pkl?
Thank you for your help!