10  Output Quality

Through the Lens of Segmentation

Authors
Affiliations

Jan Funke

HHMI Janelia Research Campus

Add any co-authors as appropriate

Under your first header, include a brief introduction to your chapter.

Starting prompt for this chapter: Chapter 10 addresses how to assess the quality of a model’s output, mentioning Metrics Reloaded. This chapter should address the question: how do I know my model is good enough? It should frame this discussion using the example of a segmentation model and discuss how tools can identify uncertain decisions from a model.

10.1 Include section headers as appropriate

Use markdown heading level two for section headers. You can use standard markdown formatting, for example emphasize the end of this sentence.

This is a new paragraph with more text. Your paragraphs can cross reference other items, such as Figure 11.1. Use fig to reference figures, and eq to reference equations, such as Equation 11.1.

10.1.1 Sub-subsection headers are also available

To make your sections cross reference-able throughout the book, include a section reference, as shown in the header for Section 11.4.

10.2 Bibliography and Citations

To cite a research article, add it to references.bib and then refer to the citation key. For example, reference1 refers to CellPose and reference2 refers to ZeroCostDL4Mic.

10.3 Adding to the Glossary

We are using R code to create a glossary for this book. To add a definition, edit the glossary.yml file. To reference the glossary, enclose the word as in these examples: LLMs suffer from hallucinations. It is important to understand the underlying training data, validation data and false positives to interpret your results. Clicking on the word will reveal its definition by taking you to the entry on the Glossary page. Pressing back in your browser will return you to your previous place in the textbook.

10.4 Code and Equations

This is an example of including a python snippet that generates a figure

import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
Figure 10.1: Simple Plot

In some cases, you may want to include a code-block that is not executed when the book is compiled. Use the eval: false option for this.

import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()

Figures can also be generated that do not show the code by using the option for code-fold: true.

Code
import numpy as np
import matplotlib.pyplot as plt

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
  subplot_kw = {'projection': 'polar'} 
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
A line plot on a polar axis. The line spirals out from a value of zero to a value of 2.
Figure 10.2: A spiral on a polar axis

Here is an example equation.

\[ s = \sqrt{\frac{1}{N-1} \sum_{i=1}^N (x_i - \overline{x})^2} \tag{10.1}\]

10.4.1 Embedding Figures

You can also embed figures from other notebooks in the repo as shown in the following embed example.

a demo figure to be embedded in a template chapter
Figure 10.3: Polar plot of circles of random areas at random coords

When embedding notebooks, please store the .ipynb file in the notebook directory. Include the chapter in the name of your file. For example, chapter4_example_u-net.ipynb. This is how we will handle chapter- or example-specific environments. We will host notebooks on Google Colab so that any required packages for the code–but not for rendering the book at large–will be installed there. That way, we will not need to handle a global environment across the book.

10.5 Quarto has additional features.

You can learn more about markdown options and additional Quarto features in the Quarto documentation. One example that you might find interesting is the option to include callouts in your text. These callouts can be used to highlight potential pitfalls or provide additional optional exercises that the reader might find helpful. Below are examples of the types of callouts available in Quarto.

Note

Note that there are five types of callouts, including: note, tip, warning, caution, and important. They can default to open (like this example) or collapsed (example below).

These could be good for extra material or exercises.

Caution

There are caveats when applying these tools. Expand the code below to learn more.

Code
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
Warning

Be careful to avoid hallucinations.

Important

This is key information.