def __init__(self): super(SettingDialog,self).__init__() self.conf = C() self.setupUi(self) self.setWindowTitle('设置') self.setFixedSize(610, 695) self.read_setting() self.confirmBtn.clicked.connect(self.confirm_setting) self.cancelBtn.clicked.connect(self.close) self.choose_result_path_btn.clicked.connect(self.choose_result_path) self.choose_result_html_btn.clicked.connect(self.choose_result_html) self.choose_result_text_btn.clicked.connect(self.choose_result_text) self.choose_video_path_btn.clicked.connect(self.choose_video_path)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/13 11:22 # @Author : wendy # @Usage : Use prediction final result to drawchart # @File : draw_chart.py # @Software: PyCharm import plotly.graph_objs as go import plotly.offline as off from model.Config import Config as C from utils import helper as hp C = C() def draw(result_set, zebra): print('Ploting the image now...') plot_dir = C.PREDICT_RESULT_IMAGE hp.mkdir(plot_dir) save_name = zebra.get_name() max_density = zebra.get_max_type() x_list = [] y_list = [] max_list = [] for name, result in result_set.items(): x_list.append(name) y_list.append(result) max_list.append(round(zebra.get_current_max_density(max_density), 2))
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/11 11:51 # @Author : wendy # @Usage : The zebra object tends to deal with zebra cross infos # @File : Zebra.py # @Software: PyCharm # suit yourself to define the max from model.Config import Config as C config = C() MAX_ALLOWED_DENSITY_ONE_ZEBRA = float(config.MAX_ALLOWED_DENSITY_ONE_ZEBRA) MAX_ALLOWED_DENSITY_TRIANGLE_ZEBRA = float( config.MAX_ALLOWED_DENSITY_TRIANGLE_ZEBRA) MAX_ALLOWED_DENSITY_RECTANGLE_ZEBRA = float( config.MAX_ALLOWED_DENSITY_RECTANGLE_ZEBRA) class Zebra(object): def __init__(self, cross_type): self.config = config if cross_type == 'one_zebra': self.type = 'one_zebra' self.name = 'one zebra crossing' self.max_density = MAX_ALLOWED_DENSITY_ONE_ZEBRA elif cross_type == 'tri_zebra': self.type = 'tri_zebra' self.name = 'triangle zebra crossing' self.max_density = MAX_ALLOWED_DENSITY_TRIANGLE_ZEBRA elif cross_type == 'rec_zebra': self.type = 'rec_zebra'
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/12 11:15 # @Author : wendy # @Usage : The predict object.Include some useful relative functions # @File : Predictions.py # @Software: PyCharm import os import json from model.Config import Config as C PREDICT_RESULT_PATH = C().PREDICT_RESULT_PATH class Predictions(object): ''' Class that deal with predict train_data saving and reading ''' def __init__(self,image_name,type,model_name): self.image_name = image_name self.result = self.init_prediction_result() self.flag = False self.type = type self.model_name = model_name self.save_path = PREDICT_RESULT_PATH+self.image_name+'_'+self.type+'_'+self.model_name+'.json' def get_predict_flag(self): return self.flag def set_predict_flag(self,flag): self.flag = flag