Project for training unet with libtorch in darknet format.
To avoid spending time on reading next one just try to run build.sh script for building the project:
./build.sh
run.sh
Hope you know how to do that...
Consider that there is two different versions with CUDA support and without. You should use needed version according to your hardware support CUDA and CUDA tool kit installed previous. Next reference describe how to install CUDA and all info about needed hardware for it:
After you will be ready to decide which version you will need download one of them:
- With CUDA - https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.6.0.zip
- CPU only - https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.6.0%2Bcpu.zip
Hope you know how to do that, do not afraid project settings does not depend of some path, and can be flexible be set to needed distributive without patching your system by unneeded dependencies(definitely for now).
I suggest to use 4.4.0 version because some of new DNN extentions was created there and it will be needed for testing results of this training UNet project. Also path can be flexible passed to the project without installing it to the system.
In addition in case CUDA supported by your system you can build OpenCV with CUDA support too:
Yeah it is true because in my project I have used std::filesystem(do not arguing me on that)
You can change it to lower version but I suggest to install the most newest version which there is. You should understand that XCode, and Visual Studio changed every year and add new features and CMake project gets updates for it. It will safe your time of unneded finding what will going wrong if some problem will be occurred on different platform.
The most flexible way to do it with next cmake command(if OpenCV and libtorch installed to your system):
- Debug version(by default -DCMAKE_BUILD_TYPE=Debug):
cmake -Bbuild_host
- Release version(change build type with -DCMAKE_BUILD_TYPE=Release):
cmake -Bbuild_host -DCMAKE_BUILD_TYPE=Release
- But as I said previous it is not necessary to be installed OpenCV and libtorch. Instead you can pass pathes to the CMake with your own locations for that.
cmake -Bbuild_host \
-DCUSTOM_TORCH_BUILD_PATH="<path-to-the-root-folder-of-unpacked-libtorch>" \
-DCUSTOM_OPENCV_BUILD_PATH="<path-to-the-root-folder-of-your-opencv>" \
Note: build_host - it is a name of folder where CMake will create and put generated project and needed artifacts for build.
Start building with asking cmake to delegate build to generated project(not only make).
cmake --build build_host --build --target all
11. If it will be ok you can use command line and run produced executable "train_unet_darknet2d" with --help
./build_host/train_unet_2d --help