Esempio n. 1
0
def testload(path="Dataset_lab/RESIZE2/CROP", size=400):
    test_number = 6
    t_operasi1 = time()
    label, average, eigenface, subtracted_average, bobot = util.loadTrainingFromNPZ(
        path="EigenUtil/BPPT/CROP2", size=size, number_of_training=10)
    akurasi, accuracy, recall, precision, error_rate = evaluasi.evaluasiPrecisionAndRecall(
        path=path,
        size=size,
        testnumber=test_number,
        average=average,
        eigenfaces=eigenface,
        bobot=bobot)
    t_operasi3 = time()
    t_waktu_eksekusi = t_operasi3 - t_operasi1
    nama_file = "hasil/DatasetBPPT/EigenfaceBPPT2_size" + str(
        size) + "_TRNum" + str(5) + "_TestNum" + str(test_number) + ".json"
    with open(nama_file, "w") as fp:
        fp.write("akurasi (Individu): {}\n".format(
            json.dumps(akurasi, indent=2)))
        # fp.write("nilai: {}\n".format(json.dumps(kl, indent=2)))
        fp.write("akurasi (ALL){}\n".format(json.dumps(accuracy)))
        fp.write("recall (ALL){}\n".format(json.dumps(recall)))
        fp.write("precision (ALL){}\n".format(json.dumps(precision)))
        fp.write("errorRate (ALL){}\n".format(json.dumps(error_rate)))
        fp.write("Durasi {}\n".format(json.dumps(t_waktu_eksekusi)))
def testCaseDatasetLab(path="Dataset_lab/RESIZE2/CROP"):
    # sizes = [12, 25, 64, 100, 125, 320]
    # training_numbers = [1, 2, 3, 4, 5, 6, 7, 8]
    sizes = [400]
    # sizes = [12]
    training_numbers = [4, 5, 6, 7, 8, 9, 10]

    test_number = 6

    for size in sizes:
        for num in training_numbers:
            t_operasi1 = time()
            # label, average, eigenface, subtracted_average, bobot = util.getEigenUtil(path="EigenUtil/BPPT",size=size, number_of_training=num)
            label, average, eigenface, subtracted_average, bobot = util.loadTrainingFromNPZ(path="EigenUtil/BPPT/CROP2",
                                                                                            size=size,
                                                                                            number_of_training=num)
            akurasi, accuracy, recall, precision, error_rate = evaluasi.evaluasiPrecisionAndRecall(
                path=path,
                size=size,
                testnumber=test_number,
                average=average,
                eigenfaces=eigenface,
                bobot=bobot)
            t_operasi3 = time()
            t_waktu_eksekusi = t_operasi3 - t_operasi1
            nama_file = "hasil/DatasetBPPT/EigenfaceBPPT2_size" + str(size) + "_TRNum" + str(num) + "_TestNum" + str(
                test_number) + ".json"
            with open(nama_file, "w") as fp:
                fp.write("akurasi (Individu): {}\n".format(json.dumps(akurasi, indent=2)))
                # fp.write("nilai: {}\n".format(json.dumps(kl, indent=2)))
                fp.write("akurasi (ALL){}\n".format(json.dumps(accuracy)))
                fp.write("recall (ALL){}\n".format(json.dumps(recall)))
                fp.write("precision (ALL){}\n".format(json.dumps(precision)))
                fp.write("errorRate (ALL){}\n".format(json.dumps(error_rate)))
                fp.write("Durasi {}\n".format(json.dumps(t_waktu_eksekusi)))
Esempio n. 3
0
def mainWebcam(path=None, size=250, channel=0):
    if path == None:
        path = "EigenUtil"

    label, average, eigenface, subtracted_average, bobot = util.loadTrainingFromNPZ(
        path=path, size=size)
    WebcamHandler.webcam(size=size,
                         average=average,
                         eigenfaces=eigenface,
                         labels=label,
                         bobot=bobot,
                         channel=channel)