bioimage-io / collection-bioimage-io

(deprecated in favor of bioimage-io/collection) RDF collection for BioImage.IO
5 stars 9 forks source link

Update Mitochondria TOM20 artificial labelling - pix2pix #695

Closed bioimageiobot closed 5 months ago

bioimageiobot commented 6 months ago

This is an automatic PR created by the @bioimageiobot regarding changes to the resource item 10.5281/zenodo.10366411. The following version(s) will be added:

Please review the changes and make sure the new item or version(s) pass the following check list:

Maintainers: @esgomezm

Note: If you updated or re-uploaded another version for the current item on Zenodo, this PR won't be changed automatically. To proceed, you can do the following:

  1. Block this version, but keep looking for future versions: Edit the current resource.yaml and keep the top-level status field as accepted, but change the status under the current version to blocked.
  2. Accept this version and keep looking for future versions: Merge this PR for now.
  3. Keep proposed version(s) (and this resource in general if it is new) as pending: Close this PR without merging.

    Then wait for the CI on the main branch to complete. It should detect the new version(s) and create another PR for the new version(s).

Previous PRs of this resource: none

esgomezm commented 6 months ago

Hi hi,

I think the file is complaining about the attachments:

attachments:
  files: [per_sample_scale_range.ijm, scale_linear.ijm, "pix2pix-tom20-11122023_training_report.pdf"]

Should they be relative paths? I added the pdf but both macros where given like this directly by the bioimageio.core build_model @Tomaz-Vieira @FynnBe

FynnBe commented 6 months ago

Hmmm. Looks like there is either an old core version in use that doesn't have the updates for the new zenodo API or some updates are missing. I'll try to take a look asap

FynnBe commented 6 months ago

Well, it's correctly using the latest versions:

  bioimageio.core         0.5.11        pyhd8ed1ab_0           conda-forge
  bioimageio.spec         0.4.9.post5   pyhd8ed1ab_0           conda-forge
esgomezm commented 6 months ago

I used bioimageio.core==0.5.11 to build the model. Then, what's the way to go?

esgomezm commented 6 months ago

Halo @oeway this is a big issue, any idea or roadmap to change it? We really need to have this one solved for different publications

FynnBe commented 6 months ago

I found (and hopefully also fixed) the issue: The static validation step used bioimageio.spec 0.4.9.post1 (instead of 0.4.9.post5) (it was installed without any pinning). now post5 is installed correctly

FynnBe commented 6 months ago

Now there is a different, much more interesting error:

terminate called after throwing an instance of 'c10::Error'
  what():  isTuple()INTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1640811723911/work/aten/src/ATen/core/ivalue_inl.h":1400, please report a bug to PyTorch. Expected Tuple but got String
