예제 #1
0
def second_check1(input):
    '''
    第二层分类器1
    :param input: 输入特征向量(矩阵)/标签
    :return: 具体类别, numpy.ndarray
    '''
    dict1 = {0: 7.174541, 1: 17.936353, 2: 20.0}
    pb_file_path = r'/home/xiaosong/桌面/pny相关数据/model/full_model_1'
    g2 = tf.Graph()
    with g2.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g2) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/second_classifier_1')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:-1],
                                  is_training: False
                              })
        r_classify = np.argmax(a=r_classify, axis=1)
        #按照dict1中的映射将类别标记替换为实际半径
        r_finally = []
        for i in range(r_classify.shape[0]):
            r_finally.append(dict1[r_classify[i]])
        return r_finally
예제 #2
0
def first_check(input):
    '''
    第一层分类器
    :param input: 输入特征向量(矩阵)/标签
    :return: 半径所属大类别, numpy.ndarray
    '''
    pb_file_path = r'/home/xiaosong/桌面/pny相关数据/model/full_model'
    g1 = tf.Graph()
    with g1.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g1) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/first_classifier')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:-1],
                                  is_training: False
                              })
        r_classify = np.argmax(a=r_classify, axis=1)
    return r_classify
예제 #3
0
def second_check1(input):
    '''
    第二层分类器1
    :param input: 输入特征向量(矩阵)/标签
    :return: 具体类别, numpy.ndarray
    '''
    dict1 = {0: 7.17, 1: 17.93, 2: 20}
    pb_file_path = r'/home/xiaosong/桌面/pny相关数据/model/full_model_1'
    g2 = tf.Graph()
    with g2.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g2) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/second_classifier_1')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:],
                                  is_training: False
                              })
        # tf.summary.FileWriter('log/second_graph1', sess.graph)
        r_classify = np.argmax(a=r_classify, axis=1)
        r_finally = dict1[r_classify]
        return r_finally
예제 #4
0
def second_check2(input):
    '''
    第二层分类器1
    :param input: 输入特征向量(矩阵)/标签
    :return: 具体类别, numpy.ndarray
    '''
    dict2 = {
        0: 0.05,
        1: 3.261155,
        2: 4.484088,
        3: 23.915137,
        4: 35.872705,
        5: 71.745411,
        6: 107.618116,
        7: 143.490822,
        8: 179.363527,
        9: 215.236233,
        10: 251.108938
    }
    pb_file_path = r'/home/xiaosong/桌面/pny相关数据/model/full_model_2'
    g3 = tf.Graph()
    with g3.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g3) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/second_classifier_2')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='sub_dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:-1],
                                  is_training: False
                              })
        r_classify = np.argmax(a=r_classify, axis=1)
        # 按照dict2中的映射将类别标记替换为实际半径
        r_finally = []
        for i in range(r_classify.shape[0]):
            r_finally.append(dict2[r_classify[i]])
    return r_finally
예제 #5
0
def second_check2(input):
    '''
    第二层分类器1
    :param input: 输入特征向量(矩阵)/标签
    :return: 具体类别, numpy.ndarray
    '''
    dict2 = {
        0: 0.05,
        1: 0.672281,
        2: 0.924386,
        3: 1.479017,
        4: 3.697543,
        5: 4.930057,
        6: 20.0,
        7: 22.185257,
        8: 36.975428,
        9: 44.370514
    }
    pb_file_path = r'/home/xiaosong/桌面/oldenburg相关数据/model/full_model_2'
    g3 = tf.Graph()
    with g3.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g3) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/second_classifier_2')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='sub_dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:-1],
                                  is_training: False
                              })
        tf.summary.FileWriter('log/second_graph2', sess.graph)
        r_classify = np.argmax(a=r_classify, axis=1)
        # 按照dict2中的映射将类别标记替换为实际半径
        r_finally = []
        for i in range(r_classify.shape[0]):
            r_finally.append(dict2[r_classify[i]])
    return r_finally
예제 #6
0
def second_check2(input):
    '''
    第二层分类器1
    :param input: 输入特征向量(矩阵)/标签
    :return: 具体类别, numpy.ndarray
    '''
    dict2 = {
        0: 0.05,
        1: 3.26,
        2: 4.48,
        3: 23,
        4: 35,
        5: 71,
        6: 107,
        7: 143,
        8: 179,
        9: 215,
        10: 251
    }
    pb_file_path = r'/home/xiaosong/桌面/pny相关数据/model/full_model_2'
    g3 = tf.Graph()
    with g3.as_default():
        init = tf.global_variables_initializer()
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
    with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options),
                    graph=g3) as sess:
        sess.run(init)
        use_pb(sess_new=sess,
               pb_file_path=pb_file_path,
               file_suffix=r'/second_classifier_2')
        x_f = import_ops(sess_new=sess, op_name='placeholder/x_f')
        x_l = import_ops(sess_new=sess, op_name='placeholder/x_l')
        is_training = import_ops(sess_new=sess,
                                 op_name='placeholder/is_training')
        output = import_ops(sess_new=sess, op_name='sub_dnn/Softmax')
        r_classify = sess.run(output,
                              feed_dict={
                                  x_f: input[:, :4],
                                  x_l: input[:, 4:],
                                  is_training: False
                              })
        tf.summary.FileWriter('log/second_graph2', sess.graph)
        r_classify = np.argmax(a=r_classify, axis=1)
        # print(r_classify)
        r_finally = dict2[r_classify[0]]
    return r_finally