o e@sNddlmZddlmZmZddlZddlmZdedeeddfdd ZdS) )fields)AnyListN) Instancesdensepose_predictor_output detectionsreturnc Csd}|D]A}|dur q|}t|}i}t|D]}t||j}t|tjr3||||||j<q|||j<q|di||_||7}qdS)a2 Splits DensePose predictor outputs into chunks, each chunk corresponds to detections on one image. Predictor output chunks are stored in `pred_densepose` attribute of the corresponding `Instances` object. Args: densepose_predictor_output: a dataclass instance (can be of different types, depending on predictor used for inference). Each field can be `None` (if the corresponding output was not inferred) or a tensor of size [N, ...], where N = N_1 + N_2 + .. + N_k is a total number of detections on all images, N_1 is the number of detections on image 1, N_2 is the number of detections on image 2, etc. detections: a list of objects of type `Instance`, k-th object corresponds to detections on k-th image. rN) __len__typergetattrname isinstancetorchTensorpred_densepose) rrkZ detection_in_iZPredictorOutputZ output_i_dictfield field_valuer r P/home/jovyan/fileviewer/workspace/yisol/IDM-VTON/densepose/modeling/inference.pydensepose_inference s     r) dataclassesrtypingrrrdetectron2.structuresrrr r r rs