Пример #1
0
 def __init__(self):
     self.login = Login()
     self.login.showMaximized()
     self.db = Model()
     self.db2 = Model()
     self.centerx(self.login)
     self.login.login_btn.clicked.connect(self.log_in)
     self.login.pass_lbl.returnPressed.connect(self.log_in)
     self.main_code = Main_code()
     self.main_code.logout_btn_5.clicked.connect(self.log_out)
     db1 = Model()
     db1.th_course()
     db2 = Model()
     db2.th_exam()
Пример #2
0
 def setup_valid(self):
     self.model = Model()
     self.model = get_cuda(self.model)
     checkpoint = torch.load(os.path.join(config.save_model_path,
                                          self.opt.load_model))
     # 加载在train中保存得模型
     self.model.load_state_dict(checkpoint['model_dict'])
Пример #3
0
    def build_model(self):
        print('mode: {}'.format(self.config.mode))
        print('------------------------------------------')
        self.net_bone = Model(3, self.config.mode)
        if self.config.cuda:
            self.net_bone = self.net_bone.cuda()

        if self.config.mode == 'train':
            if self.config.model_path != '':
                assert (os.path.exists(self.config.model_path)), (
                    'please import correct pretrained model path!')
                self.net_bone.load_pretrain_model(self.config.model_path)
        else:
            assert (self.config.model_path !=
                    ''), ('Test mode, please import pretrained model path!')
            assert (os.path.exists(self.config.model_path)), (
                'please import correct pretrained model path!')
            self.net_bone.load_pretrain_model(self.config.model_path)

        self.lr_bone = p['lr_bone']
        self.lr_branch = p['lr_branch']
        self.optimizer_bone = Adam(filter(lambda p: p.requires_grad,
                                          self.net_bone.parameters()),
                                   lr=self.lr_bone,
                                   weight_decay=p['wd'])
        print('------------------------------------------')
        self.print_network(self.net_bone, 'DSNet')
        print('------------------------------------------')
Пример #4
0
 def once_run(self):
     '''
     一次运行函数,将结果显示在界面上
     :return:
     '''
     self.clr_cache()
     m = Model()
     m.data_gen(int(self.num), int(self.max), int(self.min),
                self.probabilities)
     m.result_cal(int(self.num))
     self.service, self.group_items = m.data_pool()
     self.service_keys = list(self.service.keys())
     self.group_items_keys = list(self.group_items.keys())
     col_count = self.once_run_table.columnCount()
     self.once_run_table.removeRow(0)
     for j in range(len(self.service[self.service_keys[0]])):
         self.once_run_table.insertRow(j)
         self.once_run_table.setVerticalHeaderItem(
             j, QTableWidgetItem(str(j + 1)))
         self.once_run_table.setItem(j, 0, QTableWidgetItem(str(j + 1)))
         for i in range(1, col_count):
             self.once_run_table.setItem(
                 j, i,
                 QTableWidgetItem(
                     str(self.service[self.service_keys[i - 1]][j])))
     self.avg_txt.setText(str(self.group_items[self.group_items_keys[0]]))
     self.sys_use_txt.setText(
         str(self.group_items[self.group_items_keys[1]]))
Пример #5
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.setWindowTitle(u'تفاصيل الطالب')
     self.db = Model()
     self.pr = print_doc()
     self.gp_dw = gp_dw()
     self.st_gp_switch = st_gp_switch()
     self.centerx(self.st_gp_switch)
     self.mony_dw = mony_dw()
     self.centerx(self.gp_dw)
     self.centerx(self.mony_dw)
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.groups_btn.clicked.connect(self.student_group)
     self.add_group_btn.clicked.connect(self.show_gp_get)
     self.gp_dw.add_btn.clicked.connect(self.add_st_course)
     self.table_st_course.cellClicked.connect(self.del_st_course)
     self.attend_btn.clicked.connect(self.fill_courses_att)
     self.mony_btn.clicked.connect(self.fill_courses_mn)
     self.course_cmb.currentIndexChanged.connect(self.fill_att_months)
     self.att_search_btn.clicked.connect(self.attend_st_fill)
     self.month_cmb.currentIndexChanged.connect(self.attend_st_fill)
     self.mn_search_btn.clicked.connect(self.mony_st_fill)
     self.course_mn_cmb.currentIndexChanged.connect(self.mony_st_fill)
     self.mn_table.cellClicked.connect(self.buy_mony)
     self.mony_dw.put_mony_btn.clicked.connect(self.buy_mony_db)
     self.att_print_btn.clicked.connect(self.print_attend)
     self.mn_print_btn.clicked.connect(self.print_mony)
     self.connect(self.att_table,
                  SIGNAL("doubleClicked(const QModelIndex&)"),
                  self.change_st_status)
     self.color_btn()
     self.st_gp_switch.pushButton.clicked.connect(self.switch)
