Coder Social home page Coder Social logo

Comments (2)

gemfield avatar gemfield commented on August 25, 2024

从错误信息看,发生错误的pybind并非使用的是MLab HomePod 2.0 pro内置的pybind11:

gemfield@homepod:~/src$ dpkg -l | grep pybind11
ii  pybind11-dev                                                2.4.3-2build2                                                            all          seamless operability between C++11 and Python

而是libtorch中打包的pybind:

/deepvac/libtorch/include/pybind11/pybind11.h:1315:13: note: candidate: ??template<class Func, class ... Extra> pybind11::class_< <template-parameter-1-1>, <template-parameter-1-2> >& pybind11::class_< <template-parameter-1-1>, <template-parameter-1-2> >::def(const char*, Func&&, const Extra& ...) [with Func = Func; Extra = {Extra ...}; type_ = deepvac::SyszuxPornCls; options = {}]??
 1315 |     class_ &def(const char *name_, Func&& f, const Extra&... extra) {
      |             ^~~

但是刚才测试发现,这两者都会报错。

from mlab.

gemfield avatar gemfield commented on August 25, 2024

这是因为错误中的process函数实现了重载:

std::optional<std::pair<int, float>> process(cv::Mat frame);
at::Tensor process(at::Tensor& t);

所以PYBIND11_MODULE的语法:

    py::class_<SyszuxVisionTerror>(m, "SyszuxVisionTerror")
        .def(py::init<std::string>())
        .def("process", &SyszuxVisionTerror::process);

需要改写为:

    py::class_<SyszuxVisionTerror>(m, "SyszuxVisionTerror")
        .def(py::init<std::string>())
        .def("process", py::overload_cast<at::Tensor&>(&SyszuxVisionTerror::process), "forward at Tensor.")
        .def("process", py::overload_cast<cv::Mat>(&SyszuxVisionTerror::process), "forward cv Mat.");

from mlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.