Exception raised from toTuple at /opt/conda/conda-bld/pytorch_1640811723911/work/aten/src/ATen/core/ivalue_inl.h:1400 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x42 (0x7fb57a839d62 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x5b (0x7fb57a83668b in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #2: c10::detail::torchInternalAssertFail(char const*, char const*, unsigned int, char const*, std::string const&) + 0x3e (0x7fb57a836bbe in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libc10.so)
frame #3: <unknown function> + 0x38cb7d7 (0x7fb57e4cb7d7 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so)
frame #4: <unknown function> + 0x38cc875 (0x7fb57e4cc875 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so)
frame #5: torch::jit::SourceRange::highlight(std::ostream&) const + 0x36 (0x7fb57bb5b166 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so)
frame #6: torch::jit::ErrorReport::what() const + 0x2c5 (0x7fb57bb3e075 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so)
frame #7: <unknown function> + 0x[27](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:7:28)80be (0x7fb5862780be in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_python.so)
frame #8: <unknown function> + 0x[28](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:7:29)6a35 (0x7fb586286a35 in /home/runner/micromamba/envs/10366412/lib/python3.9/site-packages/torch/lib/libtorch_python.so)
<omitting python frames>

/home/runner/work/_temp/0031de1c-2434-43dc-a117-1b0d6e921473.sh: line 1:  2[30](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:7:31)0 Aborted                 (core dumped)

looks like a cpu/gpu difference or maybe a pytorch version mismatch.

The complete mamba env is

List of packages in environment: "/home/runner/micromamba/envs/10366412" Name Version Build Channel ──────────────────────────────────────────────────────────────────────────── _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_kmp_llvm conda-forge aom 3.7.1 h59595ed_0 conda-forge bioimageio.core 0.5.11 pyhd8ed1ab_0 conda-forge bioimageio.spec 0.4.9.post5 pyhd8ed1ab_0 conda-forge blas 2.120 mkl conda-forge blas-devel 3.9.0 20_linux64_mkl conda-forge blosc 1.21.5 h0f2a231_0 conda-forge brotli 1.1.0 hd590300_1 conda-forge brotli-bin 1.1.0 hd590300_1 conda-forge brotli-python 1.1.0 py39h3d6467e_1 conda-forge brunsli 0.1 h9c3ff4c_0 conda-forge bzip2 1.0.8 hd590300_5 conda-forge c-blosc2 2.11.3 hb4ffafa_0 conda-forge ca-certificates 2023.11.17 hbcca054_0 conda-forge certifi 2023.11.17 pyhd8ed1ab_0 conda-forge charls 2.4.2 h59595ed_0 conda-forge charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge click 8.1.7 unix_pyh707e725_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge cpuonly 2.0 0 pytorch dav1d 1.2.1 hd590300_0 conda-forge freetype 2.12.1 h267a509_2 conda-forge giflib 5.2.1 h0b41bf4_3 conda-forge icu 73.2 h59595ed_0 conda-forge idna 3.6 pyhd8ed1ab_0 conda-forge imagecodecs 2023.9.18 py39hf9b8f0e_2 conda-forge imageio 2.33.1 pyh8c1a49c_0 conda-forge jxrlib 1.1 h7f98852_2 conda-forge lcms2 2.16 hb7c19ff_0 conda-forge ld_impl_linux-64 2.40 h[417](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:4:423)32ed_0 conda-forge lerc 4.0.0 h27087fc_0 conda-forge libaec 1.1.2 h59595ed_1 conda-forge libavif16 1.0.3 hef5bec9_1 conda-forge libblas 3.9.0 20_linux64_mkl conda-forge libbrotlicommon 1.1.0 hd590300_1 conda-forge libbrotlidec 1.1.0 hd590300_1 conda-forge libbrotlienc 1.1.0 hd590300_1 conda-forge libcblas 3.9.0 20_linux64_mkl conda-forge libdeflate 1.19 hd590300_0 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.2.0 h807b86a_3 conda-forge libgfortran-ng 13.2.0 h69a702a_3 conda-forge libgfortran5 13.2.0 ha[464](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:4:470)6dd_3 conda-forge libhwloc 2.9.3 default_h554bfaf_1009 conda-forge libiconv 1.17 hd590300_2 conda-forge libjpeg-turbo 3.0.0 hd590300_1 conda-forge liblapack 3.9.0 20_linux64_mkl conda-forge liblapacke 3.9.0 20_linux64_mkl conda-forge libnsl 2.0.1 hd590300_0 conda-forge libpng 1.6.39 h753d276_0 conda-forge libsqlite 3.44.2 h2797004_0 conda-forge libstdcxx-ng 13.2.0 h7e041cc_3 conda-forge libtiff 4.6.0 ha9c0a0a_2 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libuv 1.46.0 hd590300_0 conda-forge libwebp-base 1.3.2 hd590300_0 conda-forge libxcb 1.15 h0b41bf4_0 conda-forge libxml2 2.11.6 h232c23b_0 conda-forge libzlib 1.2.13 hd590300_5 conda-forge libzopfli 1.0.3 h9c3ff4c_0 conda-forge llvm-openmp 17.0.6 h4dfa4b3_0 conda-forge lz4-c 1.9.4 hcb278e6_0 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge marshmallow 3.20.1 pyhd8ed1ab_0 conda-forge marshmallow-jsonschema 0.13.0 pyhd8ed1ab_0 conda-forge marshmallow-union 0.1.15.post1 pyhd8ed1ab_0 conda-forge mdurl 0.1.0 pyhd8ed1ab_0 conda-forge mkl 2023.2.0 h84fe81f_50496 conda-forge mkl-devel 2023.2.0 ha770c72_50496 conda-forge mkl-include 2023.2.0 h84fe81f_50496 conda-forge ncurses 6.4 h59595ed_2 conda-forge numpy 1.26.2 py39h[474](https://github.com/bioimage-io/collection-bioimage-io/actions/runs/7305314870/job/19908788694?pr=695#step:4:480)f0d3_0 conda-forge openjpeg 2.5.0 h488ebb8_3 conda-forge openssl 3.2.0 hd590300_1 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge pandas 2.1.4 py39hddac248_0 conda-forge pillow 10.1.0 py39had0adad_0 conda-forge pip 23.3.2 pyhd8ed1ab_0 conda-forge pthread-stubs 0.4 h36c2ea0_1001 conda-forge pygments 2.17.2 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge python 3.9.18 h0755675_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-stdnum 1.19 pyhd8ed1ab_0 conda-forge python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge python_abi 3.9 4_cp39 conda-forge pytorch 1.10.2 py3.9_cpu_0 pytorch pytorch-mutex 1.0 cpu pytorch pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge pyyaml 6.0.1 py39hd1e30aa_1 conda-forge rav1e 0.6.6 he8a937b_2 conda-forge readline 8.2 h8228510_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge rich 13.7.0 pyhd8ed1ab_0 conda-forge ruamel.yaml 0.18.5 py39hd1e30aa_0 conda-forge ruamel.yaml.clib 0.2.7 py39hd1e30aa_2 conda-forge setuptools 68.2.2 pyhd8ed1ab_0 conda-forge shellingham 1.5.4 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h9fff704_0 conda-forge svt-av1 1.8.0 h59595ed_0 conda-forge tbb 2021.11.0 h00ab1b0_0 conda-forge tifffile 2023.12.9 pyhd8ed1ab_0 conda-forge tk 8.6.13 noxft_h4845f30_101 conda-forge tqdm 4.66.1 pyhd8ed1ab_0 conda-forge typer 0.9.0 pyhd8ed1ab_0 conda-forge typing-extensions 4.9.0 hd8ed1ab_0 conda-forge typing_extensions 4.9.0 pyha770c72_0 conda-forge tzdata 2023d h0c530f3_0 conda-forge urllib3 2.1.0 pyhd8ed1ab_0 conda-forge wheel 0.42.0 pyhd8ed1ab_0 conda-forge xarray 2023.12.0 pyhd8ed1ab_0 conda-forge xorg-libxau 1.0.11 hd590300_0 conda-forge xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge yaml 0.2.5 h7f98852_2 conda-forge zfp 1.0.1 h59595ed_0 conda-forge zlib-ng 2.0.7 h0b41bf4_0 conda-forge zstd 1.5.5 hfc55251_0 conda-forge
FynnBe commented 6 months ago

@esgomezm if the environment is as expected I'd try to run the model in your local env on CPU and see if you can reproduce the issue.

esgomezm commented 5 months ago

Hi Fynn, I did the following in my Mac (without GPU) and it worked:

conda create -n bioimageio-core python==3.9
conda activate bioimageio-core
conda install -c pytorch -c conda-forge bioimageio.core pytorch torchvision cpuonly
pip install torch==2.0.1 # I included the same version in the notebook as it was installing the 2.1.0 by default.
bioimageio test-model "/Users/esti/Downloads/bioimageio-model.zip"

Output:

/Users/esti/mambaforge/envs/bioimageio-core/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:440: CacheWarning: found cached /var/folders/2m/yqllfkcd3gs5_3tz_4m5h85m0000gp/T/esti/bioimageio_cache/https/raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json. Skipping download of https://raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json.
  warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/Users/esti/mambaforge/envs/bioimageio-core/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:440: CacheWarning: found cached /var/folders/2m/yqllfkcd3gs5_3tz_4m5h85m0000gp/T/esti/bioimageio_cache/https/bioimage-io.github.io/collection-bioimage-io/collection.json. Skipping download of https://bioimage-io.github.io/collection-bioimage-io/collection.json.
  warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
bioimageio.spec 0.4.9post5
implementing:
    collection RDF 0.2.3
    general RDF 0.2.3
    model RDF 0.4.9
bioimageio.core 0.5.11
computing dataset statistics: 0it [00:00, ?it/s]

testing model /Users/esti/Downloads/bioimageio-model.zip...
load resource description: passed
has expected resource type: passed
All URLs and paths available: passed
Test documentation completeness.: passed
reproduce test outputs from test inputs (bioimageio.core 0.5.11): passed

✔️ Model /Users/esti/Downloads/bioimageio-model.zip passed.
(bioimageio-core) esti@estimacbookair ~ % 

I tried with torch==2.1.0 and it also worked.

Now a different issue is why the output of bioimageio is an 8-bit image. When I run the model in Fiji, the same torchscript model, everything works well, but with bioimageio it feels that there is something funny going on inside. I tried running the model with the preprocessing and without it (giving a properly normalised image), and the issue persists.

For an easy check, you can get the zip file in the zenodo repo

esgomezm commented 5 months ago

Now a different issue is why the output of bioimageio is an 8-bit image. When I run the model in Fiji, the same torchscript model, everything works well, but with bioimageio it feels that there is something funny going on inside. I tried running the model with the preprocessing and without it (giving a properly normalised image), and the issue persists.

Sorted, my bad! It was the datarange and datatype in the output. I will update the model in a sec

bioimageiobot commented 5 months ago

preview-collection-json

FynnBe commented 5 months ago

conda install -c pytorch -c conda-forge bioimageio.core pytorch torchvision cpuonly pip install torch==2.0.1 # I included the same version in the notebook as it was installing the 2.1.0 by default.

I suppose you're still sorting things out, but I'm confused why you installed pytorch with conda and then with pip again. That should be avoided in the final conda env. Preferrably by only using a conda installation of pytorch.

esgomezm commented 5 months ago

Conda did not allow me installing torch 2.0.1 but in any case you can skip that, I tested with the one by default (2.1.0), without pip, and it also works. Yet, this still fails in the CI: https://github.com/bioimage-io/collection-bioimage-io/pull/700