Comments (5)
I met the same problem when using with numpy==1.26.3
from medpy.
Hey BarY7, thanks for reporting! I'll take a look when I find some time and release another minor version.
from medpy.
Note: Error stems from __surface_distances(a)
and __surface_distances(b)
returning results of differing lengths.
from medpy.
+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(
.
from medpy.
I met the same problem when using with numpy==1.26.1,hope be solved
from medpy.
Related Issues (20)
- Possible wrong result returned by medpy.io.load HOT 1
- Problem with opening .img/.img.hdr file HOT 1
- reduce redundant computation when computing multiple surface distance-based metrics HOT 3
- Issue with graphcut support HOT 8
- medpy.metric.binary.hd95(pre,gt) always get "1"、“1.414”、‘’1.732“.。。。 HOT 1
- Should Dice coefficient for empty result and empty reference be 1? HOT 1
- ASSD equation is wrong HOT 1
- scipy deprecations HOT 1
- anisotropic_diffusion slicer error HOT 3
- Numpy.bool is deprecated HOT 7
- batchsize influence test performance HOT 2
- When I use medpy.io.load to read .nii files,it always wrong. HOT 1
- Why I cannot load my CT volumns?
- metrics for multi-classes? HOT 1
- Handle few deprecations in scipy HOT 2
- Conda recipe with graphcut support HOT 2
- Broken links and incomplete notebooks HOT 2
- No module named 'load' HOT 1
- No module named 'medpy.graphcut.maxflow' HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from medpy.