johannakarras / DreamPose

Official implementation of "DreamPose: Fashion Image-to-Video Synthesis via Stable Diffusion"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

do you use densepose's original pickle.dump(context["results"], hFile) to save pkl?If I use this, I can't open it with your densepose.py.It said invalid

zhangtao22 opened this issue · comments

File "/data/detectron2/projects/DensePose/densepose.py", line 17, in
data = torch.load(outpath)
File "/root/anaconda3/lib/python3.10/site-packages/torch/serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/root/anaconda3/lib/python3.10/site-packages/torch/serialization.py", line 922, in _legacy_load
raise RuntimeError("Invalid magic number; corrupt file?")

when I modify the code with your densepose.py to generate dense.npy, my frame_50_densepose.npy has many differences with yours. why?
if outputs.has("pred_boxes"):
result["pred_boxes_XYXY"] = outputs.get("pred_boxes").tensor.cpu()
if outputs.has("pred_densepose"):
if isinstance(outputs.pred_densepose, DensePoseChartPredictorOutput):
extractor = DensePoseResultExtractor()
elif isinstance(outputs.pred_densepose, DensePoseEmbeddingPredictorOutput):
extractor = DensePoseOutputsExtractor()
result["pred_densepose"] = extractor(outputs)[0]
# npy
dp_uv = result['pred_densepose'][0].uv
h, w, c = entry['image'].shape
, h, w_ = dp_uv.shape
(x1, y1, x2, y2) = result['pred_boxes_XYXY'][0].int().numpy() # location of person
y2, x2 = y1+h_, x1+w_
dp_im = np.zeros((2, h, w))
dp_im[:,y1:y2,x1:x2] = dp_uv.cpu().numpy()
savepath = entry['file_name'].replace('.png', '_densepose.npy')
np.save(savepath, dp_im)
# end
context["results"].append(result)