Skip to content

Human Parsing

Image title

Query image and prediction

BiWAKO.HumanParsing

Basic ResNet50 model for parsing attributes of pedestrians

Model

This model is trained on the pedestrian dataset with following multi-label classification task: - "is_male", - "has_bag", - "has_hat", - "has_longsleeves", - "has_longpants", - "has_longhair", - "has_coat_jacket",

Attributes:

Name Type Description
model onnxruntime.InferenceSession

ONNXRuntime instance.

conf_thresh float

confidence threshold for prediction.

input_name str

name of input node.

output_name str

name of output node.

input_shape tuple

shape of input node.

labels np.ndarray

mapping of label index to label name.

__init__(self, model='human_attribute', conf_thresh=0.4) special

Initialize HumanParsing

Parameters:

Name Type Description Default
model str

model name or path to the onnx file. Defaults to "human_attribute".

'human_attribute'
conf_thresh float

confidence threshold. Defaults to 0.4.

0.4

predict(self, image)

Return the prediction on the image.

Parameters:

Name Type Description Default
image Image

image to be processed in str or cv2 format.

required

Returns:

Type Description
np.ndarray

processed image

render(self, prediction, image)

Return the original image with the prediction at the top left corner.

Parameters:

Name Type Description Default
prediction np.ndarray

prediction of the model.

required
image Image

image to be rendered in str or cv2 format.

required

Returns:

Type Description
np.ndarray

rendered image