Skip to content

Commit

Permalink
Merge branch 'basic_tutorial' into fix_local_predict
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink authored Oct 16, 2024
2 parents 3abcf96 + 8de17a3 commit 689a5a8
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ jobs:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: install dacapo
# run: pip install .[docs]
run: pip install sphinx-autodoc-typehints sphinx-autoapi sphinx-click sphinx-rtd-theme myst-parser
run: pip install sphinx-autodoc-typehints sphinx-autoapi sphinx-click sphinx-rtd-theme myst-parser jupytext ipykernel nbsphinx
- name: parse notebooks
run: jupytext --to notebook --execute ./docs/source/notebooks/*.py
- name: remove notebook scripts
run: rm ./docs/source/notebooks/*.py
- name: Build and Commit
uses: sphinx-notes/pages@v2
with:
Expand Down
19 changes: 12 additions & 7 deletions dacapo/experiments/tasks/losses/affinities_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ def compute(self, prediction, target, weight):
weight[:, self.num_affinities :, ...],
)

return (
torch.nn.BCEWithLogitsLoss(reduction="none")(affs, affs_target)
* affs_weight
).mean() + self.lsds_to_affs_weight_ratio * (
torch.nn.MSELoss(reduction="none")(torch.nn.Sigmoid()(aux), aux_target)
* aux_weight
).mean()
if aux.shape[1] == 0:
return torch.nn.BCEWithLogitsLoss(reduction="none")(
affs, affs_target
).mean()
else:
return (
torch.nn.BCEWithLogitsLoss(reduction="none")(affs, affs_target)
* affs_weight
).mean() + self.lsds_to_affs_weight_ratio * (
torch.nn.MSELoss(reduction="none")(torch.nn.Sigmoid()(aux), aux_target)
* aux_weight
).mean()
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

overview
install
notebooks/minimal_tutorial
tutorial
docker
aws
Expand Down
Loading

0 comments on commit 689a5a8

Please sign in to comment.