Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed Feb 18, 2025
1 parent 19bae9e commit 61f3e3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 46 deletions.
8 changes: 4 additions & 4 deletions dacapo/experiments/architectures/model_zoo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from funlib.geometry import Coordinate

from bioimageio.core import load_description_and_test
from bioimageio.core import load_description
from bioimageio.core.model_adapters._pytorch_model_adapter import PytorchModelAdapter
from bioimageio.spec import InvalidDescr
from bioimageio.spec.model.v0_5 import (
Expand All @@ -28,7 +28,7 @@ class ModelZooConfig(ArchitectureConfig):
Support is currently limited to models saved with the `PytorchStateDictWeightsDescr`.
See more info here: https://bioimage-io.github.io/spec-bioimage-io/bioimageio/spec/model/v0_5.html#PytorchStateDictWeightsDescr
We try to support all model_id formats that are supported by the `bioimageio.core` `load_description_and_test` function.
We try to support all model_id formats that are supported by the `bioimageio.core` `load_description` function.
However there seem to be some cases that fail. You may receive an `InvalidDescr` error when trying to load a model from
a downloaded rdf file. In this case downloading the zipped model, or using the models name e.g. "affable-shark"
should work.
Expand Down Expand Up @@ -80,11 +80,11 @@ def model_description(self) -> ModelDescr:
if isinstance(self.model_id, Path) and self.model_id.suffix == ".zip":
with zipfile.ZipFile(self.model_id, "r") as zip_ref:
zip_ref.extractall(Path(f"{self.model_id}.unzip"))
self._model_description = load_description_and_test(
self._model_description = load_description(
Path(f"{self.model_id}.unzip")
)
else:
self._model_description = load_description_and_test(self.model_id)
self._model_description = load_description(self.model_id)
if isinstance(self._model_description, InvalidDescr):
raise Exception("Invalid model description")
return self._model_description
Expand Down
44 changes: 2 additions & 42 deletions dacapo/experiments/tasks/predictors/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,9 @@ class Predictor(ABC):
def create_model(self, architecture: "Architecture") -> "Model":
"""
Given a training architecture, create a model for this predictor.
This is usually done by appending extra layers to the output of the
This is usually done by appending a single final conv layer to the output of the
architecture to get the output tensor of the architecture into the
right shape for this predictor.
Args:
architecture: The training architecture.
Returns:
The model.
Raises:
NotImplementedError: This method is not implemented.
Examples:
>>> predictor.create_model(architecture)
"""
pass

Expand All @@ -58,7 +48,7 @@ def create_target(self, gt: Array) -> Array:
compared to the prediction (i.e., the output of the model). Depending
on the predictor, the target can therefore be different from the
ground-truth (e.g., an instance segmentation ground-truth would have to
be converted into boundaries, if the model is predicting boundaries).
be converted into affinities, if the model is predicting affinities).
By default, it is assumed that the spatial dimensions of ground-truth
and target are the same.
Expand All @@ -67,16 +57,6 @@ def create_target(self, gt: Array) -> Array:
(e.g., because it predicts the distance to a boundary, up to a certain
threshold), you can request a larger ground-truth region. See method
``gt_region_for_roi``.
Args:
gt: The ground-truth array.
Returns:
The target array.
Raises:
NotImplementedError: This method is not implemented.
Examples:
>>> predictor.create_target(gt)
"""
pass

Expand Down Expand Up @@ -119,31 +99,11 @@ def gt_region_for_roi(self, target_spec):
Overwrite this method to request ground-truth in a larger ROI, as
needed.
Args:
target_spec: The ROI for which the target is requested.
Returns:
The ROI for which the ground-truth is requested.
Raises:
NotImplementedError: This method is not implemented.
Examples:
>>> predictor.gt_region_for_roi(target_spec)
"""
return target_spec

def padding(self, gt_voxel_size: Coordinate) -> Coordinate:
"""
Return the padding needed for the ground-truth array.
Args:
gt_voxel_size: The voxel size of the ground-truth array.
Returns:
The padding needed for the ground-truth array.
Raises:
NotImplementedError: This method is not implemented.
Examples:
>>> predictor.padding(gt_voxel_size)
"""
return Coordinate((0,) * gt_voxel_size.dims)

0 comments on commit 61f3e3f

Please sign in to comment.