Skip to content

Commit 306317a

Browse files
committed
1
0 parents  commit 306317a

File tree

499 files changed

+9068
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

499 files changed

+9068
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.dll filter=lfs diff=lfs merge=lfs -text
2+
build/Release/*.dll filter=lfs diff=lfs merge=lfs -text

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
build/*.vcxproj
2+
**/*.user
3+
**/*.pdb
4+
**/*.ilk
5+
**/*.exp
6+
**/cmake_install
7+
**/CMakeCache
8+
/build/CMakeFiles
9+
/build/LPReditor_ANPR_Lib.dir
10+
**/*.so
11+
**/*.sln
12+
**/*.filters
13+
#data/images/benchmarks-master/endtoend/plate_us/
14+
data/images/benchmarks-master/**/**/*.txt
15+
sample_cpp/build
16+
/python
17+
.git
18+
**/x64
19+
**/*.dir
20+
**/.vs
21+
**/CMakeFiles
22+
sample_cpp/build
23+
**/opencv*
24+
**/cuda*
25+
**/cudnn*
26+
/build/**/opencv*.dll
27+
**/onnxruntime.dll
28+
/build/Debug
29+
/build/
30+
31+

CMakeLists.txt

+212
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
2+
cmake_minimum_required(VERSION 3.5.1)
3+
4+
PROJECT(LPReditor_ANPR_Lib)
5+
6+
if(MSVC)
7+
add_compile_options("/bigobj")
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
9+
endif(MSVC)
10+
11+
set(CMAKE_CXX_STANDARD 17)
12+
#************************
13+
#OPENCV
14+
#************************
15+
if (MSVC)
16+
#if necessary change the path ../opencv-master/build/ to the path where you build opencv
17+
find_path(OPENCV4_ROOT OpenCV.sln ../opencv-master/build/)
18+
set(OpenCV_DIR OPENCV4_ROOT)
19+
if(NOT OpenCV_FOUND)
20+
find_path(OpenCV_DIR OpenCV.sln ../opencv-master/build/)
21+
endif(OpenCV_FOUND)
22+
else (MSVC)
23+
endif (MSVC)
24+
#if necessary change the path ../opencv-master/build/ to the path where you build opencv
25+
FIND_PACKAGE( OpenCV REQUIRED PATHS "../opencv-master/build/")
26+
set(OpenCV_DIR ../opencv-master/build)
27+
message(STATUS "OpenCV library status:")
28+
message(STATUS " config: ${OpenCV_DIR}")
29+
message(STATUS " version: ${OpenCV_VERSION}")
30+
message(STATUS " libraries: ${OpenCV_LIBS}")
31+
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
32+
#************************
33+
#EXECUTABLE
34+
#************************
35+
find_path(LPReditor_ANPR_Lib_ROOT Open_LPReditor_Lib.cpp ../LPReditor_ANPR_Lib/ )
36+
find_path(LPReditor_ANPR_Lib_INC utils_anpr_detect.h ${LPReditor_ANPR_Lib_ROOT}/include/ )
37+
find_path(LPReditor_ANPR_Lib_SOURCE utils_anpr_detect.cpp ${LPReditor_ANPR_Lib_ROOT}/src/ )
38+
FILE(GLOB LPReditor_ANPR_LibSources ${LPReditor_ANPR_Lib_ROOT}/*.cpp ${LPReditor_ANPR_Lib_ROOT}/*.h ${LPReditor_ANPR_Lib_SOURCE}/*.cpp ${LPReditor_ANPR_Lib_INC}/*.h )
39+
# Create a target for the library
40+
ADD_LIBRARY( ${CMAKE_PROJECT_NAME} SHARED ${LPReditor_ANPR_LibSources} )
41+
#************************
42+
#INC DIRS
43+
#************************
44+
include_directories(${LPReditor_ANPR_Lib_INC})
45+
#************************
46+
#PREPROCESSOR
47+
#************************
48+
add_definitions(
49+
-DLPREDITOR_EXPORTS
50+
-DLPREDITOR_DEMO_NO_ARGS
51+
-DLPREDITOR_DEMO_PRINT_STATS_IN_TXT_FILE
52+
-DLPR_EDITOR_USE_CUDA
53+
)
54+
55+
SET_TARGET_PROPERTIES (${CMAKE_PROJECT_NAME} PROPERTIES DEFINE_SYMBOL "COMPILING_DLL" )
56+
#************************
57+
#LINKING
58+
#************************
59+
if(MSVC)
60+
foreach(flag_var
61+
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
62+
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
63+
if(${flag_var} MATCHES "/MT")
64+
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
65+
endif(${flag_var} MATCHES "/MT")
66+
endforeach(flag_var)
67+
endif(MSVC)
68+
target_link_libraries(${CMAKE_PROJECT_NAME} ${OpenCV_LIBS})
69+
70+
set(USE_GPU true CACHE BOOL "whether to use gpu" FORCE)
71+
#************************
72+
##onnxruntime
73+
#************************
74+
if (MSVC)
75+
if(USE_GPU)
76+
#if necessary, in the lines below, change ../onnxruntime-win-x64-1.4.0/ to point to the actual path of the onnxruntime-win-x64-1.4.0 directory
77+
78+
find_library(onnxruntime-win-x64-gpu-1.6.0_RELEASE
79+
NAMES onnxruntime
80+
PATHS
81+
../onnxruntime-win-x64-gpu-1.6.0/lib
82+
)
83+
SET(onnxruntime-win-x64-gpu-1.6.0_LIBRARY
84+
debug ${onnxruntime-win-x64-gpu-1.6.0_RELEASE}
85+
optimized ${onnxruntime-win-x64-gpu-1.6.0_RELEASE})
86+
find_path(onnxruntime-win-x64-gpu-1.6.0_LIB_PATH onnxruntime.lib ../onnxruntime-win-x64-gpu-1.6.0/lib)
87+
find_path(onnxruntime-win-x64-gpu-1.6.0_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-win-x64-gpu-1.6.0/include)
88+
MESSAGE( STATUS )
89+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
90+
MESSAGE( STATUS "onnxruntime-win-x64-gpu-1.6.0_INCLUDE =${onnxruntime-win-x64-gpu-1.6.0_INCLUDE}" )
91+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
92+
MESSAGE( STATUS )
93+
include_directories(${onnxruntime-win-x64-gpu-1.6.0_INCLUDE})
94+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-win-x64-gpu-1.6.0_LIBRARY})
95+
96+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-win-x64-gpu-1.6.0_LIB_PATH}/*.dll")
97+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-win-x64-gpu-1.6.0_LIB_PATH}/*.lib")
98+
else (USE_GPU)
99+
#if necessary, in the lines below, change ../onnxruntime-win-x64-1.4.0/ to point to the actual path of the onnxruntime-win-x64-1.4.0 directory
100+
find_library(onnxruntime-win-x64-1.4.0_RELEASE
101+
NAMES onnxruntime
102+
PATHS
103+
../onnxruntime-win-x64-1.4.0/lib
104+
)
105+
SET(onnxruntime-win-x64-1.4.0_LIBRARY
106+
debug ${onnxruntime-win-x64-1.4.0_RELEASE}
107+
optimized ${onnxruntime-win-x64-1.4.0_RELEASE})
108+
find_path(onnxruntime-win-x64-1.4.0_LIB_PATH onnxruntime.lib ../onnxruntime-win-x64-1.4.0/lib)
109+
find_path(onnxruntime-win-x64-1.4.0_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-win-x64-1.4.0/include)
110+
MESSAGE( STATUS )
111+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
112+
MESSAGE( STATUS "onnxruntime-win-x64-1.4.0_LIBRARY =${onnxruntime-win-x64-1.4.0_LIBRARY}" )
113+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
114+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
115+
MESSAGE( STATUS "onnxruntime-win-x64-1.4.0_INCLUDE =${onnxruntime-win-x64-1.4.0_INCLUDE}" )
116+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
117+
MESSAGE( STATUS )
118+
include_directories(${onnxruntime-win-x64-1.4.0_INCLUDE})
119+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-win-x64-1.4.0_LIBRARY})
120+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-win-x64-1.4.0_LIB_PATH}/*.dll")
121+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-win-x64-1.4.0_LIB_PATH}/*.lib")
122+
endif(USE_GPU)
123+
else (MSVC)
124+
#if necessary, in the lines below, change ../onnxruntime-linux-x64-1.6.0/ to point to the actual path of the onnxruntime-linux-x64-1.6.0 directory
125+
find_library(onnxruntime-linux-x64-1.6.0_RELEASE
126+
NAMES libonnxruntime.so
127+
PATHS
128+
../onnxruntime-linux-x64-1.6.0/lib
129+
)
130+
SET(onnxruntime-linux-x64-1.6.0_LIBRARY
131+
debug ${onnxruntime-linux-x64-1.6.0_RELEASE}
132+
optimized ${onnxruntime-linux-x64-1.6.0_RELEASE})
133+
find_path(onnxruntime-linux-x64-1.6.0_LIB_PATH libonnxruntime.so ../onnxruntime-linux-x64-1.6.0/lib)
134+
find_path(onnxruntime-linux-x64-1.6.0_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-linux-x64-1.6.0/include)
135+
MESSAGE( STATUS )
136+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
137+
MESSAGE( STATUS "onnxruntime-linux-x64-1.6.0_LIBRARY =${onnxruntime-linux-x64-1.6.0_LIBRARY}" )
138+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
139+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
140+
MESSAGE( STATUS "onnxruntime-linux-x64-1.6.0_INCLUDE =${onnxruntime-linux-x64-1.6.0_INCLUDE}" )
141+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
142+
MESSAGE( STATUS )
143+
find_library(onnxruntime-linux-x64-gpu-1.6.0_RELEASE
144+
NAMES libonnxruntime.so
145+
PATHS
146+
../onnxruntime-linux-x64-gpu-1.6.0/lib
147+
)
148+
SET(onnxruntime-linux-x64-gpu-1.6.0_LIBRARY
149+
debug ${onnxruntime-linux-x64-gpu-1.6.0_RELEASE}
150+
optimized ${onnxruntime-linux-x64-gpu-1.6.0_RELEASE})
151+
find_path(onnxruntime-linux-x64-gpu-1.6.0_LIB_PATH libonnxruntime.so ../onnxruntime-linux-x64-gpu-1.6.0/lib)
152+
find_path(onnxruntime-linux-x64-gpu-1.6.0_INCLUDE onnxruntime_cxx_api.h ../onnxruntime-linux-x64-gpu-1.6.0/include)
153+
MESSAGE( STATUS )
154+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
155+
MESSAGE( STATUS "onnxruntime-linux-x64-gpu-1.6.0_LIBRARY =${onnxruntime-linux-x64-gpu-1.6.0_LIBRARY}" )
156+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
157+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
158+
MESSAGE( STATUS "onnxruntime-linux-x64-gpu-1.6.0_INCLUDE =${onnxruntime-linux-x64-gpu-1.6.0_INCLUDE}" )
159+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
160+
MESSAGE( STATUS )
161+
include_directories(${onnxruntime-linux-x64-1.6.0_INCLUDE})
162+
target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-linux-x64-1.6.0_LIBRARY})
163+
#include_directories(${onnxruntime-linux-x64-gpu-1.6.0_INCLUDE})
164+
#target_link_libraries(${CMAKE_PROJECT_NAME} ${onnxruntime-linux-x64-gpu-1.6.0_LIBRARY})
165+
file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-linux-x64-1.6.0_LIB_PATH}/*.so")
166+
file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-linux-x64-1.6.0_LIB_PATH}/*.so")
167+
#file(GLOB ONNXRUNTIME_DLLS "${onnxruntime-linux-x64-gpu-1.6.0_LIB_PATH}/*.so")
168+
#file(GLOB ONNXRUNTIME_LIBS "${onnxruntime-linux-x64-gpu-1.6.0_LIB_PATH}/*.so")
169+
endif (MSVC)
170+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
171+
MESSAGE( STATUS "ONNXRUNTIME_DLLS =${ONNXRUNTIME_DLLS}" )
172+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
173+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
174+
MESSAGE( STATUS "ONNXRUNTIME_LIBS =${ONNXRUNTIME_LIBS}" )
175+
MESSAGE( STATUS "-------------------------------------------------------------------------------" )
176+
MESSAGE( STATUS )
177+
178+
#************************
179+
#CUSTOM POST BUILD COMMAND
180+
#************************
181+
182+
if(MSVC)
183+
file(GLOB OPENCV_FOR_LPREDITOR_DLLS_DEBUG "${OpenCV_DIR}/bin/Debug/opencv_dnn*d.dll"
184+
"${OpenCV_DIR}/bin/Debug/opencv_highgui*d.dll"
185+
"${OpenCV_DIR}/bin/Debug/opencv_videoio*d.dll"
186+
"${OpenCV_DIR}/bin/Debug/opencv_imgcodecs*d.dll"
187+
"${OpenCV_DIR}/bin/Debug/opencv_imgproc*d.dll"
188+
"${OpenCV_DIR}/bin/Debug/opencv_core*d.dll"
189+
)
190+
file(GLOB OPENCV_FOR_LPREDITOR_DLLS_RELEASE "${OpenCV_DIR}/bin/Release/opencv_dnn*.dll"
191+
"${OpenCV_DIR}/bin/Release/opencv_highgui*.dll"
192+
"${OpenCV_DIR}/bin/Release/opencv_videoio*.dll"
193+
"${OpenCV_DIR}/bin/Release/opencv_imgcodecs*.dll"
194+
"${OpenCV_DIR}/bin/Release/opencv_imgproc*.dll"
195+
"${OpenCV_DIR}/bin/Release/opencv_core*.dll"
196+
)
197+
#SET(OPENCV_FOR_LPREDITOR_DLLS debug ${OPENCV_FOR_LPREDITOR_DLLS_DEBUG} optimized ${OPENCV_FOR_LPREDITOR_DLLS_RELEASE})
198+
199+
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}
200+
POST_BUILD
201+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
202+
${ONNXRUNTIME_DLLS} ${ONNXRUNTIME_LIBS}
203+
${OPENCV_FOR_LPREDITOR_DLLS_RELEASE} ${OPENCV_FOR_LPREDITOR_DLLS_DEBUG}
204+
$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
205+
else (MSVC)
206+
add_custom_command(TARGET ${CMAKE_PROJECT_NAME}
207+
POST_BUILD
208+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
209+
${ONNXRUNTIME_DLLS} ${ONNXRUNTIME_LIBS}
210+
$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
211+
endif(MSVC)
212+

0 commit comments

Comments
 (0)