Пример #6
0
    def setUp(self):
        self.log = Log("testlog.txt")
        self.log.add = MagicMock()
        self.model = Model(self.log, self.dbPath)

        self.fruits = ModelEntry(self.log, "fruits")
        self.fruits.tags.append("apple")
        self.fruits.tags.append("melon")
        self.fruits.text = "This entry is about fruit"
        self.legumes = ModelEntry(self.log, "legumes")
        self.legumes.tags.append("tomato")
        self.cars = ModelEntry(self.log, "cars")
        self.cars.tags.append("mustang")
        self.cars.tags.append("volvo")
        self.cars.text = "This entry is about cars"
        self.legs = ModelEntry(self.log, "legs")
        self.aerocrafts = ModelEntry(self.log, "aerocraft")

        self.model.db.addEntry(self.fruits)
        self.model.db.addEntry(self.legs)
        self.model.db.addEntry(self.legumes)
        self.model.db.addEntry(self.aerocrafts)
        self.model.foundEntries["name"].append(self.cars)
        self.model.foundEntries["description"].append(self.fruits)
        self.model.foundEntries["tag"].append(self.legumes)
        self.model.openedEntries.append(self.fruits)
        self.model.openedEntries.append(self.legumes)
Пример #7
0
    def __init__(self):
        QWidget.__init__(self)
        self.setupUi(self)
        self.db = Model()
        self.pr = print_doc()
        self.phone = None
        self.barcode = None
        self.completer_set()
        self.st_dw = students_dw()
        self.st_info = student_info()
        self.st_dw.ph_lbl.hide()
        self.st_dw.bc_lbl.hide()
        self.centerx(self.st_dw)
        self.bc_num = bc_num()
        self.centerx(self.bc_num)
        self.centerx(self.st_info)
        self.add_btn.clicked.connect(self.st_sh_add)
        self.connect(self.all_students, SIGNAL("clicked(const QModelIndex&)"),
                     self.st_sh_edt)
        self.connect(self.all_students,
                     SIGNAL("doubleClicked(const QModelIndex&)"), self.rep_sh)
        self.search_edt.returnPressed.connect(self.st_search)
        self.st_dw.add_btn.clicked.connect(self.add_st)
        self.st_dw.edite_btn.clicked.connect(self.edite_st)
        self.st_dw.delete_btn.clicked.connect(self.del_st)
        self.search_edt.setFocus()
        self.print_btn.clicked.connect(
            lambda: self.bc_num.pre_show(self.all_students.model().mylist))
        self.st_dw.barcode_get_btn.clicked.connect(
            lambda: self.st_dw.bc_edt.setText(self.db.generate_barcode()))

        self.print_student_info.clicked.connect(self.print_f)
Пример #8
0
    def __init__(self, log, config):
        '''Constructor'''
        self.actions = {
            "searchAction": self.searchAction,
            "entryChangeAction": self.entryChangeAction,
            "newAction": self.newEntryAction,
            "showEntryAction": self.entryClickedInVSearch,
            "closedAction": self.closeTabAction,
            "tabChangeAction": self.tabChangeAction,
            "deleteAction": self.deleteEntryAction,
            "pathChangeAction": self.changePathAction,
            "newImageAction": self.newImageAction,
            "imageSelectedAction": self.newFileOrImageSelectedAction,
            "addTagAction": self.newTagAction,
            "deleteTagAction": self.deleteTagAction,
            "deleteImageAction": self.deleteImageAction,
            "deleteFileAction": self.deleteFileAction,
            "newFileAction": self.newFileAction,
            "fileSelectedAction": self.newFileOrImageSelectedAction,
            "openFileAction": self.openFileAction,
            "openEntryOverviewAction": self.openEntryOverviewAction
        }
        if log != None:
            self.log = log
        else:
            self.log = Log("log.txt")

        self.config = ConfigFile(self.log, config)
        self.dbPath = self.config.getValue(self.configDataBase)
        self.tempFilePath = self.config.getValue(self.tempFilePath)
        self.view = View(self.log, self.dbPath, self.actions)
        self.model = Model(self.log, self.dbPath)

        self.log.add(self.log.Info, __file__, "init")
