Skip to content

Commit

Permalink
Add new example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
talmo committed Sep 12, 2023
1 parent c4f81a2 commit cdfe48b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ labels = sio.load_slp("predictions.slp")
sio.save_nwb(labels, "predictions.nwb")
```

### Convert labels to raw arrays

```py
import sleap_io as sio

labels = sio.load_slp("tests/data/slp/centered_pair_predictions.slp")

# Convert predictions to point coordinates in a single array.
trx = labels.numpy()
n_frames, n_tracks, n_nodes, xy = trx.shape
assert xy == 2

# Convert to array with confidence scores appended.
trx_with_scores = labels.numpy(return_confidence=True)
n_frames, n_tracks, n_nodes, xy_score = trx.shape
assert xy_score == 3
```

### Create labels from raw data

```py
Expand Down

0 comments on commit cdfe48b

Please sign in to comment.