def cpu_run_times(fn): image_pth = Path(os.path.dirname(os.path.realpath(__file__))) / Path( "../simulation/screenshot.png" ) screenshot = SimulPLIF(img_path=image_pth, num_repeats=1) with open(f"{fn}.csv", "w", newline="") as csvfile: writer = csv.writer(csvfile) writer.writerow(["n_bin", "max_sigma", "time"]) for i in range(REPEATS): for max_sigma in range(min_sigma, mx_sigma + 1): for n_bin in range(min_bin, max_bin + 1): START = time.monotonic() cpu_blob_dog( screenshot[0], min_sigma=min_sigma, max_sigma=max_sigma, overlap=0.9, threshold=0.012, sigma_bins=n_bin, prune=False, ) res = [n_bin, max_sigma, time.monotonic() - START] writer.writerow(res) print(res)
def cpu_accuracy(): glob_str = (str( Path(os.path.dirname(os.path.realpath(__file__))) / Path("../simulation/test_data/")) + "/*.png") print(glob_str) for image_pth in glob.glob(glob_str): screenshot = SimulPLIF(img_path=image_pth, num_repeats=1, load_truth=False) blobs = cpu_blob_dog( screenshot[0], min_sigma=min_sigma, max_sigma=mx_sigma, overlap=0.5, threshold=0.1, sigma_bins=max_bin, prune=False, ) blobs[:, 2] = blobs[:, 2] * np.sqrt(2) # make_circles_fig(screenshot[0].numpy(), blobs).show() # break fn = str( Path(os.path.dirname(os.path.realpath(__file__))) / f"accuracy_results/cpu/{os.path.basename(image_pth)}.res") np.savetxt(fn, blobs) print(fn)