Vào thẳng nội dung

Head Pose Estimation

Overviews

Head Pose Estimation

The packages contain 2 different algorithms:

  1. 6DRepNet (sixd_repnet)

    Original git(6DRepNet): https://github.com/thohemp/6DRepNet.git

  2. DirectMHP

    Original git(DirectMHP): https://github.com/hnuzhy/DirectMHP.git

DirectMHP

Example DirectMHP

In this document, we will show you how to use HACHIX version of these algorithms.

APIs

Model

Bases: BaseModel

build_model(custom_weight=None)

Build model. Type of model is defined in opt.json. Can be "sixd_repnet" or "directmhp"

Parameters:

Name Type Description Default
custom_weight str

Custom weight. Defaults to None.

None

Returns:

Name Type Description
model Model

model sixd_repnet or model directmhp depends on opt.json

fit()

Train model

get_transform()

Transform input by ImageNet normalization.

Returns:

Name Type Description
Compose

A Transform Compose

predict(img_path)

Predict using Head Pose Estimation

Parameters:

Name Type Description Default
img_path str

The path to the input image file.

required

With model type is sixd_repnet Returns: img (np.array): The output image. pitchs (List): Predicted pitch values. yaws (List): Predicted yaw values. rolls (List): Predicted roll values.

With model type is directmhp Returns: img0 (np.array): The processed image. bboxes (numpy.ndarray): Predicted bounding boxes. scores (numpy.ndarray): Predicted scores. pitchs_yaws_rolls (numpy.ndarray): Predicted pitch, yaw, and roll values.

process_predictions(net_output, raw_image_path, raw_image_mat, image_transform, save_image_path)

post process the output of the net

Parameters:

Name Type Description Default
net_output _type_

output of detection net

required
raw_image_path str

raw image path

required
raw_image_mat Array

raw image numpy mat type

required
image_transform func

image_transform function

required
save_image_path str

save image path

required

Returns:

Name Type Description
save_image_path str

inform that the annotation image has been written successfully