Exemple #1
0
def main(_):
    model = DPQ(FLAGS)
    a = "/device:GPU:0" if FLAGS.UseGPU else "/cpu:0"
    print("Using device:", a, "<-", FLAGS.Device)
    with tf.device(a):
        queryX, queryY, db = Dataset.PreparetoEval(FLAGS.Dataset, IMAGE_WIDTH, IMAGE_HEIGHT)
        result = model.Evaluate(queryX, queryY, db)
Exemple #2
0
def main(_):
    model = DSQ(FLAGS)
    a = "/device:GPU:0" if FLAGS.UseGPU else "/cpu:0"
    print("Using device:", a, "<-", FLAGS.Device)
    with tf.device(a):
        queryX, queryY, db = Dataset.PreparetoEval(FLAGS.Dataset, IMAGE_WIDTH,
                                                   IMAGE_HEIGHT)
        fileName = model.CheckTime(queryX)
Exemple #3
0
def main(_):
    model = DSQ(FLAGS)
    a = "/device:GPU:0" if FLAGS.UseGPU else "/cpu:0"
    print("Using device:", a, "<-", FLAGS.Device)
    with tf.device(a):
        queryX, queryY, db = Dataset.PreparetoEval(FLAGS.Dataset, IMAGE_WIDTH, IMAGE_HEIGHT)
        result = model.Evaluate(queryX, queryY, db)
        now = datetime.datetime.now()
        if not path.exists('results'):
            os.mkdir('results')
        with open('./results/result_{0}_{1}'.format(model._name, now.strftime("%Y-%m-%d %H:%M:%S")),'w') as fp:
            fp.write(result + '\n')
Exemple #4
0
def main(_):
    model = DPQ(FLAGS)
    a = "/device:GPU:0" if FLAGS.UseGPU else "/cpu:0"
    print("Using device:", a, "<-", FLAGS.Device)
    with tf.device(a):
        queryX, queryY, db = Dataset.PreparetoEval(FLAGS.Dataset, IMAGE_WIDTH,
                                                   IMAGE_HEIGHT)
        fileName = model.GetRetrievalMat(queryX, queryY, db)
    if os.path.exists(fileName):
        retrievalMat = np.load(fileName)
        precision = np.mean(np.cumsum(retrievalMat, axis=1) /
                            np.arange(1, retrievalMat.shape[1] + 1, 1),
                            axis=0)
        np.savetxt('precision.csv', precision)
        totalResult = np.sum(retrievalMat, axis=1)
        print(totalResult)
        # [Nq, Nb] / [Nq, 1]
        recall = np.mean(np.cumsum(retrievalMat, axis=1) /
                         totalResult[:, None],
                         axis=0)
        np.savetxt('recall.csv', recall)