def get_model_by_id(model_id):
    conn = sqlite3.connect(database_path)
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM model WHERE id = " + model_id)
    rows = cursor.fetchall()
    model = Model(id=rows[0][0], server_id=rows[0][1], algorithm_id=rows[0][2])
    return model
Пример #10
0
def save_models(net, check_point_file, model_file, image_h_w, onnx_file, opt_level):
    map_location = (lambda storage, loc: storage)
    data = torch.load(check_point_file, map_location=map_location)

    models = dict(data['state_dicts'][0])
    dummy_input = torch.randn(10, 3, image_h_w[0], image_h_w[1], device='cuda').half()
    model = Model(net, pretrained=False)
    model.load_state_dict(models)
    model.cuda()

    optimizer = optim.Adam(model.parameters())

    model, optimizer = amp.initialize(model, optimizer,
                                    opt_level=opt_level,
                                    #loss_scale=cfg.loss_scale
                                )




    input_names = [ "actual_input_1" ] + [ "learned_%d" % i for i in range(16) ]
    output_names = [ "output1" ]

    torch.save(model.state_dict(), model_file)
    torch.onnx.export(model.base, dummy_input, onnx_file, verbose=True, input_names=input_names, output_names=output_names)
Пример #11
0
    def setup_train(self):
        self.model = Model()
        self.model = get_cuda(self.model)

        self.trainer = torch.optim.Adam(self.model.parameters(), lr=config.lr)

        start_iter = 0

        if self.opt.load_model is not None:
            load_model_path = os.path.join(config.save_model_path,
                                           self.opt.load_model)
            checkpoint = torch.load(load_model_path)
            start_iter = checkpoint['iter']
            self.model.load_state_dict(checkpoint['model_dict'])
            self.trainer.load_state_dict(checkpoint['trainer_dict'])
            print("load model at" + load_model_path)

        if self.opt.new_lr is not None:
            self.trainer = torch.optim.Adam(self.model.parameters(),
                                            lr=self.opt.new_lr)
            # for params in self.traine
            # .param_groups:
            #     params['lr'] = self.opt.new_lr

        return start_iter
Пример #12
0
 def __init__(self):
     super().__init__()
     self.app = QtWidgets.QApplication(sys.argv)
     self.model = Model()
     self.mainView = MainWindowView()
     self.accounts_controller = AccountsController(self.model)
     self.data_controller = DataController(self.model)
     self.init()
Пример #13
0
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self.model = Model()
        self.main_ctrl = MainController(self.model)
        self.main_view = MainView(self.model, self.main_ctrl)
        self.settings_view = SettingsView(self.model, self.main_ctrl)
        self.main_view.show()

        # This works, but should be shown after I pressed the Settings-button
        self.settings_view.show()
Пример #14
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.db = Model()
     self.wrong_name.hide()
     self.wrong_pass.hide()
     self.login_w.setAttribute(Qt.WA_StyledBackground, True)
     self.exit_btn.clicked.connect(self.ex_f)
     self.user_lbl.returnPressed.connect(self.search_name)
     self.login_w.setContentsMargins(25, 25, 25, 25)
     self.set_bg_image()
Пример #15
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.pr = print_doc()
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.db = Model()
     self.gp_name=None
     #self.all_items.hide()
     self.all_btn.clicked.connect(self.get_student_report_info)
     self.st_dt.setDateTime(datetime.datetime.now())
     self.end_dt.setDateTime(datetime.datetime.now())
Пример #16
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.db = Model()
     self.st_dt.setDateTime(datetime.datetime.now())
     self.end_dt.setDateTime(datetime.datetime.now())
     self.groups()
     self.search_fun()
     self.course_cmb.currentIndexChanged.connect(self.search_fun)
     self.search_btn.clicked.connect(self.search_fun)
