Skip to content

Commit

Permalink
add support for saving architectures directly in bioimageio format
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Feb 18, 2025
1 parent 9987e51 commit 1d26b77
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions dacapo/experiments/architectures/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
from funlib.geometry import Coordinate
import torch

from pathlib import Path
from abc import ABC, abstractmethod

from bioimageio.spec.model.v0_5 import (
Author,
CiteEntry,
)


@attr.s
class ArchitectureConfig(ABC):
Expand Down Expand Up @@ -78,3 +84,27 @@ def scale(self, input_voxel_size: Coordinate) -> Coordinate:
Method to scale the input voxel size as required by the architecture.
"""
return input_voxel_size

def save_bioimage_io_model(
self,
path: Path,
authors: list[Author],
cite: list[CiteEntry] | None = None,
license: str = "MIT",
input_test_image_path: Path | None = None,
output_test_image_path: Path | None = None,
checkpoint: int | str | None = None,
in_voxel_size: Coordinate | None = None,
):
from dacapo.experiments.run_config import RunConfig
run = RunConfig(name=f"{self.name}-bioimage-io", architecture_config=self)
run.save_bioimage_io_model(
path,
authors=authors,
cite=cite,
license=license,
input_test_image_path=input_test_image_path,
output_test_image_path=output_test_image_path,
checkpoint=checkpoint,
in_voxel_size=in_voxel_size,
)

0 comments on commit 1d26b77

Please sign in to comment.