Create a README file for the model.
data_description
can be used to add more information about the content of the data the model was trained on.
Parameters:
Name | Type | Description | Default |
config | Configuration | | required |
careamics_version | str | | required |
data_description | str | | required |
Returns:
Source code in src/careamics/model_io/bioimage/_readme_factory.py
| def readme_factory(
config: Configuration,
careamics_version: str,
data_description: str,
) -> Path:
"""Create a README file for the model.
`data_description` can be used to add more information about the content of the
data the model was trained on.
Parameters
----------
config : Configuration
CAREamics configuration.
careamics_version : str
CAREamics version.
data_description : str
Description of the data.
Returns
-------
Path
Path to the README file.
"""
# create file
# TODO use tempfile as in the bmz_io module
with cwd(get_careamics_home()):
readme = Path("README.md")
readme.touch()
# algorithm pretty name
algorithm_flavour = config.get_algorithm_friendly_name()
algorithm_pretty_name = algorithm_flavour + " - CAREamics"
description = [f"# {algorithm_pretty_name}\n\n"]
# data description
description.append("## Data description\n\n")
description.append(data_description)
description.append("\n\n")
# algorithm description
description.append("## Algorithm description:\n\n")
description.append(config.get_algorithm_description())
description.append("\n\n")
# configuration description
description.append("## Configuration\n\n")
description.append(
f"{algorithm_flavour} was trained using CAREamics (version "
f"{careamics_version}) using the following configuration:\n\n"
)
description.append(_yaml_block(yaml.dump(config.model_dump(exclude_none=True))))
description.append("\n\n")
# validation
description.append("# Validation\n\n")
description.append(
"In order to validate the model, we encourage users to acquire a "
"test dataset with ground-truth data. Comparing the ground-truth data "
"with the prediction allows unbiased evaluation of the model performances. "
"This can be done for instance by using metrics such as PSNR, SSIM, or"
"MicroSSIM. In the absence of ground-truth, inspecting the residual image "
"(difference between input and predicted image) can be helpful to identify "
"whether real signal is removed from the input image.\n\n"
)
# references
reference = config.get_algorithm_references()
if reference != "":
description.append("## References\n\n")
description.append(reference)
description.append("\n\n")
# links
description.append(
"# Links\n\n"
"- [CAREamics repository](https://github.com/CAREamics/careamics)\n"
"- [CAREamics documentation](https://careamics.github.io/)\n"
)
readme.write_text("".join(description))
return readme.absolute()
|