%load_ext autoreload
%autoreload 2

matching[source]

matching(target_df, pred_df, tolerance=500, print_res=True, eff_const=0.5)

Matches localizations to ground truth positions and provides assessment metrics used in the SMLM2016 challenge.
(see http://bigwww.epfl.ch/smlm/challenge2016/index.html?p=methods#6)
When using default parameters exactly reproduces the procedure used for the challenge (i.e. produces same numbers as the localization tool).

Parameters
----------
test_csv: str or list
    Ground truth positions with columns: 'localization', 'frame', 'x', 'y', 'z'
    Either list or str with locations of csv file.
pred_inp: list
    List of localizations
size_xy: list of floats
    Size of processed recording in nano meters
tolerance: float
    Localizations are matched when they are within a circle of the given radius.
tolerance_ax: float
    Localizations are matched when they are closer than this value in z direction. Should be ininity for 2D recordings. 500nm is used for 3D recordings in the challenge.
border: float
    Localizations that are close to the edge of the recording are excluded because they often suffer from artifacts.
print_res: bool
    If true prints a list of assessment metrics.
min_int: bool
    If true only uses the brightest 75% of ground truth locations.
    This is the setting used in the leaderboard of the challenge. However this implementation does not exactly match the method used in the localization tool.

Returns
-------
perf_dict, matches: dict, list
    Dictionary of perfomance metrics.
    List of all matches localizations for further evaluation in format: 'localization', 'frame', 'x_true', 'y_true', 'z_true', 'x_pred', 'y_pred', 'z_pred', 'int_true', 'x_sig', 'y_sig', 'z_sig'
basedir = '/groups/turaga/home/speisera/share_TUM/FishSIM/sim_density_fac1_2/'
from decode_fish.funcs.file_io import load_sim_fish
img, gt_df, fq_nog_df, fq_gmm_df = load_sim_fish(basedir, 2000, 'random', 'NR', 0)
# model_out = torch.load('../data/model_output.pt')
# model_preds = SIPostProcpx_size_zyx=size=[100, 100, 300]).forward(model_out)
perf_df, matches, _ = matching(gt_df, fq_gmm_df, tolerance=500)
Recall: 0.717
Precision: 0.933
Jaccard: 68.175
RMSE_vol: 132.084
Eff_3d: 26.690
FN: 381.0 FP: 69.0
Shift: 4.83,5.59,8.72
preds = fq_gmm_df
perf_df, matches, _ = matching(gt_df, preds, tolerance=500)
Recall: 0.958
Precision: 0.974
Jaccard: 93.388
RMSE_vol: 116.393
Eff_3d: 41.429
FN: 10.0 FP: 6.0
Shift: -32.13,-32.89,-98.43
!nbdev_build_lib
Converted 00_models.ipynb.
Converted 01_psf.ipynb.
Converted 02_microscope.ipynb.
Converted 03_noise.ipynb.
Converted 04_pointsource.ipynb.
Converted 05_gmm_loss.ipynb.
Converted 06_plotting.ipynb.
Converted 07_file_io.ipynb.
Converted 08_dataset.ipynb.
Converted 09_output_trafo.ipynb.
Converted 10_evaluation.ipynb.
Converted 11_emitter_io.ipynb.
Converted 12_utils.ipynb.
Converted 13_train.ipynb.
Converted 15_fit_psf.ipynb.
Converted 16_visualization.ipynb.
Converted 17_eval_routines.ipynb.
Converted index.ipynb.