Esempio n. 1
0
def storeAccuracyPerPointsRemoved(accuracy):
    '''
    This function stores the amount of poinst removed per iteration.
    '''
    curShape = getShapeName(desiredClassLabel)
    savePath = os.path.join(
        os.path.split(__file__)[0], "testdata", "saliency_maps_ppi")
    if not os.path.exists(savePath):
        os.makedirs(savePath)
    filePath = os.path.join(savePath, curShape + "_accuracy")
    tdh.writeResult(filePath, accuracy)
Esempio n. 2
0
def storeAmountOfUsedTime(usedTime):
    '''
    This function stores the amount of total time used per object.
    '''
    curShape = getShapeName(desiredClassLabel)
    savePath = os.path.join(
        os.path.split(__file__)[0], "testdata", "p-grad-CAM_performance")
    if not os.path.exists(savePath):
        os.makedirs(savePath)
    filePath = os.path.join(savePath, curShape)
    print("STORING FILES TO: ", filePath)
    tdh.writeResult(filePath, usedTime)
Esempio n. 3
0
def storeAmountOfPointsRemoved(numPointsRemoved):
    '''
    This function stores the amount of points removed per iteration.
    '''
    curShape = getShapeName(desiredClassLabel)
    savePath = os.path.join(
        os.path.split(__file__)[0], "testdata", "p-grad-CAM_ppi")
    if not os.path.exists(savePath):
        os.makedirs(savePath)
    filePath = os.path.join(savePath, curShape + "_points_removed")
    print("STORING FILES TO: ", filePath)
    tdh.writeResult(filePath, numPointsRemoved)
Esempio n. 4
0
def storeTestResults(mode, total_correct, total_seen, loss_sum, pred_val):
    '''
    This function stores the test data into seperate files for later retrieval.
    '''
    curShape = getShapeName(desiredClassLabel)
    savePath = os.path.join(os.path.split(__file__)[0], "testdata", curShape)
    if not os.path.exists(savePath):
        os.makedirs(savePath)
    mean_loss = loss_sum / float(total_seen)
    accuracy = total_correct / float(total_seen)
    filePath = os.path.join(
        savePath,
        curShape + "_" + str(numTestRuns) + "_" + str(mode) + "_meanloss")
    print("STORING FILES TO: ", filePath)
    tdh.writeResult(filePath, mean_loss)
    filePath = os.path.join(
        savePath,
        curShape + "_" + str(numTestRuns) + "_" + str(mode) + "_accuracy")
    print("STORING FILES TO: ", filePath)
    tdh.writeResult(filePath, accuracy)
    filePath = os.path.join(
        savePath,
        curShape + "_" + str(numTestRuns) + "_" + str(mode) + "_prediction")
    print("STORING FILES TO: ", filePath)
    tdh.writeResult(filePath, pred_val)
    log_string('eval mean loss: %f' % mean_loss)
    log_string('eval accuracy: %f' % accuracy)