Skip to content

Commit

Permalink
Updated efd and regionprops to match the new score_df return type (li…
Browse files Browse the repository at this point in the history
…near + randomforest)
  • Loading branch information
afoix committed Oct 21, 2024
1 parent c9c197e commit 74fe9d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions scripts/shapeembed/efd.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ def run_elliptic_fourier_descriptors(dataset, contour_size, logger):
efd_df.to_csv(f"{clargs.output_dir}/{dataset.name}-efd-raw_df.csv")
umap_plot(efd_df, f'{dataset.name}-efd', outputdir=clargs.output_dir)

efd_cm, efd_score_df = score_dataframe(efd_df, 'efd')
efd_cms, efd_score_df = score_dataframe(efd_df, 'efd')

logger.info(f'-- efd on {dataset.name}, score\n{efd_score_df}')
efd_score_df.to_csv(f"{clargs.output_dir}/{dataset.name}-efd-score_df.csv")
logger.info(f'-- confusion matrix:\n{efd_cm}')
confusion_matrix_plot(efd_cm, f'{dataset.name}-efd', clargs.output_dir)
for kind, efd_cm in efd_cms.items():
logger.info(f'-- {kind} confusion matrix:\n{efd_cm}')
confusion_matrix_plot(efd_cm, f'{dataset.name}-{kind}-efd', clargs.output_dir)
7 changes: 4 additions & 3 deletions scripts/shapeembed/regionprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def run_regionprops( dataset
regionprops_df.to_csv(f"{clargs.output_dir}/{dataset.name}-regionprops-raw_df.csv")
umap_plot(regionprops_df, f'{dataset.name}-regionprops', outputdir=clargs.output_dir)

regionprops_cm, regionprops_score_df = score_dataframe(regionprops_df, 'regionprops')
regionprops_cms, regionprops_score_df = score_dataframe(regionprops_df, 'regionprops')

logger.info(f'-- regionprops on {dataset.name}, score\n{regionprops_score_df}')
regionprops_score_df.to_csv(f"{clargs.output_dir}/{dataset.name}-regionprops-score_df.csv")
logger.info(f'-- confusion matrix:\n{regionprops_cm}')
confusion_matrix_plot(regionprops_cm, f'{dataset.name}-regionprops', clargs.output_dir)
for kind, regionprops_cm in regionprops_cms.items():
logger.info(f'-- {kind} confusion matrix:\n{regionprops_cm}')
confusion_matrix_plot(regionprops_cm, f'{dataset.name}-{kind}-regionprops', clargs.output_dir)

0 comments on commit 74fe9d0

Please sign in to comment.