LESSuseLESS / d2

27 stars 2 forks source link

link error #1

Open BigPandaCPU opened 3 years ago

BigPandaCPU commented 3 years ago

Dear Sir, Thanks for your effort on this repo. I have met some problem.Could please help ? OS: Windows 10 VS2019 I have compile detectron2 project as a statci lib successfully. But while I use the Detectron2.lib on another console project, it give error.The error imformations below:

Why the cuda function didn't compile?

1>------ 已启动生成: 项目: Demo, 配置: Release x64 ------ 1> 正在创建库 E:\desktop\VSProject\detectron2\Detectron2\x64\Release\Demo.lib 和对象 E:\desktop\VSProject\detectron2\Detectron2\x64\Release\Demo.exp 1>Detectron2.lib(RotatedBoxes.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::box_iou_rotated_cuda(class at::Tensor const &,class at::Tensor const &)" (?box_iou_rotated_cuda@detectron2@@YA?AVTensor@at@@AEBV23@0@Z) 1>Detectron2.lib(NMS.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::nms_cuda(class at::Tensor const &,class at::Tensor const &,double)" (?nms_cuda@detectron2@@YA?AVTensor@at@@AEBV23@0N@Z) 1>Detectron2.lib(NMS.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::nms_rotated_cuda(class at::Tensor const &,class at::Tensor const &,float)" (?nms_rotated_cuda@detectron2@@YA?AVTensor@at@@AEBV23@0M@Z) 1>Detectron2.lib(ROIAlign.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::ROIAlign_forward_cuda(class at::Tensor const &,class at::Tensor const &,float,int,int,int,bool)" (?ROIAlign_forward_cuda@detectron2@@YA?AVTensor@at@@AEBV23@0MHHH_N@Z) 1>Detectron2.lib(ROIPool.obj) : error LNK2001: 无法解析的外部符号 "class std::tuple<class at::Tensor,class at::Tensor> cdecl detectron2::ROIPool_forward_cuda(class at::Tensor const &,class at::Tensor const &,float,int,int)" (?ROIPool_forward_cuda@detectron2@@YA?AV?$tuple@VTensor@at@@V12@@std@@AEBVTensor@at@@0MHH@Z) 1>Detectron2.lib(ROIPool.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::ROIPool_backward_cuda(class at::Tensor const &,class at::Tensor const &,class at::Tensor const &,float,int,int,int,int,int,int)" (?ROIPool_backward_cuda@detectron2@@YA?AVTensor@at@@AEBV23@00MHHHHHH@Z) 1>Detectron2.lib(ROIAlignRotated.obj) : error LNK2001: 无法解析的外部符号 "class at::Tensor cdecl detectron2::ROIAlignRotated_forward_cuda(class at::Tensor const &,class at::Tensor const &,float,int,int,int)" (?ROIAlignRotated_forward_cuda@detectron2@@YA?AVTensor@at@@AEBV23@0MHHH@Z) 1>Detectron2.lib(ModulatedDeformConvOp.obj) : error LNK2001: 无法解析的外部符号 "void cdecl detectron2::modulated_deform_conv_cuda_forward(class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,int,int,int,int,int,int,int,int,int,int,bool)" (?modulated_deform_conv_cuda_forward@detectron2@@YAXVTensor@at@@0000000HHHHHHHHHH_N@Z) 1>Detectron2.lib(ModulatedDeformConvOp.obj) : error LNK2001: 无法解析的外部符号 "void __cdecl detectron2::modulated_deform_conv_cuda_backward(class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,int,int,int,int,int,int,int,int,int,int,bool)" (?modulated_deform_conv_cuda_backward@detectron2@@YAXVTensor@at@@000000000000HHHHHHHHHH_N@Z) 1>Detectron2.lib(DeformConvOp.obj) : error LNK2001: 无法解析的外部符号 "int cdecl detectron2::deform_conv_forward_cuda(class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,int,int,int,int,int,int,int,int,int,int,int)" (?deform_conv_forward_cuda@detectron2@@YAHVTensor@at@@00000HHHHHHHHHHH@Z) 1>Detectron2.lib(DeformConvOp.obj) : error LNK2001: 无法解析的外部符号 "int cdecl detectron2::deform_conv_backward_input_cuda(class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,int,int,int,int,int,int,int,int,int,int,int)" (?deform_conv_backward_input_cuda@detectron2@@YAHVTensor@at@@000000HHHHHHHHHHH@Z) 1>Detectron2.lib(DeformConvOp.obj) : error LNK2001: 无法解析的外部符号 "int __cdecl detectron2::deform_conv_backward_parameters_cuda(class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,class at::Tensor,int,int,int,int,int,int,int,int,int,int,float,int)" (?deform_conv_backward_parameters_cuda@detectron2@@YAHVTensor@at@@00000HHHHHHHHHHMH@Z) 1>E:\desktop\VSProject\detectron2\Detectron2\x64\Release\Demo.exe : fatal error LNK1120: 12 个无法解析的外部命令

The demo.cpp file is below: void demo() { int selected = 0; static const char *models[] = { "COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl", "COCO-Detection/faster_rcnn_R_101_FPN_3x/137851257/model_final_f6e8b1.pkl", "COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x/138205316/model_final_a3ec72.pkl", "COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x/138363331/model_final_997cc7.pkl", "COCO-PanopticSegmentation/panoptic_fpn_R_101_3x/139514519/model_final_cafdb1.pkl" };

string configDir = "E:\\desktop\\VSProject\\detectron2\\Detectron2\\";
string model = models[selected];
auto tokens = tokenize(model, '/');
VisualizationDemo::Options options;
assert(configDir);

options.config_file = File::ComposeFilename(configDir, tokens[0] + "\\" + tokens[1] + ".yaml");
options.webcam = true;
options.input.push_back(string("image/*.jpg"));
options.output = "predict";
options.opts = { {"MODEL.WEIGHTS", YAML::Node("detectron2://" + model) } };
try {
    VisualizationDemo::start(options);
}
catch (const std::exception& e) {
    const char* msg = e.what();
    std::cerr<< msg;
}

}

int main() { demo(); return 1; }

Look forward your reply!

BigPandaCPU commented 3 years ago

I have solved it. The problem is that i haven't compile the NetLib2.lib. And I found the rederence time is a litle long.It takes about 6 second on the forward time.

sctrueew commented 3 years ago

@BigPandaCPU Hi,

Did you run it on Windows 10 successfully? I used TorchScript but it did not run on Windows 10.