Пример #17
0
def run():
    config = Config("WN18", TransE)
    model = Model(config)
    model.train()
    model.test()
    config = Config("FB15K", TransE)
    model = Model(config)
    model.train()
    model.test()
    config = Config("WN18", TransH)
    model = Model(config)
    model.train()
    model.test()
    config = Config("FB15K", TransH)
    model = Model(config)
    model.train()
    model.test()
    config = Config("WN18", TransR)
    model = Model(config)
    model.train()
    model.test()
    config = Config("FB15K", TransR)
    model = Model(config)
    model.train()
    model.test()
Пример #18
0
def main(options):

    print 'Loading data...'
    train, valid, test, worddict = DataLoader.load_data()

    print 'Initializing model...'
    model = Model(train=train,
                  validate=valid,
                  test=test,
                  worddict=worddict,
                  options=options)

    model.train()
Пример #19
0
def main(opt):
    dataset = VideoDataset(opt, 'test')
    dataloader = DataLoader(dataset,
                            collate_fn=test_collate_fn,
                            batch_size=opt['batch_size'],
                            shuffle=False)
    opt['cms_vocab_size'] = dataset.get_cms_vocab_size()
    opt['cap_vocab_size'] = dataset.get_cap_vocab_size()

    if opt['cms'] == 'int':
        cms_text_length = opt['int_max_len']
    elif opt['cms'] == 'eff':
        cms_text_length = opt['eff_max_len']
    else:
        cms_text_length = opt['att_max_len']

    model = Model(dataset.get_cap_vocab_size(),
                  dataset.get_cms_vocab_size(),
                  cap_max_seq=opt['cap_max_len'],
                  cms_max_seq=cms_text_length,
                  tgt_emb_prj_weight_sharing=True,
                  vis_emb=opt['dim_vis_feat'],
                  rnn_layers=opt['rnn_layer'],
                  d_k=opt['dim_head'],
                  d_v=opt['dim_head'],
                  d_model=opt['dim_model'],
                  d_word_vec=opt['dim_word'],
                  d_inner=opt['dim_inner'],
                  n_layers=opt['num_layer'],
                  n_head=opt['num_head'],
                  dropout=opt['dropout'])

    if len(opt['load_checkpoint']) != 0:
        state_dict = torch.load(opt['load_checkpoint'])
        # for name, param in model.state_dict().items():
        #     print(name, param.size())
        #
        # print('=================')
        # print(state_dict.keys())
        model.load_state_dict(state_dict)

    if opt['cuda']:
        model = model.cuda()

    model.eval()
    model_parameters = filter(lambda p: p.requires_grad, model.parameters())
    params = sum([np.prod(p.size()) for p in model_parameters])
    print(params)
    test(dataloader, model, opt, dataset.get_cap_vocab(),
         dataset.get_cms_vocab())
Пример #20
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.db = Model()
     self.pr = print_doc()
     self.show_info = info_dw()
     self.completer_set()
     self.centerx(self.show_info)
     self.search_btn.clicked.connect(self.get_groups)
     self.st_search_edt.returnPressed.connect(self.get_groups)
     self.gp_name.currentIndexChanged.connect(self.search_func)
     self.st_dt.setDateTime(datetime.datetime.now())
     self.end_dt.setDateTime(datetime.datetime.now())
     self.report_table.cellClicked.connect(self.show_info_f)
     self.print_btn.clicked.connect(self.print_report)
Пример #21
0
def main(options):
    print('Loading data...')
    train, valid, test, worddict = DataLoader.load_data()

    print('Initializing model...')
    model = Model(train=train,
                  validate=valid,
                  test=test,
                  worddict=worddict,
                  options=options)

    image_files = glob.glob('demo/*.jpg')
    model_path = './'
    config_path = 'data/'

    feat_maps = get_feature_maps(config_path, image_files)
    model.infer(model_path, feat_maps)
