-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very Slow Loading of NIfTI (.nii.gz) Files Compared to SimpleITK #8107
Comments
import time Custom LoadImage with prefetchingclass FastMONAILoadImage(monai.transforms.LoadImage): def load_with_monai(file_path): def load_with_sitk(file_path): def run_benchmark(file_path, num_iterations=10):
if name == "main": |
Could you please explain why does 'ncalls' for |
The ncalls value shown as 60/40 in MONAI profiling results means the
function numpy.asanyarray was called 60 times in total. Out of these, 40
were direct calls (where it was explicitly invoked), and the remaining 20
were indirect calls (triggered by other functions).
…On Mon, 30 Dec 2024 at 7:41 PM, 罗崚骁 (LUO Lingxiao) ***@***.***> wrote:
Could you please explain why does 'ncalls' for numpy.asanyarray in MONAI
profiling results is shown as 60/40, what does this indicate?
—
Reply to this email directly, view it on GitHub
<#8107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATOZRTPTAWOHDYKO2ERLVET2IFIB3AVCNFSM6AAAAABOY6FZ7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRVGUZTINBUHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Describe the bug
There is a significant performance gap between MONAI and SimpleITK when loading NIfTI (.nii.gz) files.
In my own benchmark I have found:
Using cProfile I notice that for monai, the bulk of the loading time is consumed by
numpy.asanyarray
. Results are the following when running a loop with monai.transforms.LoadImage 10 times:MONAI Profiling Results
SimpleITK Profiling Results
Note: Times are in seconds. 'ncalls' is the number of calls, 'tottime' is the total time spent in the function (excluding time in subfunctions), 'percall' is the average time spent per call, and 'cumtime' is the cumulative time spent in the function and all subfunctions.
As shown in the profiling results, the majority of time in MONAI is spent in numpy operations, particularly numpy.asanyarray, which takes about 19.956 seconds cumulatively. In contrast, SimpleITK's ReadImage function takes only 1.076 seconds.
To Reproduce
Environment
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: