当前位置: 首页 > news >正文

电子商务网站建设分析和总结国内网站怎么做有效果

电子商务网站建设分析和总结,国内网站怎么做有效果,郑州自建网站,厦门有设计网站的吗首先按照win下C部署深度学习模型之clion配置pytorchopencv教程记录 步骤配置。 LibTorch 部分 在测试LibTorch时会出现类似 c10.dll not found 的问题(Debug才有): 参考C部署Pytorch(Libtorch)出现问题、错误汇总和 …

首先按照win下C++部署深度学习模型之clion配置pytorch+opencv教程记录 步骤配置。

LibTorch 部分

在测试LibTorch时会出现类似 c10.dll not found 的问题(Debug才有):

在这里插入图片描述

参考C++部署Pytorch(Libtorch)出现问题、错误汇总和
如何在windows10上使用cmake配置libtorch(vs2022版)

主要是MSVC需要这些 dll文件 。 可以如下修改CmakeList.txt让它找到:

cmake_minimum_required(VERSION 3.12)
project(opencv_test)set(CMAKE_CXX_STANDARD 17)set(CMAKE_PREFIX_PATH C:/Libraries/libtorch-win-shared-with-deps-2.3.0+cu118/libtorch)
#set(Torch_DIR "E:/libtorch/share/cmake/Torch")
#include_directories("E:/libtorch/include")
#include_directories("E:/libtorch/include/torch/csrc/api/include")
find_package(Torch REQUIRED)
message(STATUS "torch status: ${TORCH_FOUND}")
message(STATUS "torch library: ${TORCH_LIBRARIES}")
message(STATUS "TORCH_INSTALL_PREFIX: ${TORCH_INSTALL_PREFIX}")add_executable(opencv_test main.cpp)
target_link_libraries(opencv_test ${TORCH_LIBRARIES})if (MSVC)file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")add_custom_command(TARGET opencv_testPOST_BUILDCOMMAND ${CMAKE_COMMAND} -E copy_if_different${TORCH_DLLS}$<TARGET_FILE_DIR:opencv_test>)
endif (MSVC)if (CMAKE_VERSION VERSION_GREATER 3.12)set_property(TARGET opencv_test PROPERTY CXX_STANDARD 17)
endif()

OpenCV 部分

clion编译OpenCV时,install的位置在这(更多参考):
在这里插入图片描述

不能用clion编译,还是会出现找不到 dll文件的问题!!!

参考如下链接用VS编译:

Windows 下使用 CMake + Visual Studio 2022 编译 OpenCV 4.8.1 及其扩展模块 (主要参考)

vs2019编译opencv

注: Opencv_world勾选后后面build可能会出问题,不知道怎么解决建议别勾。

之后记得把 D:\prj\opencv\opencv4\out\install\x64-Debug\x64\vc17\bin添加到环境变量。

之后在camke时你可能又出现了问题:

CMake Warning at C:/Libraries/opencv-4.8.1/cmake-build-release/install/OpenCVConfig.cmake:190 (message):Found OpenCV Windows Pack but it has no binaries compatible with yourconfiguration.You should manually point CMake variable OpenCV_DIR to your build of OpenCVlibrary.
Call Stack (most recent call first):CMakeLists.txt:8 (find_package)CMake Error at CMakeLists.txt:8 (find_package):Found package configuration file:C:/Libraries/opencv-4.8.1/cmake-build-release/install/OpenCVConfig.cmakebut it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to beNOT FOUND.

这是因为OpenCV_DIR 应当精确到lib!!! 故意的还是不小心的???

set(OpenCV_DIR C:/Libraries/opencv-4.8.1/cmake-build-release/install/lib)

完整工程文件

CmakeList.txt

