Skip to content

A wrong weight file for demo codesΒ #74

@1511878618

Description

@1511878618

I run this code with pretrained, the output is follow:

torchlm.runtime.bind(
    faceboxesv2(device="cpu")
)  # set device="cuda" if you want to run with CUDA
# set map_location="cuda" if you want to run with CUDA
torchlm.runtime.bind(
    pipnet(
        backbone="resnet18",
        pretrained=True,
        num_nb=10,
        num_lms=98,
        net_stride=32,
        input_size=256,
        meanface_type="wflw",
        map_location="cpu",
        # checkpoint="=pipnet_resnet18_10x98x32x256_wflw.pth",
    )
)  # will auto download pretrained weights from latest release if pretrained=True
# image should be HWC, BGR/RGB

landmarks, bboxes = torchlm.runtime.forward(
    image, swapRB_before_face=True, swapRB_before_landmarks=True
)
# swap h and w
# landmarks =
print(landmarks.shape)
image = torchlm.utils.draw_bboxes(image, bboxes=bboxes)
image = torchlm.utils.draw_landmarks(image, landmarks=landmarks)
Image.fromarray(image)

Image

If i downloaded the weights file from Releases with checkpoint, then it is ok

torchlm.runtime.bind(
    faceboxesv2(device="cpu")
)  # set device="cuda" if you want to run with CUDA
# set map_location="cuda" if you want to run with CUDA
torchlm.runtime.bind(
    pipnet(
        backbone="resnet18",
        pretrained=True,
        num_nb=10,
        num_lms=98,
        net_stride=32,
        input_size=256,
        meanface_type="wflw",
        map_location="cpu",
        checkpoint="=pipnet_resnet18_10x98x32x256_wflw.pth",
    )
)  # will auto download pretrained weights from latest release if pretrained=True
# image should be HWC, BGR/RGB

landmarks, bboxes = torchlm.runtime.forward(
    image, swapRB_before_face=True, swapRB_before_landmarks=True
)
# swap h and w
# landmarks =
print(landmarks.shape)
image = torchlm.utils.draw_bboxes(image, bboxes=bboxes)
image = torchlm.utils.draw_landmarks(image, landmarks=landmarks)
Image.fromarray(image)

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions