Skip to content

Commit 2d8f6e9

Browse files
docs: discuss the black cube
1 parent 2c47c0e commit 2d8f6e9

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

benchmarks/README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ This comparison was performed to show what happens when SciPy and `cc3d` are run
8181
| cc3d 1.2.2 | 335.5 | 671.1 | 15.3x |
8282

8383

84-
## 10x Head to Head: Random Binary Images
84+
# 10x Head to Head: Random Binary Images
8585

8686
```python
8787
import numpy as np
@@ -104,7 +104,7 @@ for label in labels:
104104
cc3d.connected_components(label) # blue
105105
```
106106

107-
### 26-connected
107+
## 26-connected
108108

109109
<p style="font-style: italics;" align="center">
110110
<img height=384 src="https://raw.githubusercontent.com/seung-lab/connected-components-3d/master/benchmarks/cc3d_vs_scipy_random_binary_images_26.png" alt="Fig. 3: SciPy vs cc3d run ten times on ten 384x384x384 random binary images using 26-connectivity. (black) SciPy 1.5.2 (blue) cc3d 1.13.0" /><br>
@@ -118,7 +118,7 @@ On random binary images, SciPy marginally wins on memory with a peak memory cosu
118118
| SciPy 1.5.2 | 23.4 | 23.4 | 1.00x |
119119
| cc3d 1.13.0 | 54.7 | 54.7 | 2.34x |
120120

121-
### 6-connected
121+
## 6-connected
122122

123123
<p style="font-style: italics;" align="center">
124124
<img height=384 src="https://raw.githubusercontent.com/seung-lab/connected-components-3d/master/benchmarks/cc3d_vs_scipy_random_binary_images_6.png" alt="Fig. 4: SciPy vs cc3d run ten times on ten 384x384x384 random binary images using 6-connectivity. (black) SciPy 1.5.2 (blue) cc3d 1.13.0" /><br>
@@ -131,3 +131,33 @@ Here there's a slight difference in the memory usage. SciPy uses about 850 MB wh
131131
|-------------------|---------|--------|------------|
132132
| SciPy 1.5.2 | 42.2 | 42.2 | 1.00x |
133133
| cc3d 1.13.0 | 59.2 | 59.2 | 1.40x |
134+
135+
# 10x Head to Head: Black Cube
136+
137+
<p style="font-style: italics;" align="center">
138+
<img height=384 src="https://raw.githubusercontent.com/seung-lab/connected-components-3d/master/benchmarks/cc3d_sparse_black.png" alt="Fig. 4: Different configurations run against a uint64 512x512x512 black cube using 26-connectivity. (black) SciPy 1.5.2 (blue) cc3d 1.14.0 (red) cc3d 1.14.0 in sparse mode." /><br>
139+
Fig. 4: Different configurations run against a uint32 512x512x512 black cube using 26-connectivity. (black) SciPy 1.5.2 (blue) cc3d 1.14.0 (red) cc3d 1.14.0 in sparse mode.
140+
</p>
141+
142+
Sometimes empty data shows up in your pipeline. Sometimes a lot of it. How do your libraries handle it? At full speed? Slower? Faster than normal?
143+
144+
Here we show scipy versus cc3d in normal and sparse modes of operation using 26 connectivity. cc3d 1.14.0 contains optimizations for handling this case. In all modes, cc3d will skip the relabeling pass if provisional labels total fewer than two. In sparse mode, it will also skip the decision tree pass and memory allocation of data structures as well if it detects zero foreground voxels.
145+
146+
We can see how this bears out. In black, scipy runs at a brisk and reasonable clip. In data not shown, it appears to have some optimization for black voxels as it runs more slowly on a solid color non-zero cube. cc3d with sparse off rushes through the decision tree and skips the relabeling. With sparse on, it skips everything except the scan for foreground labels.
147+
148+
The worst memory usage is by cc3d with sparse mode off. Scipy and cc3d are approximately equal in memory usage with sparse mode on.
149+
150+
151+
| Trial | MVx/sec | Rel. Perf. |
152+
|-------------------|---------|------------|
153+
| SciPy 1.5.2 | 101 | 1.00x |
154+
| cc3d 1.14.0 | 339 | 3.36x |
155+
| cc3d 1.14.0 sparse| 1107 | 10.96x |
156+
157+
158+
159+
160+
161+
162+
163+

0 commit comments

Comments
 (0)