cmake_minimum_required(VERSION 3.12)
project(opencv_test)
set(CMAKE_CXX_STANDARD 17)set(CMAKE_BUILD_TYPE "Release")set(OpenCV_DIR C:/Libraries/opencv-4.8.1/build/install/lib)  # 这里要精确到lib!
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
message(STATUS "OpenCV status:" ${OpenCV_FOUND})
message(STATUS "OpenCV Libs:" ${OpenCV_LIBS})set(CMAKE_PREFIX_PATH C:/Libraries/libtorch-win-shared-with-deps-2.3.0+cu118/libtorch)
#set(Torch_DIR "E:/libtorch/share/cmake/Torch")
#include_directories("E:/libtorch/include")
#include_directories("E:/libtorch/include/torch/csrc/api/include")
find_package(Torch REQUIRED)
message(STATUS "torch status: ${TORCH_FOUND}")
message(STATUS "torch library: ${TORCH_LIBRARIES}")
message(STATUS "TORCH_INSTALL_PREFIX: ${TORCH_INSTALL_PREFIX}")add_executable(opencv_test main.cpp)
target_link_libraries(opencv_test${TORCH_LIBRARIES}${OpenCV_LIBS}
)if (MSVC)file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")file(GLOB OpenCV_DLLS "${OpenCV_DIR}/../bin/*.dll")add_custom_command(TARGET opencv_testPOST_BUILDCOMMAND ${CMAKE_COMMAND} -E copy_if_different${TORCH_DLLS} ${OpenCV_DLLS}$<TARGET_FILE_DIR:opencv_test>)
endif (MSVC)

main.cpp

#include <iostream>
#include <torch/script.h>
#include <torch/torch.h>#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>void test_libtorch_version() {if (torch::cuda::cudnn_is_available()){std::cout << "cuDNN is available." << std::endl;}else{std::cout << "cuDNN is not available." << std::endl;}if (torch::cuda::is_available()){std::cout << "CUDA is available." << std::endl;}else{std::cout << "CUDA is not available." << std::endl;}std::cout << "Device count : " << torch::cuda::device_count() << std::endl;}int main(int, char**)  {torch::Tensor a = torch::rand({2, 3});std::cout << a << std::endl;test_libtorch_version();torch::Tensor b = torch::randint(10, 20, { 3, 2 });std::cout << b << std::endl;std::string path = "C:\\Users\\THM\\Documents\\Projects\\test_openvins_py\\data\\coco_bike.jpg";cv::Mat im = cv::imread(path);cv::imshow("image", im);cv::waitKey(0);return 0;
}
http://www.yayakq.cn/news/933958/

相关文章:

  • 刷业务网站怎么做企业网站建设总结
  • 网页设计与网站建设报告书广州番禺发布
  • 京东网站建设流程和结构图WordPress纯代码添加
  • 自建外贸推广网站有哪些wordpress解密
  • 企业网站做备案建筑施工特种证书查询入口官网
  • 网站信息查询wordpress主题翻译插件
  • 上海策朋网站设计公司电商网站详细设计
  • 个人导航网站如何赚钱网站设计与实现毕业设计
  • 网站源码整站下载衡阳网站排名优化公司
  • 网站建设完整方案西固网页设计
  • 海口建站价格彩票网站开发制作需要什么
  • 常州网站推广做网站首页看不到图片
  • 个人网站主题wordpress仿阿里主题
  • 广州网页建设网站百度关键词seo排名优化
  • 视频教程网站模板用户界面设计包括
  • 客户网站建设需要什么资料电话销售做网站犯法吗
  • 哈尔滨网站优化流程濮阳seo外包公司
  • 网站开发是怎么开发的建设什么网站可以上传视频
  • 网站被植入了js淘宝seo优化排名
  • 开封建网站网站建设课程ppt
  • 网站 没有域名需要备案吗中企动力科技股份有限公司石家庄分公司
  • 帮网站网站做推广被抓会判刑吗wordpress 主题授权
  • seo网站优化服务合同万网域名查询网
  • 山东网站制作团队房地产网站模板库
  • 一个网站建立团队大概要多少钱吉林省建设工程造价网站
  • 做网站编辑有前途吗安卓html编辑器
  • 网站按抓取手机软件贵阳南宁网络营销网站
  • 做网站制作大概多少钱百度收录比较好的网站
  • 自己做网站并让别人访问网络推广策划案
  • 惠来建设局网站绍兴建设图审网站