diff --git a/README.md b/README.md index fdd9c91..2c7c157 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Three computer vision approaches are covered: Segmentation, Detection and Classi ### For Model Evaluation This module exports the following functions for model evaluation: -``` +```python from lapixdl.evaluation.evaluate import evaluate_segmentation from lapixdl.evaluation.evaluate import evaluate_detection from lapixdl.evaluation.evaluate import evaluate_classification @@ -24,7 +24,7 @@ These iterators must be sorted equaly, assuring that the ground truth and the pr #### Example of segmentation model evaluation using **PyTorch**: -``` +```python from lapixdl.evaluation.evaluate import evaluate_segmentation classes = ['background', 'object'] @@ -52,11 +52,33 @@ eval = evaluate_segmentation(gt_masks, pred_masks, classes) # Shows confusion matrix and returns its Figure and Axes fig, axes = eval.show_confusion_matrix() ``` +#### Example of how to log the results of LAPiX DL evaluations in the Weights & Biases platform +About [Weights & Biases](https://docs.wandb.ai/). + +```python +from lapixdl.evaluation.evaluate import evaluate_segmentation +import wandb + +# init wandb ... +... + +eval_test = evaluate_segmentation(gt_masks, pred_masks, categories) + +... + +# If you want to log everything +wandb.log({'test_evaluation': eval_test.to_dict()['By Class']}) + +# If you want to choose specific categories to log +selected_cats = ['A', 'B', 'C'] +metrics_by_cat = {k: v for k, v in eval_test.to_dict()['By Class'].items() if k in selected_cats} +wandb.log({'test_evaluation': metrics_by_cat}) +``` ### For Results Visualization This module exports the following functions for results visualization: -``` +```python from lapixdl.evaluation.visualize import show_segmentations from lapixdl.evaluation.visualize import show_classifications from lapixdl.evaluation.visualize import show_detections @@ -67,13 +89,13 @@ The available color maps are the [ones from matplotlib](https://matplotlib.org/3 ### For Data Conversion This module exports the following functions for data conversion: -``` +```python from lapixdl.convert.labelbox import labelbox_to_coco ``` #### Example of conversion from **Labelbox** to **COCO** labels format: -``` +```python import json from lapixdl.convert.labelbox import labelbox_to_coco