New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evaluation tool compilation on win10x64 with vs2019 #60
Comments
As you can see, I am using the command shell. I ensure that cmake and opencv c++ are installed and the cmake cache is cleared before I rerun any cmake command. |
@zchrissirhcz Could you do me a favor? I'm not familiar with cmake either. |
@cfzd @ustclbh @ustclbh The error your snapshot presents is about, "where are the source and header files?". To make it work, change CMakeLists.txt to the following: cmake_minimum_required(VERSION 3.1)
project(culane_evaluator)
set(CMAKE_CXX_STANDARD 11)
add_definitions(
-DCPU_ONLY
)
set(SRC_LST
${CMAKE_SOURCE_DIR}/src/counter.cpp
${CMAKE_SOURCE_DIR}/src/evaluate.cpp
${CMAKE_SOURCE_DIR}/src/lane_compare.cpp
${CMAKE_SOURCE_DIR}/src/spline.cpp
)
set(HDR_LST
${CMAKE_SOURCE_DIR}/include/counter.hpp
${CMAKE_SOURCE_DIR}/include/hungarianGraph.hpp
${CMAKE_SOURCE_DIR}/include/lane_compare.hpp
${CMAKE_SOURCE_DIR}/include/spline.hpp
)
add_executable(${PROJECT_NAME}
${SRC_LST}
${HDR_LST}
)
set(dep_libs "")
#--- OpenCV
# You may switch different version of OpenCV like this:
# set(OpenCV_DIR "/usr/local/opencv-4.3.0" CACHE PATH "")
find_package(OpenCV REQUIRED
COMPONENTS core highgui imgproc imgcodecs
)
if(NOT OpenCV_FOUND) # if not OpenCV 4.x/3.x, then imgcodecs are not found
find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)
endif()
list(APPEND dep_libs
PUBLIC ${OpenCV_LIBS}
)
#--- OpenMP
find_package(OpenMP)
if(NOT TARGET OpenMP::OpenMP_CXX AND (OpenMP_CXX_FOUND OR OPENMP_FOUND))
target_compile_options(${PROJECT_NAME} PRIVATE ${OpenMP_CXX_FLAGS})
endif()
if(OpenMP_CXX_FOUND OR OPENMP_FOUND)
message(STATUS "Building with OpenMP")
if(OpenMP_CXX_FOUND)
list(APPEND dep_libs PUBLIC OpenMP::OpenMP_CXX)
else()
list(APPEND dep_libs PRIVATE "${OpenMP_CXX_FLAGS}")
endif()
endif()
# --- target config with include dirs / libs
target_link_libraries(${PROJECT_NAME}
${dep_libs}
)
target_include_directories(${PROJECT_NAME}
PUBLIC include
) Note: a manually built of OpenCV is required for VS2019 since OpenCV official doesn't provide it. |
@ustclbh git clone https://gitee.com/mirrors/opencv opencv-4.4.0
cd opencv-4.4.0
git checkout -b 4.4.0 4.4.0
md build
cd build Then create and edit @echo off
set BUILD_DIR=vs2019-x64
if not exist %BUILD_DIR% md %BUILD_DIR%
cd %BUILD_DIR%
cmake ../.. -G "Visual Studio 16 2019" -A x64 ^
-DCMAKE_INSTALL_PREFIX=D:/lib/opencv/4.4.0 ^
-DCV_DISABLE_OPTIMIZATION=ON ^
-DWITH_CUDA=OFF ^
-DWITH_VTK=OFF ^
-DBUILD_LIST=core,imgcodecs,highgui,imgproc
cd ..
pause Where Finally, when building culane evalation code with cmake, tell cmake where to find your opencv 4.4.0, such as: cmake .. -G "Visual Studio 16 2019" -A x64 -D OpenCV_DIR=D:/lib/opencv/4.4.0 |
@zchrissirhcz Thanks a lot! After replacing the new MakeIist, I did meet with the missing "unistd.h" and "getopt" probelm and was struggling with it. Most google solutions do not work for me. I shall try your suggestion quite soon and hopefully take back positive news. |
@zchrissirhcz Thanks again for your help! Even though I build the opencv myself, I am still stuck with the "undefined identifier getopt" error when run "cmake --build . --config Release", just like before. Everything before that goes smoothly. (including build the opencv, run the "opencv-4.4.0/build/vs2019-x64.bat", build debug and release opencv target). As for the "missing unistd.h and getopt" problem, I find related implementation link web, which includes unistd.h, getopt.h, getopt.c. A closely related issue was discussed here. |
Let me make it clear: you can go to see this link: #63 Or, just see my fork of this repo: https://github.com/zchrissirhcz/Ultra-Fast-Lane-Detection/tree/master/evaluation/culane/getopt |
@zchrissirhcz |
@zchrissirhcz @cfzd
Probably you meet some errors when parsing args, like :
|
@ustclbh Thanks for your sharing. I'm not with my GPU enabled computer now, will try use your shared code in later several hours. Once tested I'll make a new PR if possible. |
@zchrissirhcz The process in In this process, the temp file is opened twice. The first time is when it is created, and the second time is when the content of @ustclbh But I don't know why you change the |
@cfzd |
@ustclbh @cfzd When we are on Windows, we should use backslash subprocess.check_call('.\evaluation\culane\evaluate ')
os.system('.\evaluation\culane\evaluate ') I think we could use this modification: import platform
eval_cmd = './evaluation/culane/evaluate'
if platform.system() == 'Windows':
eval_cmd = eval_cmd.replace('/', os.sep)
os.system('%s -a %s -d %s -i %s -l %s -w %s -t %s -c %s -r %s -f %s -o %s'%(eval_cmd, data_dir,detect_dir,data_dir,list4,w_lane,iou,im_w,im_h,frame,out4))
... |
Yeah, it works well using |
@zchrissirhcz @ustclbh I don't have a windows machine with GPU, so I just tested the permission denied problem. |
@cfzd |
@ustclbh |
Hi there, I am currently willing to compile the C++ evaluation tools for culane following the instructions in INSTALL.md. There is a subtle difference of vs version between mine(vs2019 community) and the one used in the given command, "cmake .. -G "Visual Studio 15 2017 Win64" " which is vs2017.
I have tried some possible commands according to my setup like,
cmake .. -G "Visual Studio 16 2019 Win64" ,
cmake .. -G "Visual Studio 15 2017 Win64" ,
cmake .. -G "Visual Studio 16 2019" -A x64 which I found here ,
cmake .. -G "Visual Studio 16 2019 Win64" -A x64 ,
but neither works...
Here are the cmake error messages. Is there any chance I can fix this up without install a 2017vs by modifying the cmakelist or any other configuration? Thanks in advance!
I also try to directly open the folder with vs2019, but get a following error.
CMake Error at E:\workstation\lanedet\UltraFast\evaluation\culane\CMakeLists.txt:18 (string):
string sub-command REPLACE requires at least four arguments. culane_evaluator E:\workstation\lanedet\UltraFast\evaluation\culane\CMakeLists.txt 18
The text was updated successfully, but these errors were encountered: