subsampling.py 1.04 KB
Newer Older
1 2 3 4 5 6
import numpy as np
import matplotlib.pyplot as plt
import time
import sys
sys.path.append("C://Users//xbrjos//Desktop//Python")
from gepard import dataset
Josef Brandt's avatar
Josef Brandt committed
7
import gepardevaluation
8

Josef Brandt's avatar
Josef Brandt committed
9
from methods import RandomSampling, SizeBinFractioning
10
from geometricMethods import BoxSelectionCreator
11
from helpers import ParticleBinSorter
12 13
from evaluation import TotalResults, SampleResult
from input_output import get_pkls_from_directory, get_attributes_from_foldername
14

Josef Brandt's avatar
Josef Brandt committed
15 16 17 18
"""
IMPORTANT!!!
SET GEPARD TO EVALUATION BRANCH (WITHOUT THE TILING STUFF), OTHERWISE SOME OF THE LEGACY CONVERTS MIGHT FAIL..
"""
19 20


Josef Brandt's avatar
Josef Brandt committed
21
results: TotalResults = TotalResults()
22 23 24 25 26 27 28 29
pklsInFolders = get_pkls_from_directory(r'C:\Users\xbrjos\Desktop\temp MP\NewDatasets')

for folder in pklsInFolders.keys():
    for samplePath in pklsInFolders[folder]:
        newSampleResult: SampleResult = results.add_sample(samplePath)
        for attr in get_attributes_from_foldername(folder):
            newSampleResult.set_attribute(attr)

Josef Brandt's avatar
Josef Brandt committed
30

Josef Brandt's avatar
Josef Brandt committed
31 32 33
t0 = time.time()
results.update_all()
print('updating all took', time.time()-t0, 'seconds')