Skip to content

Commit 75036c5

Browse files
authored
Merge pull request #68 from backyardbiomech/main
Update documentation for refining workflow
2 parents 8991e07 + d4807aa commit 75036c5

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The easiest way to get started is to drop a folder (typically a folder from with
4949
- `E`, to enable edge coloring (by default, if using this in refinement GUI mode, points with a confidence lower than 0.6 are marked
5050
in red)
5151
- `F`, to toggle between animal and body part color scheme.
52+
- `V`, to toggle visibility of the selected layer.
5253
- `backspace` to delete a point.
5354
- Check the box "display text" to show the label names on the canvas.
5455
- To move to another folder, be sure to save (Ctrl+S), then delete the layers, and re-drag/drop the next folder.
@@ -61,6 +62,7 @@ Only when saving segmentation masks does a save file dialog pop up to name the d
6162
keypoint annotations are otherwise automatically saved in the corresponding folder as `CollectedData_<ScorerName>.h5`.
6263
- As a reminder, DLC will only use the H5 file; so be sure if you open already labeled images you save/overwrite the H5.
6364
- Note, before saving a layer, make sure the points layer is selected. If the user clicked on the image(s) layer first, does `Save As`, then closes the window, any labeling work during that session will be lost!
65+
- Modifying and then saving points in a `machinelabels...` layer will add to or overwrite the existing `CollectedData` layer and will **not** save to the `machinelabels` file.
6466

6567

6668
### Video frame extraction and prediction refinement
@@ -106,13 +108,50 @@ Suggested workflows, depending on the image folder contents:
106108
3. **Refining labels** – the image folder contains a `machinelabels-iter<#>.h5` file.
107109

108110
The process is analog to *2*.
111+
Open *napari* and open an image folder.
112+
If the video was originally labeled, *and* had outliers extracted it will contain a `CollectedData_<ScorerName>.h5` file and a `machinelabels-iter<#>.h5` file. In this case, select the `machinelabels` layer in the GUI, and type `e` to show edges. Red indicates likelihood < 0.6. As you navigate through frames, images with labels with edges will need to be refined (moved, deleted, etc). Images with labels without edges will be on the `CollectedData` (previous manual annotations) layer and shouldn't need refining. However, you can switch to that layer and fix errors. You can also right-click on the `CollectedData` layer and select `toggle visibility` to hide that layer. Select the `machinelabels` layer before saving which will append your refined annoations to `CollectedData`.
113+
114+
If the folder only had outliers extracted and wasn't originally labeled, it will not have a `CollectedData` layer. Work with the `machinelabels` layer selected to refine annoation positions, then save.
115+
116+
In this case, it is not necessary to open the DLC project's `config.yaml` file, as all necessary metadata is read from the `h5` data file.
117+
118+
Saving works as described in *1*.
109119

110120
4. **Drawing segmentation masks**
111121

112122
Drop an image folder as in *1*, manually add a *shapes layer*. Then select the *rectangle* in the layer controls (top left pane),
113123
and start drawing rectangles over the images. Masks and rectangle vertices are saved as described in [Save Layers](#save-layers).
114124
Note that masks can be reloaded and edited at a later stage by dropping the `vertices.csv` file onto the canvas.
115125

126+
### Workflow flowchart
127+
128+
```mermaid
129+
%%{init: {"flowchart": {"htmlLabels": false}} }%%
130+
graph TD
131+
id1[What stage of labeling?]
132+
id2[deeplabcut.label_frames]
133+
id3[deeplabcut.refine_labels]
134+
id4[Add labels to, or modify in, \n `CollectedData...` layer and save that layer]
135+
id5[Modify labels in `machinelabels` layer and save \n which will create a `CollectedData...` file]
136+
id6[Have you refined some labels from the most recent iteration and saved already?]
137+
id7["All extracted frames are already saved in `CollectedData...`.
138+
1. Hide or trash all `machinelabels` layers.
139+
2. Then modify in and save `CollectedData`"]
140+
id8["
141+
1. hide or trash all `machinelabels` layers except for the most recent.
142+
2. Select most recent `machinelabels` and hit `e` to show edges.
143+
3. Modify only in `machinelabels` and skip frames with labels without edges shown.
144+
4. Save `machinelabels` layer, which will add data to `CollectedData`.
145+
- If you need to revisit this video later, ignore `machinelabels` and work only in `CollectedData`"]
146+
147+
id1 -->|I need to manually label new frames \n or fix my labels|id2
148+
id1 ---->|I need to refine outlier frames \nfrom analyzed videos|id3
149+
id2 -->id4
150+
id3 -->|I only have a `machinelabels...` file|id5
151+
id3 ---->|I have both `machinelabels` and `CollectedData` files|id6
152+
id6 -->|yes|id7
153+
id6 ---->|no, I just extracted outliers|id8
154+
```
116155

117156
### Labeling multiple image folders
118157

0 commit comments

Comments
 (0)