Hello,
I want to use YOLOv5 for object detection Using C++ and libtorch. I’m using Windows 10, and VS 2019.
However, the following code:
#include <torch/script.h>
#include <torch/torch.h>
int main(int argc, char* argv[]) try
{
torch::jit::script::Module module;
try
{
// Deserialize the ScriptModule from a file using torch::jit::load().
module = torch::jit::load("C:/Users/hedey/source/repos/Road_Defects_Detector/YOLOv5s.pt");
}
catch (const c10::Error& e)
{
std::cerr << "error loading the model\n" << e.msg();
std::system("pause");
}
return 0;
}
is causing the following error:
error loading the model
PytorchStreamReader failed locating file constants.pkl: file not foundPress any key to continue . . .