Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resnet50 not working #5790

Open
xalteropsx opened this issue Nov 22, 2024 · 1 comment
Open

Resnet50 not working #5790

xalteropsx opened this issue Nov 22, 2024 · 1 comment

Comments

@xalteropsx
Copy link

xalteropsx commented Nov 22, 2024

Resnet50 not working on gpu only working on cpu is it common or i have only the problem

import numpy as np
import ncnn
import torch

def test_inference():
    torch.manual_seed(0)
    in0 = torch.rand(1, 3, 224, 224, dtype=torch.float)
    out = []

    with ncnn.Net() as net:
        net.load_param("resnet50.ncnn.param")
        net.load_model("resnet50.ncnn.bin")
        # net.opt.use_vulkan_compute = True

        with net.create_extractor() as ex:
            ex.input("in0", ncnn.Mat(in0.squeeze(0).numpy()).clone())

            _, out0 = ex.extract("out0")
            out.append(torch.from_numpy(np.array(out0)).unsqueeze(0))
            _, out1 = ex.extract("out1")
            out.append(torch.from_numpy(np.array(out1)).unsqueeze(0))
            _, out2 = ex.extract("out2")
            out.append(torch.from_numpy(np.array(out2)).unsqueeze(0))

        return out

if __name__ == "__main__":
    print(test_inference())
@xalteropsx
Copy link
Author

xalteropsx commented Nov 22, 2024

@Baiyuetribe morning bro >.< was pretty stuck to understand

net.opt.use_vulkan_compute = True why this line causing it crash without any warning or error is it common or just i have the problem ?

this is the model i used detection_Resnet50_Final.pth from xinntao facexlib

below ncnn model
https://drive.google.com/drive/folders/1F_qcV1qAm_QcNMFlh6WJ9QxRbeLCuXw0?usp=sharing

@xalteropsx xalteropsx changed the title Resnet50 model .... Resnet50 not working Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant