HenriquesLab / HenriquesLab/ZeroCostDL4Mic

3D unet: Problem with Section 5.4, cannot download model as bioImage

Open
#288 8 comments 0 reactions 1 assignee View on GitHub

@mariana-gferreira is already working on this.

Since Oct 13, 2023.

Dominant language
Jupyter Notebook
Stars
652
Forks
144
PR merge metrics
No merged PRs in 30d

Description

Hi, I am trying out the 3D unet using the provided sample data (the mitochondria electron microscope image provided in the link). I finished the training and wanted to download the model as bioImage Model zoo to be used in FIJI in section 5.4. However, I keep getting this error message and have no idea what it's saying...


ValueError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py in enumarg(enum, arg)
23590 try:

23591 return enum(arg)
23592 except Exception:

9 frames
/usr/lib/python3.10/enum.py in call(cls, value, names, module, qualname, type, start)
384 if names is None: # simple value lookup
--> 385 return cls.new(cls, value)
386 # otherwise, functional API: we're creating a new Enum type

/usr/lib/python3.10/enum.py in new(cls, value)
709 if result is None and exc is None:
--> 710 raise ve_exc
711 elif exc is None:

ValueError: 1.25 is not a valid RESUNIT

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py in enumarg(enum, arg)
23593 try:

23594 return enum[arg.upper()]
23595 except Exception as exc:

AttributeError: 'float' object has no attribute 'upper'

The above exception was the direct cause of the following exception:

ValueError Traceback (most recent call last)
in <cell line: 205>()
203
204 # export the model with keras weights
--> 205 build_model(
206 weight_uri=weight_path,
207 test_inputs=[test_in_path],

/usr/local/lib/python3.10/dist-packages/bioimageio/core/build_spec/build_model.py in build_model(weight_uri, test_inputs, test_outputs, input_axes, output_axes, name, description, authors, tags, documentation, cite, output_path, architecture, model_kwargs, weight_type, sample_inputs, sample_outputs, input_names, input_step, input_min_shape, input_data_range, output_names, output_reference, output_scale, output_offset, output_data_range, halo, preprocessing, postprocessing, pixel_sizes, maintainers, license, covers, git_repo, attachments, packaged_by, run_mode, parent, config, dependencies, links, training_data, root, add_deepimagej_config, tensorflow_version, opset_version, pytorch_version, weight_attachments)
829 if add_deepimagej_config:
830 if sample_inputs is None:
--> 831 sample_inputs, sample_outputs = _write_sample_data(
832 test_inputs, test_outputs, input_axes, output_axes, pixel_sizes, root
833 )

/usr/local/lib/python3.10/dist-packages/bioimageio/core/build_spec/build_model.py in write_sample_data(input_paths, output_paths, input_axes, output_axes, pixel_sizes, export_folder)
451 sample_in_path = export_folder / f"sample_input
{i}.tif"
452 pixel_size = None if pixel_sizes is None else pixel_sizes[i]
--> 453 write_im(sample_in_path, inp, axes, pixel_size)
454 sample_in_paths.append(sample_in_path)
455

/usr/local/lib/python3.10/dist-packages/bioimageio/core/build_spec/build_model.py in write_im(path, im, axes, pixel_size)
444 if np.dtype(im.dtype) == np.dtype("float64"):
445 im = im.astype("float32")
--> 446 tifffile.imwrite(path, im, imagej=True, resolution=resolution)
447
448 sample_in_paths = []

/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py in imwrite(file, data, bigtiff, byteorder, imagej, ome, shaped, append, shape, dtype, photometric, planarconfig, extrasamples, volumetric, tile, rowsperstrip, bitspersample, compression, compressionargs, predictor, subsampling, jpegtables, colormap, description, datetime, resolution, resolutionunit, subfiletype, software, metadata, extratags, contiguous, truncate, align, maxworkers, returnoffset)
1249 shaped=shaped,
1250 ) as tif:
-> 1251 result = tif.write(
1252 data,
1253 shape=shape,

/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py in write(failed resolving arguments)
2853 unit = resolution[2] # type: ignore
2854 if unit is not None:
-> 2855 resolutionunit = enumarg(RESUNIT, unit)
2856 addtag(tags, 296, 3, 1, resolutionunit) # ResolutionUnit
2857 else:

/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py in enumarg(enum, arg)
23594 return enum[arg.upper()]
23595 except Exception as exc:

23596 raise ValueError(f'invalid argument {arg!r}') from exc
23597
23598

ValueError: invalid argument 1.25

I am using OS: iOS and Chrome, would truly appreciate any help on this! Thank you !!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.