Пример #22
0
def upload_file():
    '''
        a function to upload image file
    '''

    if request.method == 'POST':
        file = request.files['file']
        if file and allowed_file(file.filename):
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            file_url = url_for('uploaded_file', filename=filename)
            modelObj = Model()
            modelObj.load()
            pred = modelObj.get_result(
                os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return html + '<label>' + pred + '</label><br><img src=' + file_url + '>'
    return html
Пример #23
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.gp_btn.setStyleSheet("background:#757780;")
     self.exm_btn.setStyleSheet("")
     self.all_btn.clicked.connect(self.all_show)
     self.gp_btn.clicked.connect(self.gp_show)
     self.exm_btn.clicked.connect(self.exm_show)
     self.db = Model()
     self.gp_show()
     self.info_tbl.setLayoutDirection(Qt.RightToLeft)
     self.connect(self.tableView, SIGNAL("clicked(const QModelIndex&)"),
                  self.tbl_select)
     self.start_dt.setDate(datetime.datetime.now())
     self.end_dt.setDate(datetime.datetime.now())
Пример #24
0
def main():
    # Load dataset
    x_train, y_train, x_test, y_test, prev_y, unnormalized, forecast = load_data(
        "./data/bitcoin_historical.csv", 50)

    # Calculate the input shape of the data
    input_shape = (forecast, x_train.shape[-1])

    # Create and build the model
    model = Model()
    model.build(forecast, 0.2, 'linear', 'mse', 'adam', input_shape)

    # Train the model and get the time taken
    model.train(x_train, y_train, 1024, 10, .05)
    model.train_time()

    # Make predictions
    y_predict, y_predict_actual, y_test_actual = model.test(
        x_test, y_test, unnormalized)
Пример #25
0
 def get_course_times(self):
     x = self.db.get_course(self.gp_id)
     self.table_dates.setRowCount(0)
     if x:
         for i in x:
             n = self.table_dates.rowCount()
             self.table_dates.insertRow(n)
             xx = QTableWidgetItem(unicode(i[2]))
             xx.setStatusTip(unicode(i[0]))
             self.table_dates.setItem(n, 0, xx)
             self.table_dates.setItem(n, 1, QTableWidgetItem(unicode(i[3])))
             self.table_dates.setItem(n, 2, QTableWidgetItem(unicode(i[4])))
             self.table_dates.setItem(n, 3, QTableWidgetItem(unicode(i[5])))
             self.table_dates.setItem(n, 4, QTableWidgetItem(u'حذف'))
             self.table_dates.setItem(n, 5, QTableWidgetItem(u'تعديل'))
             self.table_dates.item(n, 4).setBackground(QColor(231, 76, 62))
             self.table_dates.item(n, 5).setBackground(QColor(45, 136, 45))
     db = Model()
     db.th_course()
Пример #26
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     self.db = Model()
     self.mony_dw = mony_dw()
     self.alerm = alerm()
     self.re_alerm = re_alerm()
     self.degree_dw = degree_dw()
     self.re_gp = replace()
     self.centerx(self.re_gp)
     self.centerx(self.degree_dw)
     self.centerx(self.mony_dw)
     self.centerx(self.alerm)
     self.centerx(self.re_alerm)
     self.attend_btn.hide()
     self.exam_btn.hide()
     self.exam_cmb.hide()
     self.exams_dw.hide()
     self.one_more = 1
     self.auto_attend.clicked.connect(self.sh_att)
     self.completer_set()
     self.search_btn.clicked.connect(self.attend_f)
     self.st_search.returnPressed.connect(self.attend_f)
     self.attend_btn.clicked.connect(self.attend_f)
     self.st_search.setFocus()
     self.mony_dw.put_mony_btn.clicked.connect(self.buy_mony_db)
     self.mony_btn.clicked.connect(self.buy_mony)
     self.mony_dw.mid.currentIndexChanged.connect(self.change_price)
     self.degree_dw.put_degree_btn.clicked.connect(self.buy_degree_db)
     self.exam_btn.clicked.connect(self.degree_exam)
     self.degree_dw.mid.currentIndexChanged.connect(self.change_degree)
     self.gp_rd.clicked.connect(self.sh_gp_w)
     self.ex_rd.clicked.connect(self.sh_ex_w)
     self.alerm.ok_bun.clicked.connect(self.allow)
     self.alerm.cancel.clicked.connect(self.not_allow)
     self.re_alerm.ok_bun.clicked.connect(self.allow_re)
     self.re_gp.ok_btn.clicked.connect(self.add_another)
     self.re_alerm.cancel.clicked.connect(self.not_allow_re)
     self.re_gp.cancel_btn.clicked.connect(self.cancel_another)
     self.re_gp.month_cmb.currentIndexChanged.connect(self.fill_class)
Пример #27
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setupUi(self)
     self.db = Model()
     self.tabes_data = {
         u'حضور الطلاب': student_enter(),
         u'الطالب': student(),
         u'المجموعات': course(),
         u'الاختبارات': exam(),
         u'تقرير المجموعات': Report_all(),
         u'تقرير الطالب': st_report(),
         u'تقرير الماليه': report(),
         u'المستخدمين': permissions()
     }
     for i in self.findChildren(QWidget):
         i.setAttribute(Qt.WA_StyledBackground, True)
     for i in self.widget_3.findChildren(QToolButton):
         i.clicked.connect(self.pr_lst)
     self.h.tabCloseRequested.connect(self.removeTab)
     self.h.currentChanged.connect(self.tab_select)
Пример #28
0
 def __init__(self):
     QWidget.__init__(self)
     self.setupUi(self)
     self.uid.hide()
     self.db = Model()
     self.perm_set = perm_set()
     self.centerx(self.perm_set)
     self.usr = add_user()
     self.centerx(self.usr)
     self.widget.setAttribute(Qt.WA_StyledBackground, True)
     #self.uadd.clicked.connect(self.add_user)
     self.uadd.clicked.connect(self.a_user)
     self.uedite.clicked.connect(self.edite_user)
     self.udelet.clicked.connect(self.delete_user)
     self.usr.add_save.clicked.connect(self.save)
     self.usr.cancel_save.clicked.connect(self.cancel)
     self.permissions_btn.clicked.connect(self.perm_set.show)
     self.perm_set.perm_set_btn.clicked.connect(self.update_permissions)
     self.fill_users()
     self.uid.setText("0")
Пример #29
0
def create_cnn_model(input_placeholder, hold_prob_placeholder):
    img_shape = (48, 48, 1)
    current_img_dim = img_shape[0]
    num_channel = 3
    num_labels = 43

    layer_1_filter_shape = (4, 4)
    layer_1_num_of_out_feats = 48
    layer_1_pool_factor= 2

    layer_2_filter_shape = (4, 4)
    layer_2_num_of_out_feats = 64
    layer_2_pool_factor = 2

    fully_connected_neurons = 1024

    model = Model()

    #layer 1
    model.convo_1 = convolutional_layer(input_placeholder, shape=[layer_1_filter_shape[0], layer_1_filter_shape[1], num_channel, layer_1_num_of_out_feats],name='conv1')
    model.convo_1_pooling = max_pool_2_by_2(model.convo_1,ksize=[1, 2, 2, 1], stride=[1, 2, 2, 1], name='pool1')
    current_img_dim = int(current_img_dim/layer_1_pool_factor)

    #layer 2
    model.convo_2 = convolutional_layer(model.convo_1_pooling, shape=[layer_2_filter_shape[0], layer_2_filter_shape[1], layer_1_num_of_out_feats, layer_2_num_of_out_feats], name='conv2')
    model.convo_2_pooling = max_pool_2_by_2(model.convo_2, ksize=[1, 2, 2, 1],stride=[1, 2, 2, 1], name='pool2')
    current_img_dim = int(current_img_dim / layer_2_pool_factor)

    #flatten
    model.convo_2_flat = tf.reshape(model.convo_2_pooling, [-1, current_img_dim*current_img_dim*layer_2_num_of_out_feats])

    #full
    model.full_layer_one = tf.nn.relu(normal_full_layer(model.convo_2_flat, fully_connected_neurons,name='fully_connected'))

    #dropout
    model.full_one_dropout = tf.nn.dropout(model.full_layer_one, keep_prob=hold_prob_placeholder,name='full_one_dropout')

    #normal full layer from dropout
    model.y_pred = normal_full_layer(model.full_one_dropout, num_labels,name='normal_full_output')

    return model
Пример #30
0
 def once_run(self):
     self.clr_cache()
     m = Model()
     m.data_gen(int(self.num),int(self.max),int(self.min),self.probabilities)
     m.result_cal(10)
     r = m.data_pool()
     col_count = self.once_run_table.columnCount()
     self.once_run_table.removeRow(0)
     for j in range(len(r[0])):
         self.once_run_table.insertRow(j)
         item = QTableWidgetItem()
         item.setText(str(j + 1))
         self.once_run_table.setVerticalHeaderItem(j, item)
         item = QTableWidgetItem()
         item.setText(str(j + 1))
         self.once_run_table.setItem(j, 0, item)
         for i in range(1, col_count):
             item = QTableWidgetItem()
             item.setText(str(r[i - 1][j]))
             self.once_run_table.setItem(j, i, item)
     self.avg_txt.setText(str(r[8]))
     self.sys_use_txt.setText(str(r[9]))