-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62054a7
commit 2392ecb
Showing
260 changed files
with
84,031 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
from PySide2.QtWidgets import * | ||
from PySide2.QtUiTools import * | ||
from PySide2.QtCore import * | ||
from PySide2 import QtGui,QtCore,QtWidgets | ||
from PySide2.QtGui import * | ||
|
||
import cv2 | ||
import sys, os | ||
import PySide2 | ||
import firstSource | ||
import secondSource | ||
class MyPushButton(QPushButton): | ||
def __init__(self,control,style,text,x,y,w,h,parent=None): | ||
QPushButton.__init__(self,parent) | ||
# control表示的是这个控件的提示信息控件 | ||
self.control=control | ||
self.control.setVisible(False) | ||
self.setStyleSheet(style) | ||
self.setText(text) | ||
self.move(x,y) | ||
self.resize(w,h) | ||
self.raise_() | ||
|
||
def enterEvent(self, event): | ||
self.control.setVisible(True) | ||
|
||
def leaveEvent(self, event): | ||
self.control.setVisible(False) | ||
|
||
class MyLineEdit(QLineEdit): | ||
def __init__(self,control,style,text,x,y,w,h,parent=None): | ||
QLineEdit.__init__(self,parent) | ||
# control表示的是这个控件的提示信息控件 | ||
self.control=control | ||
self.control.setVisible(False) | ||
self.setStyleSheet(style) | ||
text = str(text) | ||
self.setText(text) | ||
self.move(x,y) | ||
self.resize(w,h) | ||
self.raise_() | ||
|
||
def enterEvent(self, event): | ||
self.control.setVisible(True) | ||
|
||
def leaveEvent(self, event): | ||
self.control.setVisible(False) | ||
|
||
|
||
class MyMenuVideoControl(QLabel): | ||
def mouseMoveEvent(self, ev): | ||
self.setVisible(True) | ||
|
||
def enterEvent(self, event): | ||
self.setVisible(True) | ||
def mousePressEvent(self, QMouseEvent): | ||
if QMouseEvent.buttons() == QtCore.Qt.LeftButton: | ||
if self.start == False: | ||
self.setPixmap(QtGui.QPixmap(self.start_image)) | ||
self.timer_camera.start(50) | ||
self.timer_camera.timeout.connect(self.OpenFrame1) | ||
self.start = True | ||
else: | ||
self.setPixmap(QtGui.QPixmap(self.pause_image)) | ||
self.start = False | ||
self.timer_camera.stop() | ||
|
||
def OpenFrame1(self): | ||
ret, frame = self.cap.read() | ||
if ret: | ||
self.Display_Image(frame) | ||
else: | ||
self.cap.release() | ||
self.timer_camera.stop() | ||
|
||
def Display_Image(self, image): | ||
if (len(image.shape) == 3): | ||
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) | ||
Q_img = QImage(image.data, | ||
image.shape[1], | ||
image.shape[0], | ||
QImage.Format_RGB888) | ||
elif (len(image.shape) == 1): | ||
Q_img = QImage(image.data, | ||
image.shape[1], | ||
image.shape[0], | ||
QImage.Format_Indexed8) | ||
else: | ||
Q_img = QImage(image.data, | ||
image.shape[1], | ||
image.shape[0], | ||
QImage.Format_RGB888) | ||
self.show_lable.setPixmap(QtGui.QPixmap(Q_img)) | ||
self.show_lable.setScaledContents(True) | ||
# 这是那个播放键和暂停键 | ||
def __init__(self,x,y,w,h,show_label,video,parent): | ||
QLabel.__init__(self,parent) | ||
self.pause_image="source/second/start.png" | ||
self.start_image="source/second/pause.png" | ||
self.start=False | ||
self.setPixmap(QtGui.QPixmap(self.pause_image)) | ||
self.setScaledContents(True) | ||
self.cap = [] | ||
self.timer_camera = QTimer() | ||
self.cap = cv2.VideoCapture(video) | ||
self.show_lable=show_label | ||
self.move(x,y) | ||
self.resize(w,h) | ||
|
||
class MyMenuVideoYellowLabel(QLabel): | ||
def __init__(self,x,y,w,h,control,parent): | ||
QLabel.__init__(self,parent) | ||
self.move(x,y) | ||
self.resize(w,h) | ||
s="QLabel{\nbackground: rgba(255, 155, 0, 51);\n}" | ||
self.setStyleSheet(s) | ||
self.setVisible(False) | ||
self.control=control | ||
|
||
# def linkHovered(self, *args, **kwargs): | ||
# self.control.setVisible(True) | ||
# | ||
def enterEvent(self, event): | ||
self.setVisible(True) | ||
self.control.setVisible(True) | ||
|
||
def mouseMoveEvent(self, ev): | ||
self.setVisible(True) | ||
self.control.setVisible(True) | ||
|
||
def leaveEvent(self, event): | ||
self.control.setVisible(False) | ||
self.setVisible(False) | ||
|
||
|
||
class MyMenuVideoLabel(QLabel): | ||
def __init__(self,picture,x,y,w,h,video,parent): | ||
# 这是一个播放展示视频的控件,control是那个控制它的元件 | ||
QLabel.__init__(self,parent) | ||
# control表示的是这个控件的提示信息控件 | ||
self.setPixmap(QtGui.QPixmap(picture)) | ||
self.setScaledContents(True) | ||
self.move(x,y) | ||
self.resize(w,h) | ||
self.raise_() | ||
self.setFixedSize(self.width(),self.height()) | ||
# self.control=MyMenuVideoControl(x+140,y+70,40,40,self,video,parent) | ||
# self.yellow_label=MyMenuVideoYellowLabel(x,y,w,h,self.control,parent) | ||
# self.control.raise_() | ||
|
||
|
||
def enterEvent(self, event): | ||
# self.yellow_label.setVisible(True) | ||
i = 1 | ||
|
||
class double_photo_show_label(QLabel): | ||
def __init__(self,parent,type,info,x,y,w,h): | ||
# 0是图片 | ||
QLabel.__init__(self,parent) | ||
self.resize(w, h) | ||
self.move(x, y) | ||
if type==0: | ||
self.setScaledContents(True) | ||
self.setPixmap(QtGui.QPixmap(info)) | ||
self.setText("") | ||
else: | ||
s="""width: 58px;\nheight: 36px;\nfont-size: 36px;\nfont-family: AlibabaPuHuiTi_2_85_Bold;\ncolor: #333333;\nline-height: 36px;\nfont-weight: bold;""" | ||
self.setStyleSheet(s) | ||
self.setText("ID"+str(info)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import cv2 | ||
|
||
if __name__ == '__main__': | ||
# f = open('output/' + 'test_demo_flow_statistic.txt', 'r') | ||
# with open('output/' + 'test_demo_flow_statistic.txt', 'r') as f1: | ||
# list = f1.readlines() | ||
# # 当前的人数计数 | ||
# current_count_list_y = [] | ||
# test = int(len(list)/50) + 1 | ||
# iter = 0 | ||
# print(test) | ||
# for i in range(test): | ||
# new_temp_list = list[iter - 1].strip('\n').split(' ') | ||
# print(iter) | ||
# print(new_temp_list) | ||
# current_count = new_temp_list[len(new_temp_list) - 1] | ||
# current_count_list_y.append(current_count) | ||
# iter = iter + 50 | ||
# print(current_count_list_y) | ||
from matplotlib import pyplot | ||
|
||
# f = open('output/' + 'test_demo_flow_statistic.txt', 'r') | ||
# with open('output/'+ 'test_demo_flow_statistic.txt', 'r') as f1: | ||
# list = f1.readlines() | ||
# import matplotlib.pyplot as plt | ||
# current_count_list_y = [] | ||
# current_count_list_x = [] | ||
# y_test = [] | ||
# test = int(len(list) / 50) + 1 | ||
# iter = 0 | ||
# for i in range(test): | ||
# new_temp_list = list[iter - 1].strip('\n').split(' ') | ||
# current_count = new_temp_list[len(new_temp_list) - 1] | ||
# print(new_temp_list) | ||
# temp_current_count = current_count.split(',') | ||
# print(temp_current_count[0]) | ||
# current_count = int(temp_current_count[0]) | ||
# current_count_list_y.append(current_count) | ||
# current_count_list_x.append(i) | ||
# iter = iter + 50 | ||
# for i in range(len(current_count_list_y)): | ||
# y_test.append(10) | ||
# print(current_count_list_y) | ||
# print(y_test) | ||
# plt.plot(current_count_list_x, current_count_list_y, mec='r', mfc='w', label='people') | ||
# plt.plot(current_count_list_x, y_test, ms=10, label='Boundary') | ||
# plt.legend() # 让图例生效 | ||
# plt.margins(0) | ||
# plt.subplots_adjust(bottom=0.10) | ||
# plt.savefig('people_image.png') | ||
# plt.show() | ||
# f.close() | ||
# cap = cv2.VideoCapture('test_demo.mp4') | ||
# ret, frame = cap.read() | ||
# print(len(frame)) | ||
# frames_num = cap.get(7) | ||
# fps = int(round(cap.get(cv2.CAP_PROP_FPS))) | ||
# print(frames_num) | ||
# for i in range(101): | ||
# progressPos = i / 100 | ||
# print(progressPos) | ||
# import datetime | ||
# | ||
# starttime = datetime.datetime.now() | ||
# | ||
# endtime = datetime.datetime.now() | ||
# | ||
# print((endtime - starttime).seconds) | ||
|
||
# encoding=utf-8 | ||
# from matplotlib import pyplot | ||
# import matplotlib.pyplot as plt | ||
# | ||
# names = range(8, 21) | ||
# names = [str(x) for x in list(names)] | ||
# | ||
# x = range(len(names)) | ||
# y_train = [0.140, 0.839, 0.834, 0.832, 0.824, 0.831, 0.823, 0.817, 0.814, 0.812, 0.812, 0.807, 0.805] | ||
# y_test = [] | ||
# for i in range(len(y_train)): | ||
# y_test.append(0.7) | ||
# print(y_test) | ||
# # plt.plot(x, y, 'ro-') | ||
# # plt.plot(x, y1, 'bo-') | ||
# # pl.xlim(-1, 11) # 限定横轴的范围 | ||
# # pl.ylim(-1, 110) # 限定纵轴的范围 | ||
# | ||
# plt.plot(x, y_train, marker='o', mec='r', mfc='w', label='people') | ||
# plt.plot(x, y_test, marker='*', ms=10, label='object') | ||
# plt.legend() # 让图例生效 | ||
# plt.xticks(x, names, rotation=1) | ||
# plt.margins(0) | ||
# plt.subplots_adjust(bottom=0.10) | ||
# plt.xlabel('the length') # X轴标签 | ||
# plt.ylabel("f1") # Y轴标签 | ||
# pyplot.yticks([0.750, 0.800, 0.850]) | ||
# # plt.title("A simple plot") #标题 | ||
# # plt.savefig('D:\\f1.jpg', dpi=900) | ||
# | ||
# plt.show() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# 推理Benchmark | ||
|
||
## 一、环境准备 | ||
- 1、测试环境: | ||
- CUDA 10.1 | ||
- CUDNN 7.6 | ||
- TensorRT-6.0.1 | ||
- PaddlePaddle v2.0.1 | ||
- GPU分别为: Tesla V100和GTX 1080Ti和Jetson AGX Xavier | ||
- 2、测试方式: | ||
- 为了方便比较不同模型的推理速度,输入采用同样大小的图片,为 3x640x640,采用 `demo/000000014439_640x640.jpg` 图片。 | ||
- Batch Size=1 | ||
- 去掉前100轮warmup时间,测试100轮的平均时间,单位ms/image,包括网络计算时间、数据拷贝至CPU的时间。 | ||
- 采用Fluid C++预测引擎: 包含Fluid C++预测、Fluid-TensorRT预测,下面同时测试了Float32 (FP32) 和Float16 (FP16)的推理速度。 | ||
|
||
**注意:** TensorRT中固定尺寸和动态尺寸区别请参考文档[TENSOR教程](TENSOR_RT.md)。由于固定尺寸下对两阶段模型支持不完善,所以faster rcnn模型采用动态尺寸测试。固定尺寸和动态尺寸支持融合的OP不完全一样,因此同一个模型在固定尺寸和动态尺寸下测试的性能可能会有一点差异。 | ||
|
||
## 二、推理速度 | ||
|
||
### 1、Linux系统 | ||
#### (1)Tesla V100 | ||
|
||
| 模型 | backbone | 是否固定尺寸 | 入网尺寸 | paddle_inference | trt_fp32 | trt_fp16 | | ||
|-------------------------------|--------------|--------|----------|------------------|----------|----------| | ||
| Faster RCNN FPN | ResNet50 | 否 | 640x640 | 27.99 | 26.15 | 21.92 | | ||
| Faster RCNN FPN | ResNet50 | 否 | 800x1312 | 32.49 | 25.54 | 21.70 | | ||
| YOLOv3 | Mobilenet\_v1 | 是 | 608x608 | 9.74 | 8.61 | 6.28 | | ||
| YOLOv3 | Darknet53 | 是 | 608x608 | 17.84 | 15.43 | 9.86 | | ||
| PPYOLO | ResNet50 | 是 | 608x608 | 20.77 | 18.40 | 13.53 | | ||
| SSD | Mobilenet\_v1 | 是 | 300x300 | 5.17 | 4.43 | 4.29 | | ||
| TTFNet | Darknet53 | 是 | 512x512 | 10.14 | 8.71 | 5.55 | | ||
| FCOS | ResNet50 | 是 | 640x640 | 35.47 | 35.02 | 34.24 | | ||
|
||
|
||
#### (2)Jetson AGX Xavier | ||
|
||
| 模型 | backbone | 是否固定尺寸 | 入网尺寸 | paddle_inference | trt_fp32 | trt_fp16 | | ||
|-------------------------------|--------------|--------|----------|------------------|----------|----------| | ||
| Faster RCNN FPN | ResNet50 | 否 | 640x640 | 169.45 | 158.92 | 119.25 | | ||
| Faster RCNN FPN | ResNet50 | 否 | 800x1312 | 228.07 | 156.39 | 117.03 | | ||
| YOLOv3 | Mobilenet\_v1 | 是 | 608x608 | 48.76 | 43.83 | 18.41 | | ||
| YOLOv3 | Darknet53 | 是 | 608x608 | 121.61 | 110.30 | 42.38 | | ||
| PPYOLO | ResNet50 | 是 | 608x608 | 111.80 | 99.40 | 48.05 | | ||
| SSD | Mobilenet\_v1 | 是 | 300x300 | 10.52 | 8.84 | 8.77 | | ||
| TTFNet | Darknet53 | 是 | 512x512 | 73.77 | 64.03 | 31.46 | | ||
| FCOS | ResNet50 | 是 | 640x640 | 217.11 | 214.38 | 205.78 | | ||
|
||
### 2、Windows系统 | ||
#### (1)GTX 1080Ti | ||
|
||
| 模型 | backbone | 是否固定尺寸 | 入网尺寸 | paddle_inference | trt_fp32 | trt_fp16 | | ||
|-------------------------------|--------------|--------|----------|------------------|----------|----------| | ||
| Faster RCNN FPN | ResNet50 | 否 | 640x640 | 50.74 | 57.17 | 62.08 | | ||
| Faster RCNN FPN | ResNet50 | 否 | 800x1312 | 50.31 | 57.61 | 62.05 | | ||
| YOLOv3 | Mobilenet\_v1 | 是 | 608x608 | 14.51 | 11.23 | 11.13 | | ||
| YOLOv3 | Darknet53 | 是 | 608x608 | 30.26 | 23.92 | 24.02 | | ||
| PPYOLO | ResNet50 | 是 | 608x608 | 38.06 | 31.40 | 31.94 | | ||
| SSD | Mobilenet\_v1 | 是 | 300x300 | 16.47 | 13.87 | 13.76 | | ||
| TTFNet | Darknet53 | 是 | 512x512 | 21.83 | 17.14 | 17.09 | | ||
| FCOS | ResNet50 | 是 | 640x640 | 71.88 | 69.93 | 69.52 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Inference Benchmark | ||
|
||
## 一、Prepare the Environment | ||
- 1、Test Environment: | ||
- CUDA 10.1 | ||
- CUDNN 7.6 | ||
- TensorRT-6.0.1 | ||
- PaddlePaddle v2.0.1 | ||
- The GPUS are Tesla V100 and GTX 1080 Ti and Jetson AGX Xavier | ||
- 2、Test Method: | ||
- In order to compare the inference speed of different models, the input shape is 3x640x640, use `demo/000000014439_640x640.jpg`. | ||
- Batch_size=1 | ||
- Delete the warmup time of the first 100 rounds and test the average time of 100 rounds in ms/image, including network calculation time and data copy time to CPU. | ||
- Using Fluid C++ prediction engine: including Fluid C++ prediction, Fluid TensorRT prediction, the following test Float32 (FP32) and Float16 (FP16) inference speed. | ||
|
||
**Attention:** For TensorRT, please refer to the [TENSOR tutorial](TENSOR_RT.md) for the difference between fixed and dynamic dimensions. Due to the imperfect support for the two-stage model under fixed size, dynamic size test was adopted for the Faster RCNN model. Fixed size and dynamic size do not support exactly the same OP for fusion, so the performance of the same model tested at fixed size and dynamic size may differ slightly. | ||
|
||
|
||
## 二、Inferring Speed | ||
|
||
### 1、Linux System | ||
#### (1)Tesla V100 | ||
|
||
| Model | backbone | Fixed size or not | The net size | paddle_inference | trt_fp32 | trt_fp16 | | ||
| --------------- | ------------- | ----------------- | ------------ | ---------------- | -------- | -------- | | ||
| Faster RCNN FPN | ResNet50 | no | 640x640 | 27.99 | 26.15 | 21.92 | | ||
| Faster RCNN FPN | ResNet50 | no | 800x1312 | 32.49 | 25.54 | 21.70 | | ||
| YOLOv3 | Mobilenet\_v1 | yes | 608x608 | 9.74 | 8.61 | 6.28 | | ||
| YOLOv3 | Darknet53 | yes | 608x608 | 17.84 | 15.43 | 9.86 | | ||
| PPYOLO | ResNet50 | yes | 608x608 | 20.77 | 18.40 | 13.53 | | ||
| SSD | Mobilenet\_v1 | yes | 300x300 | 5.17 | 4.43 | 4.29 | | ||
| TTFNet | Darknet53 | yes | 512x512 | 10.14 | 8.71 | 5.55 | | ||
| FCOS | ResNet50 | yes | 640x640 | 35.47 | 35.02 | 34.24 | | ||
|
||
|
||
#### (2)Jetson AGX Xavier | ||
|
||
| Model | backbone | Fixed size or not | The net size | paddle_inference | trt_fp32 | trt_fp16 | | ||
| --------------- | ------------- | ----------------- | ------------ | ---------------- | -------- | -------- | | ||
| Faster RCNN FPN | ResNet50 | no | 640x640 | 169.45 | 158.92 | 119.25 | | ||
| Faster RCNN FPN | ResNet50 | no | 800x1312 | 228.07 | 156.39 | 117.03 | | ||
| YOLOv3 | Mobilenet\_v1 | yes | 608x608 | 48.76 | 43.83 | 18.41 | | ||
| YOLOv3 | Darknet53 | yes | 608x608 | 121.61 | 110.30 | 42.38 | | ||
| PPYOLO | ResNet50 | yes | 608x608 | 111.80 | 99.40 | 48.05 | | ||
| SSD | Mobilenet\_v1 | yes | 300x300 | 10.52 | 8.84 | 8.77 | | ||
| TTFNet | Darknet53 | yes | 512x512 | 73.77 | 64.03 | 31.46 | | ||
| FCOS | ResNet50 | yes | 640x640 | 217.11 | 214.38 | 205.78 | | ||
|
||
### 2、Windows System | ||
#### (1)GTX 1080Ti | ||
|
||
| Model | backbone | Fixed size or not | The net size | paddle_inference | trt_fp32 | trt_fp16 | | ||
| --------------- | ------------- | ----------------- | ------------ | ---------------- | -------- | -------- | | ||
| Faster RCNN FPN | ResNet50 | no | 640x640 | 50.74 | 57.17 | 62.08 | | ||
| Faster RCNN FPN | ResNet50 | no | 800x1312 | 50.31 | 57.61 | 62.05 | | ||
| YOLOv3 | Mobilenet\_v1 | yes | 608x608 | 14.51 | 11.23 | 11.13 | | ||
| YOLOv3 | Darknet53 | yes | 608x608 | 30.26 | 23.92 | 24.02 | | ||
| PPYOLO | ResNet50 | yes | 608x608 | 38.06 | 31.40 | 31.94 | | ||
| SSD | Mobilenet\_v1 | yes | 300x300 | 16.47 | 13.87 | 13.76 | | ||
| TTFNet | Darknet53 | yes | 512x512 | 21.83 | 17.14 | 17.09 | | ||
| FCOS | ResNet50 | yes | 640x640 | 71.88 | 69.93 | 69.52 | |
Oops, something went wrong.