ATNsRNet processing error
I installed the latest ATNsR/ANTsRCore/ANTsRNet. (Xubuntu 20.04, Anaconda3, Python 3.10.13) As a test, I attempted deepAtrpos and I encountered a Tensorflow-related error message shown at the end.
My Python environment has tensorflow package and my R environment also has tensorflow package. Is there any required tensorflow version or python version? Are there any matching versions of tensorflow versions between python and R environments?
I am not sure what I should I do further. Any guidance will be appreciated.
Error message that I encountered.
Working on 121-1247... oro.nifti 0.11.4 Loading required package: ANTsRCore ANTsR 0.6.0 Environment variables set either in .Renviron or with a seed (e.g. XXX): Sys.setenv(ANTS_RANDOM_SEED = XXX) Sys.setenv(ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS = 1) may influence reproducibility in some methods. See https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues for more information.Also see *repro methods in antsRegistration.
Attaching package: ‘ANTsR’
The following objects are masked from ‘package:ANTsRCore’:
antsApplyTransforms, antsApplyTransformsToPoints, antsImageClone,
antsImageHeaderInfo, antsImageIterator, antsImageMutualInformation,
antsImageRead, antsImageWrite, antsMotionCorr, antsRegistration,
cropImage, extractSlice, fastMarchingExtension,
fitBsplineDisplacementField, fitBsplineObjectToScatteredData,
fitThinPlateSplineDisplacementField, fsl2antsrTransform,
imagesToMatrix, integrateVelocityField, invertDisplacementField,
labelStats, makeImage, mergeChannels, reflectionMatrix,
reorientImage, robustMatrixTransform, smoothImage, splitChannels,
weingartenImageCurvature
The following objects are masked from ‘package:oro.nifti’:
origin, origin<-
The following objects are masked from ‘package:stats’:
sd, var
The following objects are masked from ‘package:base’:
all, any, apply, max, min, prod, range, sum
[1] "/mnt/hgfs/Y/schoi/test_ANTs_atropos/deep_Atropos/121-1247" [1] "File location is :/mnt/hgfs/Y/schoi/test_ANTs_atropos/deep_Atropos/121-1247/" [1] "/mnt/hgfs/Y/schoi/test_ANTs_atropos/deep_Atropos/121-1247/121-1247_baseline_lesion_filled_T1W.nii.gz" used (Mb) gc trigger (Mb) max used (Mb) Ncells 1832911 97.9 3623561 193.6 2446715 130.7 Vcells 2986259 22.8 8388608 64.0 5136416 39.2 2024-04-08 07:04:51.310617: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. Error: Valid installation of TensorFlow not found.
Python environments searched for 'tensorflow' package: /home/xubuntu/anaconda3/envs/py310/bin/python3.10
Python exception encountered:
Traceback (most recent call last):
File "/home/xubuntu/R/x86_64-pc-linux-gnu-library/3.6/reticulate/python/rpytools/loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
File "/home/xubuntu/R/x86_64-pc-linux-gnu-library/3.6/reticulate/python/rpytools/loader.py", line 96, in _run_hook
module = hook()
File "/home/xubuntu/R/x86_64-pc-linux-gnu-library/3.6/reticulate/python/rpytools/loader.py", line 120, in _hook
return find_and_load(name, import)
File "/home/xubuntu/anaconda3/envs/py310/lib/python3.10/site-packages/tensorflow/init.py", line 37, in
I'm guessing your tensorflow version is problematic. I tried it on my machine and it works just fine. Here's the sessionInfo():
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ANTsRNet_1.1 ANTsR_0.6.0 ANTsRCore_0.8.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.12 whisker_0.4.1 magrittr_2.0.3 rappdirs_0.3.3
[5] lattice_0.20-45 here_1.0.1 R6_2.5.1 rlang_1.1.3
[9] tools_4.1.2 grid_4.1.2 png_0.1-7 cli_3.6.2
[13] withr_3.0.0 keras_2.13.0 tfruns_1.5.2 rprojroot_2.0.4
[17] lifecycle_1.0.4 tensorflow_2.15.0 Matrix_1.4-0 base64enc_0.1-3
[21] fs_1.6.3 zeallot_0.1.0 compiler_4.1.2 generics_0.1.2
[25] reticulate_1.35.0 jsonlite_1.8.8 mvtnorm_1.1-3
Thank you for the information.
The issue was resolved by ensuring that the TensorFlow versions in the Python environment and the R TensorFlow package were compatible. This solution has been successful for both Deep Atropos and Deep Flash.
However, I encountered a problem with DKT labeling. It appeared to be functioning correctly, but the process was terminated midway and no results were saved. I'm curious if there are any specific requirements for DKT labeling that differ from those for Deep Atropos and Deep Flash.
My guess is that you ran into memory limits.
The DKT labeling network is, by far, the most memory intensive network we have and that's due simply to the large number of labels involved.
I appreciate your response. I will attempt to increase the amount of memory and let you know the result.
Closing for now.