allentdan / libtorchtutorials Goto Github PK
View Code? Open in Web Editor NEWThis is a code repository for pytorch c++ (or libtorch) tutorial.
License: Apache License 2.0
This is a code repository for pytorch c++ (or libtorch) tutorial.
License: Apache License 2.0
你好,我最近参考你的代码加载模型时碰到了点问题
教程第五章,给出了用pytorch保存模型时用
traced_script_module = torch.jit.trace(model, var)
traced_script_module.save("vgg16bn.pt")
然后C++ libtorch加载模型时用 torch::load(vgg16bn,"your path to vgg16bn.pt");
。
我用同样的python代码保存模型,加载模型用 torch::load
时报错:In template: invalid operands to binary expression ('serialize::InputArchive' and '<ModelName>')
,但是用 torch::jit::script::Module module = torch::jit::load(modelPath);
可以加载模型。
我想问下前一个错误能怎么解决呢?虽然第二种方式可以加载模型但是是黑箱方式加载,我还是希望能用白盒方式加载模型。
我用的pytorch和libtorch是1.4.0版本
你好,
请教一下,Torch::Device对象可以作为函数形参吗? 我们封装模型推理器时,怎么让调用者可以动态指定计算设备?
I download libtorch,and unzip it .
libtorch/include/c10/cuda/CUDAStream.h:6:10: fatal error: cuda_runtime_api.h: No such file or directory
#include <cuda_runtime_api.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
why,tks
您好,非常感谢您提供的教程,我在利用RTX3080和训练好的模型推理过程中遇到这样的奇怪问题: 利用ros播放bag包, 程序从ros topic中获取, 第一次推理时间为0.2s,而后20次推理时间为12s左右,这之后的推理时间稳定在0.03s左右了,请问您有遇到过类似的现象吗?有什么好的解决办法呢?谢谢啦
Where did you learn to code LibTorch in C++? Most resources that I find are only for python. Is there a textbook for C++ LibTorch?
error: LNK2001: 无法解析的外部符号 "int __cdecl at::cuda::warp_size(void)" (?warp_size@cuda@at@@yahxz)
hello, thanks for your nice repo! I have a question about how to convert trained model in libtorch to onnx? could you give me some instructions?
你好,考虑到模型加速的问题,请问下使用libtorch训练得到的pt模型,如何导出onnx?或者如何直接通过tensorRT加速?
作者你好,我按照官网 -DCMAKE_PREFIX_PATH=<path2libtorch> ..
引入libtorch库,然后cmake的时候报出以下警告
CMake Warning (dev) at xxx/cmake-3.20.0/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (torch) does
not match the name of the calling package (Torch). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
然后我打印 ${TORCH_LIBRIRES}
的值,是 torch;torch_library;<path2libtorch>/lib/libc10.so
。请问这个情况正常吗?我目前写个简单libtorch应用没问题,但是想将libtorch引入到klee时总是编译错误,链接不到libtorch,不知道是不是跟这个有关。
Dear team,
Thank you for the great project.
Were you able to read a wav file into torch::tensor in C++?
Thanks
可以写一个YoloV5,训练的例子吗,现在Detect是YoloV4
trace 或script的时候?
pytorch官网下面有一样的报错,但是无准确 准确解答。
请问怎么办
你好,在通过bbox的xmin,ymin,xmax,ymax来计算bbox的w,h时,要不要写成w=xmax-xmin+1, h=ymax-min+1这种方式,比如从像素坐标5到像素坐标10,宽度就应该是10-5+1=6嘛。但确实也看到大量开源框架,包括您这边实现的代码以及数据增强库albumentations里边,也都采用w=xmax-xmin,想知道这是怎么原因?
大佬,看了您写的Libtorch教程,感觉写得很不错,很有帮助。我是知识星球【CV技术指南】的编辑,想问问您能否允许我转载到知识星球中?另外,CV技术指南有上万的计算机视觉相关研究者和从业者,一直在为促进CV行业的发展贡献力量,有很多大佬都在积极参与维护这个社区或组织。目前正在计划对计算机视觉的各种技术做一个完整的技术教程系列,包括CUDA、tensorRT、TVM、openVINO、MNN、openMM、PaddlePaddle、Pytorch源码解读、caffe源码解读、libtorch、Oneflow、Detectron等,计划每个教程由一位大佬来完成,教程将声明作者,以提高您的行业影响力,期望该教程成为大家公认的只要学这个技术就来看这个教程的口碑与影响力,就像视觉SLAM十四讲那样。所以想邀请您为了我们Libtorch的技术教程进行投稿,当然其他教程也可以,我们也可以一起梳理下写的内容一起交流。此外,我们也有一定的稿费。如果您有兴趣的话,可以考虑一下或者了解更详细的情况。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.