You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This structure supports both particle picking for sub-tomogram averaging and broader 3D segmentation tasks. Our deep learning platform [Octopi 🐙](https://github.com/chanzuckerberg/octopi) is designed to train models from copick projects for:
Copy file name to clipboardExpand all lines: docs/getting-started/quickstart.md
+26-16Lines changed: 26 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,62 +15,72 @@ For reference, you can skip steps 1 and 2 to visualize the raw SAM2 segmentation
15
15
## 🧩 Phase 1: Curating Training Labels and Training and Domain Expert Classifier
16
16
17
17
### Producing Intial SAM2 Segmentations
18
-
Use `prepare-tomogram-training` to generate 2D segmentations from a tomogram using SAM2-style slab-based inference. These masks act as a rough initialization for downstream curation and model training.
18
+
Use `prep3` to generate 2D segmentations from a tomogram using SAM2-style slab-based inference. These masks act as a rough initialization for downstream curation and model training.
19
19
20
20
#### For tomogram data:
21
21
```bash
22
-
saber classifier prepare-tomogram-training \
22
+
saber classifier prep3d \
23
23
--config config.json \
24
24
--voxel-size 10 --tomo-alg denoised \
25
-
--num-slabs 3 --output training_data.zarr \
25
+
--num-slabs 3 --output training.zarr \
26
26
```
27
27
This will save slab-wise segmentations in a Zarr volume that can be reviewed or refined further.
28
28
29
29
#### For electron micrograph/single-particle data:
30
30
```bash
31
-
saber classifier prepare-micrograph-training \
31
+
saber classifier prep2d \
32
32
--input path/to/folder/*.mrc \
33
-
--ouput training_data.zarr \
33
+
--ouput training.zarr \
34
34
--target-resolution 10
35
35
```
36
36
37
-
In the case of referencing MRC files from single particle datasets use `prepare-micrograph-training` instead.
37
+
In the case of referencing MRC files from single particle datasets use `prep2d` instead.
38
38
39
39
### 🎨 Annotating Segmentations for the Classifier with the Interactive GUI
40
40
41
41
Launch an interactive labeling session to annotate the initial SAM2 segmentations and assign class labels.
42
42
```
43
-
saber gui \
44
-
--input output_zarr_fname.zarr \
45
-
--output curated_labels.zarr \
46
-
--class-names carbon,lysosome,artifacts
43
+
saber gui --input training.zarr
47
44
```
48
45
49
-
For transfering the data between machines, its recommended ziping (compressing) the zarr file prior to data transfer (e.g. `zip -r curated_labels.zarr.zip curated_labels.zarr`).
46
+
For transfering the data between machines, its recommended ziping (compressing) the zarr file prior to data transfer (e.g. `zip -r training.zarr.zip training.zarr`).
50
47
51
-
Once annotations are complete, split the dataset into training and validation sets:
48
+
After you download the anntoated JSON file, you can apply the annotations on the original zarr file.
49
+
50
+
```bash
51
+
saber classifier labeler \
52
+
--input training.zarr \
53
+
--labels labels.json \
54
+
--classes class1,class2,class3 \
55
+
--output labeld.zarr
56
+
```
57
+
58
+
Once the labeled zarr is available, split the dataset into training and validation sets:
52
59
53
60
```
54
61
saber classifier split-data \
55
-
--input curated_labels.zarr \
62
+
--input labeled.zarr \
56
63
--ratio 0.8
57
64
```
58
-
This generates `curated_labels_train.zarr` and `curated_labels_val.zarr` for use in model training.
65
+
This generates `labeled_train.zarr` and `labeled_val.zarr` for use in model training.
66
+
67
+
!!! info "Learn More"
68
+
For detailed annotation instructions, see the [Annotation and Labeling](../tutorials/preprocessing.md#-annotation-with-the-saber-gui) section.
59
69
60
70
## 🧠 Phase 2: Train a Domain Expert Classifier
61
71
62
72
Train a classifier using your curated annotations. This model improves segmentation accuracy beyond zero-shot results by learning from expert-provided labels.
The number of classes should be 1 greater than the number of class names provided during annotation (to account for background).
69
79
Training logs, model weights, and evaluation metrics will be saved under `results/`.
70
80
71
81
## 🔍 Phase 3: Inference
72
82
73
-
### 🖼️ Producting 2D Segmentations with SABER
83
+
### 🖼️ Producing 2D Segmentations with SABER
74
84
75
85
SABER operates in two modes depending on your input: interactive mode when processing a single image, and batch processing mode when you provide a file path pattern (like `--input 'path/to/*.mrc'`) to process entire datasets automatically.
Copy file name to clipboardExpand all lines: docs/tutorials/preprocessing.md
+34-17Lines changed: 34 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,10 +69,10 @@ This preview helps you understand what structures SAM2 naturally identifies in y
69
69
70
70
## 🧬 Pre-processing Electron Micrographs
71
71
72
-
For single-particle datasets, ADF/BF signals from S/TEM, or FIB-SEM micrographs -- use the `saber classifier prepare-micrograph-training` command:
72
+
For single-particle datasets, ADF/BF signals from S/TEM, or FIB-SEM micrographs -- use the `saber classifier prep2d` command:
73
73
74
74
```bash
75
-
saber classifier prepare-micrograph-training \
75
+
saber classifier prep2d \
76
76
--input 'path/to/*.mrc' \
77
77
--output training.zarr
78
78
```
@@ -92,7 +92,7 @@ Traditional workflows require you to manually draw every mask from scratch. SABE
92
92
93
93
Generate comprehensive slab-based segmentations that maintain 3D context:
94
94
```bash
95
-
saber classifier prepare-tomogram-training \
95
+
saber classifier prep3d \
96
96
--config config.json \
97
97
--zarr-path output_zarr_fname.zarr \
98
98
--num-slabs 3
@@ -113,31 +113,48 @@ Small objects or sparse structures might not be present in a single slab project
113
113
114
114
---
115
115
116
-
## 🎨 Next Step: Annotation with the SABER GUI
116
+
## 🎨 Annotation with the SABER GUI
117
117
118
+
Launch the GUI to begin annotating your pre-processed data:
119
+
```bash
120
+
saber gui --input output_zarr_fname.zarr
121
+
```
118
122
Once preprocessing is complete, SABER's unique annotation workflow begins. Instead of drawing masks from scratch, you simply:
119
123
120
-
1.**Point and Click** on the precomputed segmentations.
121
-
2.**Assign Class Labels** using the dropdown menu.
124
+
!!! info "How the GUI works:"
125
+
1. **Point and Click** on the precomputed SAM2 segmentations.
126
+
2. **Assign Class Labels** using the menu on the right.
127
+
3. **Save the Annotations** Save the resulting JSON file with the bottom right button.
122
128
123
129

124
130
125
-
```bash
126
-
saber gui \
127
-
--input output_zarr_fname.zarr \
128
-
--output curated_labels.zarr \
129
-
--class-names carbon,lysosome,artifacts
130
-
```
131
-
132
-
**Class Configuration**: The `--class-names` flag defines the biological classes present in your data. For binary classification (object vs. background), you can omit this flag for a simple two-class system.
133
-
134
-
**💡 How Many Micrographs / Tomograms Should I Annotate?** In general we recommend annotating 20-40 runs per dataset. In cases where there are several objects per image/slab the lower range should be sufficient. If only a few instances are available, the higher range is recommended.
131
+
!!! tip "Annotation Guidelines - How Many Images to Annotate?"
132
+
- We recommend 20-40 runs per dataset
133
+
- Lower range (20): When multiple objects appear per image/slab
134
+
- Higher range (40): When only few instances are available
135
+
- Consistency is key: Maintain uniform criteria across all annotations
136
+
- Handle ambiguous segments: When uncertain, prefer skipping over mislabeling
135
137
136
138
**Tip:** For transferring data between machines, it's recommended to compress your Zarr files:
137
139
```bash
138
140
zip -r curated_labels.zarr.zip curated_labels.zarr
139
141
```
140
142
143
+
## 🏷️ Applying Annotations for Classifier Training
144
+
145
+
Once you've completed annotations in the GUI, use the `labeler` command to apply your JSON annotations to the SAM2 masks, creating a training-ready dataset. The labeler converts your point-and-click annotations into properly indexed training data, handling class ordering automatically or according to your specifications.
146
+
147
+
!!! example "Basic Usage"
148
+
```bash
149
+
saber classifier labeler \
150
+
--input training.zarr \
151
+
--labels labels.json \
152
+
--classes lysosome,carbon,edge \
153
+
--output labeled.zarr
154
+
```
155
+
156
+
We can either control the ordering of the labels or apply a subset of the labels with the `--classes` flag. If the flag is omitted, all classes are used in alphabetical orde
157
+
141
158
---
142
159
143
-
_Ready to move on? Check out the [Training a Classifier](training.md) tutorial!_
160
+
_Ready to move on? Check out the [Training a Classifier](training.md) tutorial!_
0 commit comments