{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The calibration procedure uses a self-supervised mean-square-error loss to evaluate the performance of J-invariant versions of "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "denoise_function"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The minimizer of the self-supervised loss is also the minimizer of the ground-truth loss (i.e., the true MSE error) [1]. The returned function can be used on the original noisy image, or other images with similar characteristics."
            }
          ]
        },
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Text",
                    "__tag": 4046,
                    "value": "Increasing the stride increases the performance of "
                  },
                  {
                    "__type": "CrossRef",
                    "__tag": 4002,
                    "value": "best_denoise_function",
                    "reference": {
                      "__type": "RefInfo",
                      "__tag": 4000,
                      "module": null,
                      "version": null,
                      "kind": "local",
                      "path": "best_denoise_function"
                    },
                    "kind": "local"
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "at the expense of increasing its runtime. It has no effect on the runtime  of the calibration."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "best_denoise_function",
              "annotation": "function",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The optimal J-invariant version of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "denoise_function"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "If `extra_output` is True, the following tuple is also returned:",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "(parameters_tested, losses)",
              "annotation": "tuple (list of dict, list of int)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "List of parameters tested for "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "denoise_function"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", as a dictionary of kwargs Self-supervised loss for each set of parameters in "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "parameters_tested",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calibrate a denoising function and return optimal J-invariant version."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "image",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input data to be denoised (converted using "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "img_as_float",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "denoise_function",
              "annotation": "function",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Denoising function to be calibrated."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "denoise_parameters",
              "annotation": "dict of list",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Ranges of parameters for "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "denoise_function"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to be calibrated over."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "stride",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Stride used in masking procedure that converts "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "denoise_function"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to J-invariance."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "approximate_loss",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Whether to approximate the self-supervised loss used to evaluate the denoiser by only computing it on one masked version of the image. If False, the runtime will be a factor of "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "stride**image.ndim",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " longer."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extra_output",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True, return parameters and losses in addition to the calibrated denoising function"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The returned function is partially evaluated with optimal parameter values set for denoising the input image."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/_skimage2/restoration/j_invariant.py",
  "item_line": 200,
  "item_type": "function",
  "aliases": [
    "skimage.restoration.calibrate_denoiser"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from skimage import color, data\nfrom skimage.restoration import denoise_tv_chambolle\nimport numpy as np\nimg = color.rgb2gray(data.astronaut()[:50, :50])\nrng = np.random.default_rng()\nnoisy = img + 0.5 * img.std() * rng.standard_normal(img.shape)\nparameters = {'weight': np.arange(0.01, 0.3, 0.02)}\ndenoising_function = calibrate_denoiser(noisy, denoise_tv_chambolle,\n                                        denoise_parameters=parameters)\ndenoised_img = denoising_function(img)\n",
        "execution_status": "success",
        "out": ""
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "image",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "denoise_function",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "denoise_parameters",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "stride",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "4"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "approximate_loss",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "True"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "extra_output",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "False"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "calibrate_denoiser"
  },
  "references": [
    ".. [1] J. Batson & L. Royer. Noise2Self: Blind Denoising by Self-Supervision,",
    "       International Conference on Machine Learning, p. 524-533 (2019)."
  ],
  "qa": "skimage.restoration.j_invariant:calibrate_denoiser",
  "arbitrary": [],
  "local_refs": [
    "(parameters_tested",
    "approximate_loss",
    "best_denoise_function",
    "denoise_function",
    "denoise_parameters",
    "extra_output",
    "image",
    "losses)",
    "stride"
  ]
}