.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_risk_control/2-advanced-analysis/plot_semantic_segmentation_precision_control.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_risk_control_2-advanced-analysis_plot_semantic_segmentation_precision_control.py: Precision control for semantic segmentation =========================================== This example illustrates how to control the precision of a semantic segmentation model using MAPIE. We use `SemanticSegmentationController` to calibrate a decision threshold that statistically guarantees a target precision level on unseen data. The dataset, model and utility functions are loaded from Hugging Face for simplicity and reproducibility. .. GENERATED FROM PYTHON SOURCE LINES 16-30 .. code-block:: Python import importlib.util import warnings from pathlib import Path import matplotlib.pyplot as plt import numpy as np import torch from huggingface_hub import hf_hub_download, snapshot_download from mapie.risk_control import SemanticSegmentationController warnings.filterwarnings("ignore") .. GENERATED FROM PYTHON SOURCE LINES 31-35 To keep this example self-contained, we load the dataset utilities and the segmentation LightningModule definition directly from a repository hosted on Hugging Face. .. GENERATED FROM PYTHON SOURCE LINES 35-50 .. code-block:: Python module_path = hf_hub_download( repo_id="mapie-library/rooftop_segmentation", filename="model_and_lightning_module.py", repo_type="dataset", ) spec = importlib.util.spec_from_file_location("hf_module", module_path) hf_module = importlib.util.module_from_spec(spec) spec.loader.exec_module(hf_module) SegmentationLightningModule = hf_module.SegmentationLightningModule RoofSegmentationDataset = hf_module.RoofSegmentationDataset get_validation_transforms = hf_module.get_validation_transforms .. rst-class:: sphx-glr-script-out .. code-block:: none Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads. .. GENERATED FROM PYTHON SOURCE LINES 51-53 Load a pretrained segmentation model checkpoint from Hugging Face. .. GENERATED FROM PYTHON SOURCE LINES 53-75 .. code-block:: Python model_ckpt = hf_hub_download( repo_id="mapie-library/rooftop_segmentation", filename="best_model-v1.ckpt", repo_type="dataset", ) data_root = Path( snapshot_download( repo_id="mapie-library/rooftop_segmentation", repo_type="dataset", allow_patterns=["calib/**", "test/**"], ) ) DEVICE = "cuda" if torch.cuda.is_available() else "cpu" model = SegmentationLightningModule.load_from_checkpoint(model_ckpt) model.to(DEVICE) model.eval() print("Model loaded successfully!") .. rst-class:: sphx-glr-script-out .. code-block:: none Fetching ... files: 0it [00:00, ?it/s] Fetching ... files: 4it [00:00, 16.24it/s] Fetching ... files: 16it [00:00, 36.67it/s] Fetching ... files: 24it [00:00, 35.80it/s] Fetching ... files: 31it [00:00, 43.02it/s] Fetching ... files: 36it [00:01, 34.42it/s] Fetching ... files: 40it [00:01, 29.73it/s] Fetching ... files: 44it [00:01, 26.14it/s] Fetching ... files: 54it [00:01, 39.02it/s] Fetching ... files: 59it [00:01, 36.07it/s] Fetching ... files: 64it [00:01, 31.64it/s] Fetching ... files: 71it [00:02, 31.45it/s] Fetching ... files: 79it [00:02, 30.22it/s] Fetching ... files: 87it [00:02, 32.09it/s] Fetching ... files: 94it [00:02, 37.80it/s] Fetching ... files: 99it [00:02, 35.37it/s] Fetching ... files: 103it [00:03, 29.89it/s] Fetching ... files: 107it [00:03, 24.73it/s] Fetching ... files: 114it [00:03, 31.85it/s] Fetching ... files: 118it [00:03, 32.17it/s] Fetching ... files: 122it [00:03, 32.74it/s] Fetching ... files: 126it [00:03, 29.81it/s] Fetching ... files: 131it [00:04, 29.78it/s] Fetching ... files: 138it [00:04, 36.20it/s] Fetching ... files: 142it [00:04, 31.97it/s] Fetching ... files: 147it [00:04, 31.21it/s] Fetching ... files: 154it [00:04, 33.41it/s] Fetching ... files: 158it [00:04, 33.93it/s] Fetching ... files: 162it [00:05, 20.39it/s] Fetching ... files: 168it [00:05, 25.37it/s] Fetching ... files: 172it [00:05, 25.54it/s] Fetching ... files: 177it [00:05, 24.49it/s] Fetching ... files: 185it [00:06, 27.54it/s] Fetching ... files: 193it [00:06, 30.79it/s] Fetching ... files: 200it [00:06, 33.76it/s] Fetching ... files: 204it [00:06, 25.07it/s] Fetching ... files: 208it [00:06, 26.76it/s] Fetching ... files: 212it [00:06, 28.08it/s] Fetching ... files: 217it [00:07, 31.19it/s] Fetching ... files: 221it [00:07, 31.65it/s] Fetching ... files: 225it [00:07, 31.84it/s] Fetching ... files: 229it [00:07, 32.25it/s] Fetching ... files: 233it [00:07, 33.17it/s] Fetching ... files: 237it [00:07, 32.37it/s] Fetching ... files: 241it [00:07, 33.96it/s] Fetching ... files: 245it [00:07, 32.10it/s] Fetching ... files: 249it [00:08, 30.71it/s] Fetching ... files: 253it [00:08, 32.82it/s] Fetching ... files: 257it [00:08, 32.23it/s] Fetching ... files: 261it [00:08, 33.17it/s] Fetching ... files: 265it [00:08, 31.68it/s] Fetching ... files: 269it [00:08, 22.28it/s] Fetching ... files: 278it [00:08, 34.91it/s] Fetching ... files: 283it [00:09, 23.28it/s] Fetching ... files: 292it [00:09, 30.08it/s] Fetching ... files: 300it [00:09, 31.43it/s] Fetching ... files: 306it [00:09, 34.44it/s] Fetching ... files: 311it [00:10, 30.95it/s] Fetching ... files: 316it [00:10, 32.19it/s] Fetching ... files: 321it [00:10, 35.58it/s] Fetching ... files: 325it [00:10, 33.66it/s] Fetching ... files: 329it [00:10, 34.87it/s] Fetching ... files: 333it [00:10, 31.31it/s] Fetching ... files: 339it [00:10, 34.31it/s] Fetching ... files: 343it [00:11, 31.42it/s] Fetching ... files: 347it [00:11, 31.69it/s] Fetching ... files: 351it [00:11, 32.75it/s] Fetching ... files: 356it [00:11, 35.23it/s] Fetching ... files: 360it [00:11, 27.15it/s] Fetching ... files: 368it [00:11, 33.67it/s] Fetching ... files: 372it [00:11, 33.85it/s] Fetching ... files: 376it [00:12, 32.76it/s] Fetching ... files: 380it [00:12, 34.11it/s] Fetching ... files: 384it [00:16, 2.83it/s] Fetching ... files: 528it [00:17, 41.06it/s] Fetching ... files: 556it [00:17, 39.42it/s] Fetching ... files: 577it [00:18, 37.87it/s] Fetching ... files: 593it [00:19, 36.63it/s] Fetching ... files: 605it [00:19, 33.85it/s] Fetching ... files: 614it [00:20, 31.86it/s] Fetching ... files: 621it [00:20, 31.97it/s] Fetching ... files: 627it [00:20, 33.40it/s] Fetching ... files: 633it [00:20, 33.43it/s] Fetching ... files: 638it [00:20, 32.48it/s] Fetching ... files: 643it [00:20, 33.51it/s] Fetching ... files: 648it [00:21, 32.51it/s] Fetching ... files: 652it [00:21, 32.46it/s] Fetching ... files: 656it [00:21, 32.44it/s] Fetching ... files: 660it [00:21, 30.22it/s] Fetching ... files: 666it [00:21, 32.90it/s] Fetching ... files: 670it [00:21, 33.70it/s] Fetching ... files: 674it [00:21, 32.70it/s] Fetching ... files: 678it [00:21, 33.04it/s] Fetching ... files: 682it [00:22, 26.27it/s] Fetching ... files: 689it [00:22, 32.57it/s] Fetching ... files: 693it [00:22, 33.77it/s] Fetching ... files: 697it [00:22, 32.55it/s] Fetching ... files: 701it [00:22, 23.19it/s] Fetching ... files: 705it [00:23, 24.45it/s] Fetching ... files: 712it [00:23, 33.17it/s] Fetching ... files: 716it [00:23, 33.99it/s] Fetching ... files: 720it [00:23, 32.88it/s] Fetching ... files: 724it [00:23, 33.76it/s] Fetching ... files: 728it [00:23, 31.18it/s] Fetching ... files: 733it [00:23, 34.51it/s] Fetching ... files: 737it [00:23, 29.86it/s] Fetching ... files: 742it [00:24, 32.40it/s] Fetching ... files: 746it [00:24, 33.00it/s] Fetching ... files: 750it [00:24, 29.93it/s] Fetching ... files: 754it [00:24, 30.96it/s] Fetching ... files: 758it [00:24, 31.78it/s] Fetching ... files: 762it [00:24, 32.17it/s] Fetching ... files: 766it [00:24, 33.13it/s] Fetching ... files: 770it [00:24, 33.71it/s] Fetching ... files: 774it [00:25, 33.64it/s] Fetching ... files: 778it [00:25, 34.50it/s] Fetching ... files: 782it [00:25, 33.65it/s] Fetching ... files: 786it [00:25, 31.19it/s] Fetching ... files: 790it [00:25, 30.88it/s] Fetching ... files: 794it [00:25, 31.81it/s] Fetching ... files: 798it [00:25, 33.07it/s] Fetching ... files: 802it [00:26, 21.94it/s] Fetching ... files: 806it [00:26, 24.93it/s] Fetching ... files: 810it [00:26, 27.11it/s] Fetching ... files: 816it [00:26, 33.49it/s] Fetching ... files: 820it [00:26, 32.04it/s] Fetching ... files: 825it [00:26, 30.65it/s] Fetching ... files: 831it [00:26, 35.40it/s] Fetching ... files: 835it [00:27, 22.95it/s] Fetching ... files: 844it [00:27, 33.81it/s] Fetching ... files: 849it [00:27, 32.01it/s] Fetching ... files: 854it [00:27, 30.98it/s] Fetching ... files: 858it [00:27, 31.54it/s] Fetching ... files: 862it [00:28, 27.05it/s] Fetching ... files: 869it [00:28, 33.06it/s] Fetching ... files: 873it [00:28, 33.94it/s] Fetching ... files: 877it [00:28, 33.48it/s] Fetching ... files: 882it [00:28, 35.85it/s] Fetching ... files: 888it [00:28, 39.37it/s] Fetching ... files: 893it [00:28, 36.18it/s] Fetching ... files: 897it [00:28, 35.69it/s] Fetching ... files: 901it [00:29, 32.32it/s] Fetching ... files: 907it [00:29, 37.82it/s] Fetching ... files: 911it [00:29, 35.33it/s] Fetching ... files: 916it [00:29, 34.67it/s] Fetching ... files: 920it [00:29, 33.04it/s] Fetching ... files: 925it [00:29, 29.80it/s] Fetching ... files: 932it [00:29, 35.86it/s] Fetching ... files: 936it [00:30, 36.02it/s] Fetching ... files: 940it [00:30, 34.87it/s] Fetching ... files: 944it [00:30, 32.05it/s] Fetching ... files: 952it [00:30, 41.82it/s] Fetching ... files: 958it [00:30, 44.07it/s] Fetching ... files: 965it [00:30, 43.85it/s] Fetching ... files: 970it [00:30, 42.64it/s] Fetching ... files: 975it [00:30, 43.09it/s] Fetching ... files: 981it [00:31, 43.61it/s] Fetching ... files: 986it [00:31, 40.50it/s] Fetching ... files: 991it [00:31, 37.13it/s] Fetching ... files: 995it [00:31, 36.08it/s] Fetching ... files: 1000it [00:31, 34.96it/s] Fetching ... files: 1006it [00:31, 39.79it/s] Fetching ... files: 1011it [00:31, 36.84it/s] Fetching ... files: 1015it [00:32, 27.60it/s] Fetching ... files: 1019it [00:32, 25.70it/s] Fetching ... files: 1026it [00:32, 24.43it/s] Fetching ... files: 1031it [00:32, 27.16it/s] Fetching ... files: 1036it [00:33, 27.76it/s] Fetching ... files: 1041it [00:33, 29.31it/s] Fetching ... files: 1045it [00:33, 27.40it/s] Fetching ... files: 1048it [00:33, 23.11it/s] Fetching ... files: 1055it [00:33, 24.99it/s] Fetching ... files: 1063it [00:33, 34.32it/s] Fetching ... files: 1068it [00:34, 28.55it/s] Fetching ... files: 1074it [00:34, 30.02it/s] Fetching ... files: 1078it [00:34, 25.58it/s] Fetching ... files: 1085it [00:34, 30.43it/s] Fetching ... files: 1089it [00:35, 23.82it/s] Fetching ... files: 1097it [00:35, 25.97it/s] Fetching ... files: 1106it [00:35, 31.48it/s] Fetching ... files: 1113it [00:35, 36.86it/s] Fetching ... files: 1118it [00:35, 28.09it/s] Fetching ... files: 1122it [00:36, 28.80it/s] Fetching ... files: 1129it [00:36, 35.79it/s] Fetching ... files: 1134it [00:36, 33.02it/s] Fetching ... files: 1138it [00:36, 26.26it/s] Fetching ... files: 1144it [00:36, 29.25it/s] Fetching ... files: 1148it [00:36, 24.97it/s] Fetching ... files: 1154it [00:37, 31.15it/s] Model loaded successfully! .. GENERATED FROM PYTHON SOURCE LINES 76-80 Next, two datasets are loaded from Hugging Face: a calibration set used to estimate risks and select an appropriate decision threshold, and a test set reserved for evaluating controlled predictions on unseen data. .. GENERATED FROM PYTHON SOURCE LINES 80-107 .. code-block:: Python CALIB_IMAGES_DIR = data_root / "calib" / "images" CALIB_MASKS_DIR = data_root / "calib" / "masks" TEST_IMAGES_DIR = data_root / "test" / "images" TEST_MASKS_DIR = data_root / "test" / "masks" calib_dataset = RoofSegmentationDataset( images_dir=CALIB_IMAGES_DIR, masks_dir=CALIB_MASKS_DIR, transform=get_validation_transforms( image_size=(256, 256) ), # reshape images to reduce memory usage ) calib_loader = torch.utils.data.DataLoader(calib_dataset, batch_size=16) test_dataset = RoofSegmentationDataset( images_dir=TEST_IMAGES_DIR, masks_dir=TEST_MASKS_DIR, transform=get_validation_transforms( image_size=(256, 256) ), # reshape images to reduce memory usage ) test_loader = torch.utils.data.DataLoader(test_dataset, batch_size=16) print(f"Calibration set size: {len(calib_dataset)}") print(f"Test set size: {len(test_dataset)}") .. rst-class:: sphx-glr-script-out .. code-block:: none Dataset initialized with 289 image-mask pairs Dataset initialized with 288 image-mask pairs Calibration set size: 289 Test set size: 288 .. GENERATED FROM PYTHON SOURCE LINES 108-112 A `SemanticSegmentationController` is instantiated to control the precision risk (1 - precision) and automatically select a threshold that meets the target precision level with high confidence. .. GENERATED FROM PYTHON SOURCE LINES 112-124 .. code-block:: Python TARGET_PRECISION = 0.7 CONFIDENCE_LEVEL = 0.9 precision_controller = SemanticSegmentationController( predict_function=model, risk="precision", target_level=TARGET_PRECISION, confidence_level=CONFIDENCE_LEVEL, ) print(f"Target precision level: {TARGET_PRECISION}") .. rst-class:: sphx-glr-script-out .. code-block:: none Target precision level: 0.7 .. GENERATED FROM PYTHON SOURCE LINES 125-129 During calibration, the controller evaluates the precision risk over a range of thresholds on the calibration dataset in order to identify an optimal decision threshold. .. GENERATED FROM PYTHON SOURCE LINES 129-149 .. code-block:: Python for i, sample in enumerate(calib_loader): image, mask = sample["image"], sample["mask"] image = image.to(DEVICE) mask = mask.cpu().numpy() # Filter images that contain masks has_mask = mask.sum(axis=(1, 2)) > 0 image = image[has_mask] mask = mask[has_mask] if len(image) > 0: with torch.no_grad(): precision_controller.compute_risks(image, mask) # Compute the best threshold precision_controller.compute_best_predict_param() print("Controller calibrated successfully!") print(f"Optimal threshold found: {precision_controller.best_predict_param[0]:.4f}") .. rst-class:: sphx-glr-script-out .. code-block:: none Controller calibrated successfully! Optimal threshold found: 0.8600 .. GENERATED FROM PYTHON SOURCE LINES 150-153 Controlled predictions are visually inspected on a few test images to illustrate the effect of MAPIE thresholding compared to raw model outputs. .. GENERATED FROM PYTHON SOURCE LINES 153-217 .. code-block:: Python def denormalize_image(tensor_image: torch.Tensor) -> np.ndarray: """Denormalize image tensor for visualization.""" mean = np.array([0.485, 0.456, 0.406]) std = np.array([0.229, 0.224, 0.225]) image = tensor_image.cpu().numpy().transpose(1, 2, 0) image = std * image + mean image = np.clip(image, 0, 1) return image # Select random test images NUM_EXAMPLES = 4 np.random.seed(0) # Get indices of images with masks indices_with_masks = [] for idx in range(len(test_dataset)): sample = test_dataset[idx] if sample["mask"].sum() > 0: indices_with_masks.append(idx) random_indices = np.random.choice(indices_with_masks, NUM_EXAMPLES, replace=False) fig, axes = plt.subplots(2, NUM_EXAMPLES, figsize=(4 * NUM_EXAMPLES, 10)) for col, idx in enumerate(random_indices): sample = test_dataset[idx] image = sample["image"].unsqueeze(0).to(DEVICE) mask = sample["mask"].cpu().numpy() with torch.no_grad(): # Get MAPIE prediction mapie_pred = precision_controller.predict(image)[0] # Denormalize image img_display = denormalize_image(sample["image"]) # Plot original image (top row) axes[0, col].imshow(img_display) axes[0, col].set_title("Original Image") axes[0, col].axis("off") # Plot MAPIE prediction with correct pixels in white and false positives in red (bottom row) pred_visualization = np.zeros((*mapie_pred[0].shape, 3)) true_positives = mask * mapie_pred[0] pred_visualization[true_positives > 0] = [1, 1, 1] false_positives = (1 - mask) * mapie_pred[0] pred_visualization[false_positives > 0] = [1, 0, 0] axes[1, col].imshow(pred_visualization) axes[1, col].set_title( f"MAPIE Prediction (threshold={precision_controller.best_predict_param[0]:.2f})\n" "White: Correct | Red: False Positives" ) axes[1, col].axis("off") plt.tight_layout() plt.show() .. image-sg:: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_001.png :alt: Original Image, Original Image, Original Image, Original Image, MAPIE Prediction (threshold=0.86) White: Correct | Red: False Positives, MAPIE Prediction (threshold=0.86) White: Correct | Red: False Positives, MAPIE Prediction (threshold=0.86) White: Correct | Red: False Positives, MAPIE Prediction (threshold=0.86) White: Correct | Red: False Positives :srcset: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 218-222 The controller is finally evaluated on the test set by computing the achieved precision on each image to verify that the target precision level is satisfied on unseen data. .. GENERATED FROM PYTHON SOURCE LINES 222-248 .. code-block:: Python precisions_list = [] for i, sample in enumerate(test_loader): image, mask = sample["image"], sample["mask"] image = image.to(DEVICE) mask = mask.cpu().numpy() # Filter images with masks has_mask = mask.sum(axis=(1, 2)) > 0 image = image[has_mask] mask = mask[has_mask] if len(image) > 0: with torch.no_grad(): pred = precision_controller.predict(image) # Compute precision for each image for j in range(len(image)): tp = (mask[j] * pred[j]).sum() fp = ((1 - mask[j]) * pred[j]).sum() precision = tp / (tp + fp + 1e-8) precisions_list.append(precision) precisions_array = np.array(precisions_list) .. GENERATED FROM PYTHON SOURCE LINES 249-252 Finally, the distribution of precision values over the test set is plotted to summarize the controlled performance. .. GENERATED FROM PYTHON SOURCE LINES 252-279 .. code-block:: Python fig, ax = plt.subplots(figsize=(10, 6)) ax.hist(precisions_array, bins=30, alpha=0.7, color="steelblue", edgecolor="black") ax.axvline( TARGET_PRECISION, color="red", linestyle="--", linewidth=2, label=f"Target Precision ({TARGET_PRECISION})", ) ax.axvline( precisions_array.mean(), color="orange", linestyle="--", linewidth=2, label=f"Mean Precision ({precisions_array.mean():.3f})", ) ax.set_xlabel("Precision", fontsize=12) ax.set_ylabel("Frequency", fontsize=12) ax.set_title("Distribution of Precision on Test Set", fontsize=14, fontweight="bold") ax.legend(fontsize=10) ax.grid(True, alpha=0.3) plt.tight_layout() plt.show() .. image-sg:: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_002.png :alt: Distribution of Precision on Test Set :srcset: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 280-284 The histogram shows that most test images achieve or exceed the target precision level, illustrating the effectiveness of MAPIE’s risk control for semantic segmentation tasks. .. GENERATED FROM PYTHON SOURCE LINES 286-289 Bootstrap the mean precision over different samplings of the test set (resampling images with replacement). .. GENERATED FROM PYTHON SOURCE LINES 289-337 .. code-block:: Python N_BOOTSTRAP = 2000 BOOTSTRAP_SEED = 123 rng = np.random.default_rng(BOOTSTRAP_SEED) bootstrap_means = np.empty(N_BOOTSTRAP, dtype=float) n = precisions_array.size for b in range(N_BOOTSTRAP): bootstrap_sample = rng.choice(precisions_array, size=n, replace=True) bootstrap_means[b] = bootstrap_sample.mean() delta = round(1 - CONFIDENCE_LEVEL, 2) quantile_confidence = np.quantile(bootstrap_means, delta) print(f"Bootstrap {delta}-th quantile: {quantile_confidence:.4f}") fig, ax = plt.subplots(figsize=(10, 6)) ax.hist( bootstrap_means, bins=40, alpha=0.7, color="slateblue", edgecolor="black", ) ax.axvline( TARGET_PRECISION, color="orange", linestyle="--", linewidth=2, label=f"Target precision ({TARGET_PRECISION:.2f})", ) ax.axvline( quantile_confidence, color="green", linestyle="--", linewidth=2, label=f"Bootstrap {delta}-th quantile ({quantile_confidence:.3f})", ) ax.set_xlabel("Bootstrap mean precision", fontsize=12) ax.set_ylabel("Frequency", fontsize=12) ax.set_title( "Bootstrap distribution of mean precision (test set resampling)", fontsize=14, fontweight="bold", ) ax.legend(fontsize=10) ax.grid(True, alpha=0.3) plt.tight_layout() plt.show() .. image-sg:: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_003.png :alt: Bootstrap distribution of mean precision (test set resampling) :srcset: /examples_risk_control/2-advanced-analysis/images/sphx_glr_plot_semantic_segmentation_precision_control_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Bootstrap 0.1-th quantile: 0.7689 .. rst-class:: sphx-glr-timing **Total running time of the script:** (2 minutes 12.829 seconds) .. _sphx_glr_download_examples_risk_control_2-advanced-analysis_plot_semantic_segmentation_precision_control.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_semantic_segmentation_precision_control.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_semantic_segmentation_precision_control.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_semantic_segmentation_precision_control.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_