Skip to content

Commit 374af6f

Browse files
committed
update CMakeLists
1 parent bd399ae commit 374af6f

17 files changed

Lines changed: 112 additions & 39 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ bin
3636
weights
3737
yaml-cpp
3838
build
39-
demo
39+
demo
40+
results

configs/yolov6.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
yolov7:
2-
onnx_file: "../weights/yolov6/yolov6.onnx"
3-
engine_file: "../weights/yolov6/yolov6.trt"
1+
yolov6:
2+
onnx_file: "../weights/yolov6/yolov6s.onnx"
3+
engine_file: "../weights/yolov6/yolov6s.trt"
44
type: "coco"
55
mode: "fp32"
66
batchSize: 1

include/build.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
#include "yolov5.h"
6-
// #include "yolov6.h"
6+
#include "yolov6.h"
77
#include "yolov7.h"
88
#include "yolov8.h"
99
#include "rtdetr.h"

object_detection/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ list(APPEND ALL_INCLUDE ${PROJECT_INCLUDE})
6262
include_directories(${ALL_INCLUDE})
6363

6464
add_subdirectory(yolov5)
65-
# add_subdirectory(yolov6)
65+
add_subdirectory(yolov6)
6666
add_subdirectory(yolov7)
6767
add_subdirectory(yolov8)
6868
add_subdirectory(rtdetr)
@@ -71,5 +71,5 @@ add_library(build SHARED ../src/build.cpp)
7171

7272
set(EXECUTABLE_OUTPUT_PATH ../../bin)
7373
add_executable(object_detection main.cpp)
74-
target_link_libraries(object_detection yaml-cpp build yolov5 yolov7 yolov8 rtdetr cudart)
74+
target_link_libraries(object_detection yaml-cpp build yolov5 yolov6 yolov7 yolov8 rtdetr cudart)
7575

object_detection/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ int main(int argc, char **argv)
99
std::string cfg_dir = "../configs";
1010
std::string cfg_suffix = ".yaml";
1111
std::string savedir = "../results";
12-
auto savepath = savedir + "/" + model_arch;
12+
auto savepath = savedir + "/" + model_arch + "/";
1313
auto cfg = cfg_dir + "/" + model_arch + cfg_suffix;
1414
auto model = build_model(model_arch, cfg);
1515
check_dir(savepath, false);

object_detection/rtdetr/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
set(CMAKE_BUILD_TYPE "Debug")
4-
#set(CMAKE_BUILD_TYPE "Release")
3+
set(CMAKE_BUILD_TYPE "Release")
54

65
project(rtdetr)
76

object_detection/rtdetr/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
int main(int argc, char** argv)
44
{
5-
std::string config = argv[1];
6-
std::string inputpath = argv[2];
7-
std::string savepath = argv[3];
8-
YAML::Node root = YAML::LoadFile(config);
5+
std::string inputpath = argv[1];
6+
std::string cfg_dir = "../configs";
7+
std::string cfg_suffix = ".yaml";
8+
std::string savedir = "../results";
9+
auto savepath = savedir + "/" + "rtdetr" + "/";
10+
auto cfg = cfg_dir + "/" + "rtdetr" + cfg_suffix;
11+
YAML::Node root = YAML::LoadFile(cfg);
912
RTDETR RTDETR(root["rtdetr"]);
1013
RTDETR.LoadEngine();
1114
RTDETR.Inference(inputpath, savepath);

object_detection/yolov5/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
set(CMAKE_BUILD_TYPE "Debug")
4-
#set(CMAKE_BUILD_TYPE "Release")
3+
set(CMAKE_BUILD_TYPE "Release")
54

65
project(yolov5)
76

object_detection/yolov5/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
int main(int argc, char** argv)
55
{
6-
std::string config = argv[1];
7-
std::string inputpath = argv[2];
8-
std::string savepath = argv[3];
9-
YAML::Node root = YAML::LoadFile(config);
6+
std::string inputpath = argv[1];
7+
std::string cfg_dir = "../configs";
8+
std::string cfg_suffix = ".yaml";
9+
std::string savedir = "../results";
10+
auto savepath = savedir + "/" + "yolov5" + "/";
11+
auto cfg = cfg_dir + "/" + "yolov5" + cfg_suffix;
12+
YAML::Node root = YAML::LoadFile(cfg);
1013
YOLOv5 YOLOv5(root["yolov5"]);
1114
YOLOv5.LoadEngine();
1215
YOLOv5.Inference(inputpath, savepath);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
set(CMAKE_BUILD_TYPE "Debug")
4+
# set(CMAKE_BUILD_TYPE "Release")
5+
6+
project(yolov6)
7+
8+
set(CMAKE_CXX_STANDARD 14)
9+
10+
# YAML
11+
set(YAML_LIBRARY ../../yaml-cpp/build)
12+
set(YAML_INCLUDE ../../yaml-cpp/include)
13+
link_directories(${YAML_LIBRARY})
14+
list(APPEND ALL_INCLUDE ${YAML_INCLUDE})
15+
16+
17+
# Project
18+
set(PROJECT_INCLUDE ../../include)
19+
message(STATUS "Find project include at ${PROJECT_INCLUDE}")
20+
list(APPEND ALL_INCLUDE ${PROJECT_INCLUDE})
21+
set(PROJECT_LIBRARY ../../src/common.cpp
22+
../../src/basemodel.cpp
23+
../../src/detection.cpp
24+
../../src/yolo.cpp
25+
../../src/yolov6.cpp
26+
../../src/cuda_function.cu)
27+
28+
include_directories(${ALL_INCLUDE})
29+
30+
set(LIBRARY_OUTPUT_PATH ../../libs)
31+
add_library(yolov6 SHARED ${PROJECT_LIBRARY} ${SAMPLES_LIBRARY})
32+
target_link_libraries(yolov6 ${ALL_LIBS} yaml-cpp)

0 commit comments

Comments
 (0)