update
This commit is contained in:
parent
cef0644af5
commit
ccd0c1b26c
66
YOLOPv2.cpp
66
YOLOPv2.cpp
@ -134,6 +134,10 @@ inline float sigmoid(float x)
|
|||||||
Mat YOLOPv2::detect(Mat& frame)
|
Mat YOLOPv2::detect(Mat& frame)
|
||||||
{
|
{
|
||||||
Mat dstimg;
|
Mat dstimg;
|
||||||
|
|
||||||
|
//this->inpWidth /= 10;
|
||||||
|
//this->inpHeight/=10;
|
||||||
|
|
||||||
resize(frame, dstimg, Size(this->inpWidth, this->inpHeight));
|
resize(frame, dstimg, Size(this->inpWidth, this->inpHeight));
|
||||||
this->normalize_(dstimg);
|
this->normalize_(dstimg);
|
||||||
array<int64_t, 4> input_shape_{ 1, 3, this->inpHeight, this->inpWidth };
|
array<int64_t, 4> input_shape_{ 1, 3, this->inpHeight, this->inpWidth };
|
||||||
@ -224,8 +228,10 @@ Mat YOLOPv2::detect(Mat& frame)
|
|||||||
const float* pdrive_area = ort_outputs[0].GetTensorMutableData<float>();
|
const float* pdrive_area = ort_outputs[0].GetTensorMutableData<float>();
|
||||||
const float* plane_line = ort_outputs[1].GetTensorMutableData<float>();
|
const float* plane_line = ort_outputs[1].GetTensorMutableData<float>();
|
||||||
area = this->inpHeight*this->inpWidth;
|
area = this->inpHeight*this->inpWidth;
|
||||||
int min_y = -1;
|
//int min_y = -1;
|
||||||
vector<Point2f> points_L, points_R;
|
//vector<Point2f> points_L, points_R;
|
||||||
|
map<double, double> deviation; //偏移采样点距离 -> 道路中心线相对于小车位置横向偏移距离(右偏为正)(单位mm)
|
||||||
|
double dev_angle; //道路中心线相对小车正前方向偏移角弧度值(右偏为正)(中心线右偏即小车相对中心线左偏)
|
||||||
for (i = 0; i < frame.rows; i++)
|
for (i = 0; i < frame.rows; i++)
|
||||||
{
|
{
|
||||||
bool flg = false;
|
bool flg = false;
|
||||||
@ -256,7 +262,7 @@ Mat YOLOPv2::detect(Mat& frame)
|
|||||||
flg = false;
|
flg = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (min_y == -1 && (left != -1 || right != -1)) {
|
/*if (min_y == -1 && (left != -1 || right != -1)) {
|
||||||
min_y = i;
|
min_y = i;
|
||||||
}
|
}
|
||||||
if (left != -1){
|
if (left != -1){
|
||||||
@ -264,7 +270,7 @@ Mat YOLOPv2::detect(Mat& frame)
|
|||||||
}
|
}
|
||||||
if (right != -1){
|
if (right != -1){
|
||||||
points_R.push_back(Point2f(right, i));
|
points_R.push_back(Point2f(right, i));
|
||||||
}
|
}*/
|
||||||
//若左右参考车道线均存在,计算并标记中心点
|
//若左右参考车道线均存在,计算并标记中心点
|
||||||
if (left > -1 && right > -1) {
|
if (left > -1 && right > -1) {
|
||||||
int mid = (left + right) / 2;
|
int mid = (left + right) / 2;
|
||||||
@ -273,19 +279,35 @@ Mat YOLOPv2::detect(Mat& frame)
|
|||||||
outimg.at<Vec3b>(i, mid+k)[1] = 0;
|
outimg.at<Vec3b>(i, mid+k)[1] = 0;
|
||||||
outimg.at<Vec3b>(i, mid+k)[2] = 255;
|
outimg.at<Vec3b>(i, mid+k)[2] = 255;
|
||||||
}
|
}
|
||||||
|
//提取偏移量
|
||||||
|
for (int k = 0; k < N; k++) {
|
||||||
|
if (ypos[k] == i) {
|
||||||
|
deviation[dis[k]] = (mid - center) * rate[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//(需要考虑的问题 1.双车道3条线 2.拐角处曲线 3.近处显示不全 4.两条线粘连)
|
//(需要考虑的问题 1.双车道3条线 2.拐角处曲线 3.近处显示不全 4.两条线粘连)
|
||||||
}
|
}
|
||||||
//备选方案,对左右车道线分别拟合直线并计算中心线解析式 泛化 鲁棒 (目前有bug
|
//备选方案,对左右车道线分别拟合直线并计算中心线解析式 泛化 鲁棒 (目前有bug
|
||||||
if (points_L.size() && points_R.size()) {
|
/*if (points_L.size() > 1 && points_R.size() > 1) {
|
||||||
Vec4f line_L, line_R;
|
Vec4f line_L, line_R;
|
||||||
float kL, bL, kR, bR, kM, bM; // x=ky+b
|
Mat pointsMat_L(points_L.size(), 2, CV_32F), pointsMat_R(points_R.size(), 2, CV_32F),
|
||||||
fitLine(points_L, line_L, DIST_WELSCH, 0, 0.01, 0.01);
|
lineRansac_L, lineRansac_R;
|
||||||
fitLine(points_R, line_R, DIST_WELSCH, 0, 0.01, 0.01);
|
for (int i = 0; i < points_L.size(); i++){
|
||||||
kL = line_L[0] / line_L[1];
|
pointsMat_L.at<float>(i, 0) = points_L[i].x;
|
||||||
bL = line_L[2] - kL * line_L[3];
|
pointsMat_L.at<float>(i, 1) = points_L[i].y;
|
||||||
kR = line_R[0] / line_R[1];
|
}
|
||||||
bR = line_R[2] - kR * line_R[3];
|
for (int i = 0; i < points_R.size(); i++){
|
||||||
|
pointsMat_R.at<float>(i, 0) = points_R[i].x;
|
||||||
|
pointsMat_R.at<float>(i, 1) = points_R[i].y;
|
||||||
|
}
|
||||||
|
fitLine(pointsMat_L, lineRansac_L, DIST_L2, 0, 0.01, 0.01);
|
||||||
|
fitLine(pointsMat_R, lineRansac_R, DIST_L2, 0, 0.01, 0.01);
|
||||||
|
double kL, bL, kR, bR, kM, bM; // x=ky+b
|
||||||
|
kL = lineRansac_L.at<float>(0) / (lineRansac_L.at<float>(1) + 1e-12);
|
||||||
|
bL = lineRansac_L.at<float>(2) - kL * lineRansac_L.at<float>(3);
|
||||||
|
kR = lineRansac_R.at<float>(0) / (lineRansac_R.at<float>(1) + 1e-12);
|
||||||
|
bR = lineRansac_R.at<float>(2) - kR * lineRansac_R.at<float>(3);
|
||||||
kM = (kL + kR) / 2;
|
kM = (kL + kR) / 2;
|
||||||
bM = (bL + bR) / 2;
|
bM = (bL + bR) / 2;
|
||||||
for (int i = min_y; i < frame.rows; i++) {
|
for (int i = min_y; i < frame.rows; i++) {
|
||||||
@ -294,8 +316,26 @@ Mat YOLOPv2::detect(Mat& frame)
|
|||||||
outimg.at<Vec3b>(i, mid+k)[0] = 255;
|
outimg.at<Vec3b>(i, mid+k)[0] = 255;
|
||||||
outimg.at<Vec3b>(i, mid+k)[1] = 0;
|
outimg.at<Vec3b>(i, mid+k)[1] = 0;
|
||||||
outimg.at<Vec3b>(i, mid+k)[2] = 255;
|
outimg.at<Vec3b>(i, mid+k)[2] = 255;
|
||||||
}
|
}前方xx 距离处
|
||||||
}
|
}
|
||||||
|
for (int k = 0; k < N; k++) {
|
||||||
|
deviation[dis[k]] = (kM * ypos[k] + bM - center) * rate[k];
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
//计算偏移角
|
||||||
|
if (deviation.size() > 1) {
|
||||||
|
int siz = deviation.size();
|
||||||
|
double sumX = 0, sumY = 0, sumXY = 0, sumXX = 0;
|
||||||
|
for (auto d: deviation) {
|
||||||
|
sumX += d.first;
|
||||||
|
sumY += d.second;
|
||||||
|
sumXY += d.first * d.second;
|
||||||
|
sumXX += d.first * d.second;
|
||||||
|
cerr << d.first << ": " << d.second <<endl; //前方xx 距离处:道路中心线相对于小车位置横向偏移距离(右偏为正)(单位mm)
|
||||||
|
}
|
||||||
|
double slope = (siz * sumXY - sumX * sumY) / (siz * sumXX - sumX * sumX); //道路中心线相对小车正前方向偏移角度正切值(右偏为正)
|
||||||
|
dev_angle = atan(slope); //道路中心线相对小车正前方向偏移角弧度值(右偏为正)
|
||||||
|
cerr << slope <<endl << dev_angle <<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return outimg;
|
return outimg;
|
||||||
|
@ -49,6 +49,12 @@ private:
|
|||||||
void nms(vector<BoxInfo>& input_boxes);
|
void nms(vector<BoxInfo>& input_boxes);
|
||||||
const float anchors[3][6] = { {12, 16, 19, 36, 40, 28}, {36, 75, 76, 55, 72, 146},{142, 110, 192, 243, 459, 401} };
|
const float anchors[3][6] = { {12, 16, 19, 36, 40, 28}, {36, 75, 76, 55, 72, 146},{142, 110, 192, 243, 459, 401} };
|
||||||
const float stride[3] = { 8.0, 16.0, 32.0 };
|
const float stride[3] = { 8.0, 16.0, 32.0 };
|
||||||
|
const static int N = 6; //采样点数量
|
||||||
|
const float dis[N] = {1000, 2000, 3000, 4000, 5000, 6000}; //偏移量采样点实际距离(mm)
|
||||||
|
const int ypos[N] = {928, 839, 778, 735, 707, 686}; //偏移量采样点y轴坐标
|
||||||
|
const int center = 1048; //车体中心x轴坐标
|
||||||
|
const float rate[N] = {6.37, 8.26, 10.53, 12.98, 15.87, 19.23}; //图像像素到实际偏移(mm)转换率
|
||||||
|
|
||||||
|
|
||||||
Env env = Env(ORT_LOGGING_LEVEL_ERROR, "YOLOPv2");
|
Env env = Env(ORT_LOGGING_LEVEL_ERROR, "YOLOPv2");
|
||||||
Ort::Session *ort_session = nullptr;
|
Ort::Session *ort_session = nullptr;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Generated by qmake (3.1) (Qt 5.15.3)
|
# Generated by qmake (3.1) (Qt 5.15.3)
|
||||||
# Project: ../fast-yolopv2.pro
|
# Project: ../fast-yolopv2.pro
|
||||||
# Template: app
|
# Template: app
|
||||||
# Command: /usr/lib/qt5/bin/qmake -o Makefile ../fast-yolopv2.pro -spec linux-g++
|
# Command: /usr/lib/qt5/bin/qmake -o Makefile ../fast-yolopv2.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
MAKEFILE = Makefile
|
MAKEFILE = Makefile
|
||||||
@ -14,9 +14,9 @@ EQ = =
|
|||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
DEFINES = -DOPENCV -DGPU -DCUDNN -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
|
DEFINES = -DOPENCV -DGPU -DCUDNN -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
|
||||||
CFLAGS = -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
CFLAGS = -pipe -g -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
||||||
CXXFLAGS = -pipe -O2 -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
CXXFLAGS = -pipe -g -std=gnu++11 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES)
|
||||||
INCPATH = -I../../Fast-YolopV2 -I. -I/usr/local/Opencv-4.10.0/include/opencv4 -I/usr/local/cuda-12.6/include -I/usr/local/include/onnxruntime -I/usr/include/aarch64-linux-gnu/qt5 -I/usr/include/aarch64-linux-gnu/qt5/QtWidgets -I/usr/include/aarch64-linux-gnu/qt5/QtGui -I/usr/include/aarch64-linux-gnu/qt5/QtCore -I. -I. -I/usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++
|
INCPATH = -I../../Fast-YolopV2 -I. -I/usr/local/Opencv-4.10.0/include/opencv4 -I/usr/local/cuda-12.6/include -I/usr/local/include/onnxruntime -I/usr/include/aarch64-linux-gnu/qt5 -I/usr/include/aarch64-linux-gnu/qt5/QtWidgets -I/usr/include/aarch64-linux-gnu/qt5/QtGui -I/usr/include/aarch64-linux-gnu/qt5/QtCore -I. -I. -I/usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++
|
||||||
QMAKE = /usr/lib/qt5/bin/qmake
|
QMAKE = /usr/lib/qt5/bin/qmake
|
||||||
DEL_FILE = rm -f
|
DEL_FILE = rm -f
|
||||||
@ -39,7 +39,7 @@ COMPRESS = gzip -9f
|
|||||||
DISTNAME = fast-yolopv21.0.0
|
DISTNAME = fast-yolopv21.0.0
|
||||||
DISTDIR = /home/wuxianfu/Projects/Fast-YolopV2/build/.tmp/fast-yolopv21.0.0
|
DISTDIR = /home/wuxianfu/Projects/Fast-YolopV2/build/.tmp/fast-yolopv21.0.0
|
||||||
LINK = g++
|
LINK = g++
|
||||||
LFLAGS = -Wl,-O1
|
LFLAGS =
|
||||||
LIBS = $(SUBLIBS) -L/usr/local/Opencv-4.10.0/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_videoio -L/usr/local/lib -lonnxruntime /usr/lib/aarch64-linux-gnu/libQt5Widgets.so /usr/lib/aarch64-linux-gnu/libQt5Gui.so /usr/lib/aarch64-linux-gnu/libQt5Core.so -lGL -lpthread
|
LIBS = $(SUBLIBS) -L/usr/local/Opencv-4.10.0/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_videoio -L/usr/local/lib -lonnxruntime /usr/lib/aarch64-linux-gnu/libQt5Widgets.so /usr/lib/aarch64-linux-gnu/libQt5Gui.so /usr/lib/aarch64-linux-gnu/libQt5Core.so -lGL -lpthread
|
||||||
AR = ar cqs
|
AR = ar cqs
|
||||||
RANLIB =
|
RANLIB =
|
||||||
@ -122,6 +122,7 @@ DIST = /usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
|
|||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
||||||
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qml_debug.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
||||||
@ -214,6 +215,7 @@ Makefile: ../fast-yolopv2.pro /usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++/q
|
|||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf \
|
||||||
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qml_debug.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf \
|
||||||
@ -229,7 +231,7 @@ Makefile: ../fast-yolopv2.pro /usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++/q
|
|||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/yacc.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/yacc.prf \
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/lex.prf \
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/lex.prf \
|
||||||
../fast-yolopv2.pro
|
../fast-yolopv2.pro
|
||||||
$(QMAKE) -o Makefile ../fast-yolopv2.pro -spec linux-g++
|
$(QMAKE) -o Makefile ../fast-yolopv2.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/spec_pre.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/spec_pre.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/common/unix.conf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/common/unix.conf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/common/linux.conf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/common/linux.conf:
|
||||||
@ -293,6 +295,7 @@ Makefile: ../fast-yolopv2.pro /usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++/q
|
|||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resolve_config.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/default_post.prf:
|
||||||
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qml_debug.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/warn_on.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/qt.prf:
|
||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/resources_functions.prf:
|
||||||
@ -309,7 +312,7 @@ Makefile: ../fast-yolopv2.pro /usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++/q
|
|||||||
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/lex.prf:
|
/usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/lex.prf:
|
||||||
../fast-yolopv2.pro:
|
../fast-yolopv2.pro:
|
||||||
qmake: FORCE
|
qmake: FORCE
|
||||||
@$(QMAKE) -o Makefile ../fast-yolopv2.pro -spec linux-g++
|
@$(QMAKE) -o Makefile ../fast-yolopv2.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
|
||||||
|
|
||||||
qmake_all: FORCE
|
qmake_all: FORCE
|
||||||
|
|
||||||
@ -355,7 +358,7 @@ compiler_moc_predefs_make_all: moc_predefs.h
|
|||||||
compiler_moc_predefs_clean:
|
compiler_moc_predefs_clean:
|
||||||
-$(DEL_FILE) moc_predefs.h
|
-$(DEL_FILE) moc_predefs.h
|
||||||
moc_predefs.h: /usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
moc_predefs.h: /usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||||
g++ -pipe -O2 -std=gnu++11 -Wall -Wextra -dM -E -o moc_predefs.h /usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
g++ -pipe -g -std=gnu++11 -Wall -Wextra -dM -E -o moc_predefs.h /usr/lib/aarch64-linux-gnu/qt5/mkspecs/features/data/dummy.cpp
|
||||||
|
|
||||||
compiler_moc_header_make_all: moc_mainwindow.cpp
|
compiler_moc_header_make_all: moc_mainwindow.cpp
|
||||||
compiler_moc_header_clean:
|
compiler_moc_header_clean:
|
||||||
@ -477,7 +480,6 @@ moc_mainwindow.o: moc_mainwindow.cpp
|
|||||||
install_target: first FORCE
|
install_target: first FORCE
|
||||||
@test -d $(INSTALL_ROOT)/opt/fast-yolopv2/bin || mkdir -p $(INSTALL_ROOT)/opt/fast-yolopv2/bin
|
@test -d $(INSTALL_ROOT)/opt/fast-yolopv2/bin || mkdir -p $(INSTALL_ROOT)/opt/fast-yolopv2/bin
|
||||||
$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/fast-yolopv2/bin/$(QMAKE_TARGET)
|
$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/fast-yolopv2/bin/$(QMAKE_TARGET)
|
||||||
-$(STRIP) $(INSTALL_ROOT)/opt/fast-yolopv2/bin/$(QMAKE_TARGET)
|
|
||||||
|
|
||||||
uninstall_target: FORCE
|
uninstall_target: FORCE
|
||||||
-$(DEL_FILE) $(INSTALL_ROOT)/opt/fast-yolopv2/bin/$(QMAKE_TARGET)
|
-$(DEL_FILE) $(INSTALL_ROOT)/opt/fast-yolopv2/bin/$(QMAKE_TARGET)
|
||||||
|
BIN
build/YOLOPv2.o
BIN
build/YOLOPv2.o
Binary file not shown.
Binary file not shown.
BIN
build/main.o
BIN
build/main.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -59,7 +59,6 @@
|
|||||||
#define _STDC_PREDEF_H 1
|
#define _STDC_PREDEF_H 1
|
||||||
#define __cpp_nsdmi 200809L
|
#define __cpp_nsdmi 200809L
|
||||||
#define __linux 1
|
#define __linux 1
|
||||||
#define __OPTIMIZE__ 1
|
|
||||||
#define __CHAR_UNSIGNED__ 1
|
#define __CHAR_UNSIGNED__ 1
|
||||||
#define __UINT32_MAX__ 0xffffffffU
|
#define __UINT32_MAX__ 0xffffffffU
|
||||||
#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
|
#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
|
||||||
@ -77,7 +76,6 @@
|
|||||||
#define __WCHAR_MIN__ 0U
|
#define __WCHAR_MIN__ 0U
|
||||||
#define __INT64_C(c) c ## L
|
#define __INT64_C(c) c ## L
|
||||||
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
|
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
|
||||||
#define _FORTIFY_SOURCE 2
|
|
||||||
#define __SIZEOF_INT__ 4
|
#define __SIZEOF_INT__ 4
|
||||||
#define __INT_FAST64_WIDTH__ 64
|
#define __INT_FAST64_WIDTH__ 64
|
||||||
#define __PRAGMA_REDEFINE_EXTNAME 1
|
#define __PRAGMA_REDEFINE_EXTNAME 1
|
||||||
@ -194,6 +192,7 @@
|
|||||||
#define __INTMAX_WIDTH__ 64
|
#define __INTMAX_WIDTH__ 64
|
||||||
#define __LDBL_HAS_INFINITY__ 1
|
#define __LDBL_HAS_INFINITY__ 1
|
||||||
#define __FLT_DIG__ 6
|
#define __FLT_DIG__ 6
|
||||||
|
#define __NO_INLINE__ 1
|
||||||
#define __DEC_EVAL_METHOD__ 2
|
#define __DEC_EVAL_METHOD__ 2
|
||||||
#define __FLT_MANT_DIG__ 24
|
#define __FLT_MANT_DIG__ 24
|
||||||
#define __FLT16_MIN_10_EXP__ (-4)
|
#define __FLT16_MIN_10_EXP__ (-4)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 6.0.2, 2025-03-26T17:54:55. -->
|
<!-- Written by QtCreator 6.0.2, 2025-04-21T05:04:48. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@ -92,7 +92,7 @@
|
|||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">未命名</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">未命名</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">未命名</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">未命名</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17edb790-9733-4e4c-9173-37d0ab7cfd4d}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17edb790-9733-4e4c-9173-37d0ab7cfd4d}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
@ -103,7 +103,7 @@
|
|||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
|
@ -20,8 +20,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
OpenUSBCamera();
|
||||||
//ShowImage();
|
//ShowImage();
|
||||||
ShowVideo();
|
//ShowVideo();
|
||||||
//OpenCSICamera();
|
//OpenCSICamera();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,7 +60,7 @@ void MainWindow::ShowVideo()
|
|||||||
static const string kWinName = "Deep learning object detection in ONNXRuntime";
|
static const string kWinName = "Deep learning object detection in ONNXRuntime";
|
||||||
namedWindow(kWinName, WINDOW_NORMAL);
|
namedWindow(kWinName, WINDOW_NORMAL);
|
||||||
|
|
||||||
cv::VideoCapture cap("/home/wuxianfu/Projects/Fast-YolopV2/build/videos/test1.mp4");
|
cv::VideoCapture cap("/home/wuxianfu/Projects/Fast-YolopV2/build/videos/566a351c29c00924a337e91e85fa7dec.mp4");
|
||||||
if (!cap.isOpened()) {
|
if (!cap.isOpened()) {
|
||||||
std::cerr << "Error opening video stream" << std::endl;
|
std::cerr << "Error opening video stream" << std::endl;
|
||||||
return;
|
return;
|
||||||
@ -77,7 +78,6 @@ void MainWindow::ShowVideo()
|
|||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
std::chrono::duration<double> spent = end - start;
|
std::chrono::duration<double> spent = end - start;
|
||||||
qDebug()<< " Time: " << spent.count() << " sec \n";
|
qDebug()<< " Time: " << spent.count() << " sec \n";
|
||||||
|
|
||||||
imshow(kWinName, outimg);
|
imshow(kWinName, outimg);
|
||||||
if (cv::waitKey(5) >= 0) break; // 按任意键退出循环
|
if (cv::waitKey(5) >= 0) break; // 按任意键退出循环
|
||||||
}
|
}
|
||||||
@ -90,13 +90,14 @@ void MainWindow::OpenUSBCamera() {
|
|||||||
|
|
||||||
Net_config YOLOPv2_nets = { 0.5, 0.5, "/home/wuxianfu/Projects/Fast-YolopV2/build/onnx/yolopv2_192x320.onnx" }; ////choices = onnx文件夹里的文件
|
Net_config YOLOPv2_nets = { 0.5, 0.5, "/home/wuxianfu/Projects/Fast-YolopV2/build/onnx/yolopv2_192x320.onnx" }; ////choices = onnx文件夹里的文件
|
||||||
YOLOPv2 net(YOLOPv2_nets);
|
YOLOPv2 net(YOLOPv2_nets);
|
||||||
cv::VideoCapture cap(1); // 使用默认的摄像头索引(通常是0)
|
cv::VideoCapture cap(0); // 使用默认的摄像头索引(通常是0)
|
||||||
if (!cap.isOpened()) {
|
if (!cap.isOpened()) {
|
||||||
std::cerr << "Error opening video stream" << std::endl;
|
std::cerr << "Error opening video stream" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::Mat frame;
|
cv::Mat frame;
|
||||||
|
int cnt=0;
|
||||||
while (true) {
|
while (true) {
|
||||||
cap >> frame; // 读取一帧
|
cap >> frame; // 读取一帧
|
||||||
if (frame.empty()) {
|
if (frame.empty()) {
|
||||||
@ -104,9 +105,14 @@ void MainWindow::OpenUSBCamera() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::resize(frame, frame, Size(frame.cols/2,frame.rows/2));
|
||||||
|
|
||||||
|
//cv::imshow("USB Camera", frame);
|
||||||
|
//cv::imwrite("USB Camera/"+to_string(++cnt)+".jpg", frame);
|
||||||
Mat outimg = net.detect(frame);
|
Mat outimg = net.detect(frame);
|
||||||
|
|
||||||
cv::imshow("USB Camera", outimg); // 显示帧
|
cv::imshow("USB Camera", outimg); // 显示帧
|
||||||
|
cv::imwrite("USB Camera/"+to_string(++cnt)+".jpg", outimg);
|
||||||
if (cv::waitKey(10) >= 0) break; // 按任意键退出循环
|
if (cv::waitKey(10) >= 0) break; // 按任意键退出循环
|
||||||
}
|
}
|
||||||
cap.release(); // 释放资源
|
cap.release(); // 释放资源
|
||||||
|
Loading…
Reference in New Issue
Block a user