Skip to content

Commit

Permalink
add wandb example to readme (#22)
Browse files Browse the repository at this point in the history
* add wandb example to readme

* fix names

Co-authored-by: Andre Victória Matias <andre.vmatias@gmail.com>

* fix code snippets type

Co-authored-by: Andre Victória Matias <andre.vmatias@gmail.com>
  • Loading branch information
johnnv1 and Andrevmatias authored Apr 25, 2022
1 parent ee2f42f commit fe7528e
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit fe7528e

Please sign in to comment.