下面是一些值得参考的教程:
一、搭开发环境
(在虚拟机Ubuntu中搭建)
解压后,(参考最上面的视频教程:C++人工智能教程(基于libtorch))
QTCreator中CMakeLists.txt修改为:
cmake_minimum_required(VERSION 3.5)
project(UnderWater LANGUAGES CXX)
set(Torch_DIR "/home/book/share/libtorch/libtorch/share/cmake/Torch")
find_package(Torch REQUIRED)
if(TORCH_FOUND)
message("Found Torch")
else()
message("Cannot found Torch")
endif()
add_executable(UnderWater main.cpp)
target_link_libraries(${PROJECT_NAME} ${TORCH_LIBRARIES})
二、用python训练模型
参考:使用YOLOv5训练模型
(1)搭建相关环境(参考上面的视频教程:PyTorch深度学习快速入门教程)
---------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------