Giter Club home page Giter Club logo

Comments (5)

oskar-maier-ms avatar oskar-maier-ms commented on July 18, 2024

Hey BarY7, thanks for reporting! I'll take a look when I find some time and release another minor version.

from medpy.

oskar-maier-ms avatar oskar-maier-ms commented on July 18, 2024

Note: Error stems from __surface_distances(a) and __surface_distances(b) returning results of differing lengths.

from medpy.

iTomxy avatar iTomxy commented on July 18, 2024

+1. When using with numpy==1.24.3, I get:

Traceback (most recent call last):
  File "bone_eval.py", line 208, in <module>
    test_3d(args, model)
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "bone_eval.py", line 159, in test_3d
    evaluator(pred_vol, label_vol)
  File "/data/itom/tyliang/codes/tmp.da-seg-bone/evaluation.py", line 107, in __call__
    a = fn(B_pred_c, B_c)
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/medpy/metric/binary.py", line 470, in assd
    assd = numpy.mean(
  File "<__array_function__ internals>", line 200, in mean
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3464, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/numpy/core/_methods.py", line 165, in _mean
    arr = asanyarray(a)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

And when I downgrade numpy to 1.21.6 as suggested in [1], I get:

Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
Traceback (most recent call last):
  File "bone_eval.py", line 208, in <module>
    test_3d(args, model)
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "bone_eval.py", line 159, in test_3d
    evaluator(pred_vol, label_vol)
  File "/data/itom/tyliang/codes/tmp.da-seg-bone/evaluation.py", line 107, in __call__
    a = fn(B_pred_c, B_c)
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/medpy/metric/binary.py", line 470, in assd
    assd = numpy.mean(
  File "<__array_function__ internals>", line 5, in mean
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3440, in mean
    return _methods._mean(a, axis=axis, dtype=dtype,
  File "/data/itom/miniconda3/envs/cu116_pt1131/lib/python3.8/site-packages/numpy/core/_methods.py", line 179, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
ValueError: operands could not be broadcast together with shapes (148451,) (73048,)

As suggested in [1], it seems dtype="object" should be passed in line 470 of medpy/metric/binary.py in assd = numpy.mean(.


  1. setting an array element with a sequence requested array has an inhomogeneous shape after 1 dimensions The detected shape was (2,)+inhomogeneous part

from medpy.

STHxiao avatar STHxiao commented on July 18, 2024

I met the same problem when using with numpy==1.26.3

from medpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.