albert597 / TRAILMAP

MIT License
45 stars 16 forks source link

VisibleDeprecationWarning for segment_brain.py #13

Open beeceegee opened 3 years ago

beeceegee commented 3 years ago

Hi all, I am running into this error below when I try to run python3 segment_brain_batch.py, here's my error below, and what I am running in the conda environment and the drivers I have compiled.

python3 segment_brain_batch.py ~/Desktop/Training/BG_TS_01_ps6/ ~/Desktop/Training/BG_TS_01_auto/
2021-06-30 08:35:24.484875: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2021-06-30 08:35:24.558357: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties: 
pciBusID: 0000:17:00.0 name: Quadro RTX 5000 computeCapability: 7.5
coreClock: 1.815GHz coreCount: 48 deviceMemorySize: 15.74GiB deviceMemoryBandwidth: 417.29GiB/s
2021-06-30 08:35:24.559367: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 1 with properties: 
pciBusID: 0000:73:00.0 name: Quadro RTX 5000 computeCapability: 7.5
coreClock: 1.815GHz coreCount: 48 deviceMemorySize: 15.75GiB deviceMemoryBandwidth: 417.29GiB/s
2021-06-30 08:35:24.559592: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2021-06-30 08:35:24.561353: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2021-06-30 08:35:24.563171: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2021-06-30 08:35:24.563435: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2021-06-30 08:35:24.565187: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2021-06-30 08:35:24.566166: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2021-06-30 08:35:24.569965: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2021-06-30 08:35:24.573594: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0, 1
2021-06-30 08:35:24.573925: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
2021-06-30 08:35:24.582588: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2400000000 Hz
2021-06-30 08:35:24.584244: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5556a8390420 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-06-30 08:35:24.584270: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2021-06-30 08:35:24.825760: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties: 
pciBusID: 0000:17:00.0 name: Quadro RTX 5000 computeCapability: 7.5
coreClock: 1.815GHz coreCount: 48 deviceMemorySize: 15.74GiB deviceMemoryBandwidth: 417.29GiB/s
2021-06-30 08:35:24.826740: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 1 with properties: 
pciBusID: 0000:73:00.0 name: Quadro RTX 5000 computeCapability: 7.5
coreClock: 1.815GHz coreCount: 48 deviceMemorySize: 15.75GiB deviceMemoryBandwidth: 417.29GiB/s
2021-06-30 08:35:24.826815: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2021-06-30 08:35:24.826828: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2021-06-30 08:35:24.826840: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2021-06-30 08:35:24.826851: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2021-06-30 08:35:24.826862: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2021-06-30 08:35:24.826891: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2021-06-30 08:35:24.826903: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2021-06-30 08:35:24.830335: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0, 1
2021-06-30 08:35:24.830381: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2021-06-30 08:35:24.832083: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-06-30 08:35:24.832098: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]      0 1 
2021-06-30 08:35:24.832103: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0:   N Y 
2021-06-30 08:35:24.832123: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 1:   Y N 
2021-06-30 08:35:24.835324: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14814 MB memory) -> physical GPU (device: 0, name: Quadro RTX 5000, pci bus id: 0000:17:00.0, compute capability: 7.5)
2021-06-30 08:35:24.837571: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 15196 MB memory) -> physical GPU (device: 1, name: Quadro RTX 5000, pci bus id: 0000:73:00.0, compute capability: 7.5)
2021-06-30 08:35:24.840103: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5556ac1a1930 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2021-06-30 08:35:24.840122: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Quadro RTX 5000, Compute Capability 7.5
2021-06-30 08:35:24.840127: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (1): Quadro RTX 5000, Compute Capability 7.5
/home/quantum/Desktop/Training/seg-BG_TS_01_ps6 already exists. Will be overwritten
Name: BG_TS_01_ps6
[                                        ]   0%       ETA: Pending        2021-06-30 08:35:31.268174: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2021-06-30 08:35:32.330143: W tensorflow/stream_executor/gpu/redzone_allocator.cc:312] Not found: ./bin/ptxas not found
Relying on driver to perform ptx compilation. This message will be only logged once.
2021-06-30 08:35:32.406519: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
[====================================    ]  90%       ETA: 0.3 mins       /home/quantum/software/TRAILMAP/inference/segment_brain.py:60: VisibleDeprecationWarning: 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.
  vol = np.array(vol)
TypeError: only size-1 arrays can be converted to Python scalars

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

Traceback (most recent call last):
  File "segment_brain_batch.py", line 43, in <module>
    segment_brain(input_folder, output_folder, model)
  File "/home/quantum/software/TRAILMAP/inference/segment_brain.py", line 146, in segment_brain
    section = read_folder_section(input_folder, end_aligned, end_aligned + input_dim).astype('float32')
ValueError: setting an array element with a sequence.

This is my current CUDA/Driver/GPU set up

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02    Driver Version: 450.80.02    CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro RTX 5000     Off  | 00000000:17:00.0  On |                  Off |
| 33%   34C    P8    19W / 230W |    405MiB / 16116MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Quadro RTX 5000     Off  | 00000000:73:00.0 Off |                  Off |
| 33%   31C    P8    11W / 230W |     11MiB / 16125MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1345      G   /usr/lib/xorg/Xorg                 39MiB |
|    0   N/A  N/A      2217      G   /usr/lib/xorg/Xorg                130MiB |
|    0   N/A  N/A      2351      G   /usr/bin/gnome-shell              172MiB |
|    0   N/A  N/A      3106      G   ...mviewer/tv_bin/TeamViewer       14MiB |
|    0   N/A  N/A      3454      G   /usr/lib/firefox/firefox            2MiB |
|    0   N/A  N/A      3664      G   /usr/lib/firefox/firefox            2MiB |
|    0   N/A  N/A      8381      G   /usr/lib/firefox/firefox           25MiB |
|    0   N/A  N/A     13134      G   /usr/lib/firefox/firefox            2MiB |
|    0   N/A  N/A    757623      G   gnome-control-center                3MiB |
|    1   N/A  N/A      1345      G   /usr/lib/xorg/Xorg                  4MiB |
|    1   N/A  N/A      2217      G   /usr/lib/xorg/Xorg                  4MiB |

And then, here's all that is in my condo environment.

# packages in environment at /home/quantum/anaconda3/envs/trailmap_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
_tflow_select             2.1.0                       gpu  
absl-py                   0.13.0           py37h06a4308_0  
aiohttp                   3.7.4            py37h27cfd23_1  
astor                     0.8.1            py37h06a4308_0  
async-timeout             3.0.1            py37h06a4308_0  
attrs                     21.2.0             pyhd3eb1b0_0  
blas                      1.0                         mkl  
blinker                   1.4              py37h06a4308_0  
brotlipy                  0.7.0           py37h27cfd23_1003  
bzip2                     1.0.8                h7b6447c_0  
c-ares                    1.17.1               h27cfd23_0  
ca-certificates           2021.5.25            h06a4308_1  
cachetools                4.2.2              pyhd3eb1b0_0  
cairo                     1.16.0               hf32fb01_1  
certifi                   2021.5.30        py37h06a4308_0  
cffi                      1.14.5           py37h261ae71_0  
chardet                   3.0.4           py37h06a4308_1003  
click                     8.0.1              pyhd3eb1b0_0  
coverage                  5.5              py37h27cfd23_2  
cryptography              3.4.7            py37hd23ed53_0  
cudatoolkit               10.1.243             h6bb024c_0  
cudnn                     7.6.5                cuda10.1_0  
cupti                     10.1.168                      0  
cython                    0.29.23          py37h2531618_0  
ffmpeg                    4.0                  hcdf2ecd_0  
fontconfig                2.13.1               h6c09931_0  
freeglut                  3.0.0                hf484d3e_5  
freetype                  2.10.4               h5ab3b9f_0  
gast                      0.2.2                    py37_0  
glib                      2.68.2               h36276a3_0  
google-auth               1.32.0             pyhd3eb1b0_0  
google-auth-oauthlib      0.4.4              pyhd3eb1b0_0  
google-pasta              0.2.0                      py_0  
graphite2                 1.3.14               h23475e2_0  
grpcio                    1.36.1           py37h2157cd5_1  
h5py                      2.8.0            py37h989c5e5_3  
harfbuzz                  1.8.8                hffaf4a1_0  
hdf5                      1.10.2               hba1933b_1  
icu                       58.2                 he6710b0_3  
idna                      2.10               pyhd3eb1b0_0  
importlib-metadata        3.10.0           py37h06a4308_0  
intel-openmp              2021.2.0           h06a4308_610  
jasper                    2.0.14               h07fcdf6_1  
jpeg                      9b                   h024ee3a_2  
keras-applications        1.0.8                      py_1  
keras-preprocessing       1.1.2              pyhd3eb1b0_0  
ld_impl_linux-64          2.35.1               h7274673_9  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.3.0               h5101ec6_17  
libgfortran-ng            7.5.0               ha8ba4b0_17  
libgfortran4              7.5.0               ha8ba4b0_17  
libglu                    9.0.0                hf484d3e_1  
libgomp                   9.3.0               h5101ec6_17  
libopencv                 3.4.2                hb342d67_1  
libopus                   1.3.1                h7b6447c_0  
libpng                    1.6.37               hbc83047_0  
libprotobuf               3.14.0               h8c45485_0  
libstdcxx-ng              9.3.0               hd4cf53a_17  
libtiff                   4.2.0                h85742a9_0  
libuuid                   1.0.3                h1bed415_2  
libvpx                    1.7.0                h439df22_0  
libwebp-base              1.2.0                h27cfd23_0  
libxcb                    1.14                 h7b6447c_0  
libxml2                   2.9.12               h03d6c58_0  
lz4-c                     1.9.3                h2531618_0  
markdown                  3.3.4            py37h06a4308_0  
mkl                       2021.2.0           h06a4308_296  
mkl-service               2.3.0            py37h27cfd23_1  
mkl_fft                   1.3.0            py37h42c9631_2  
mkl_random                1.2.1            py37ha9443f7_2  
multidict                 5.1.0            py37h27cfd23_2  
ncurses                   6.2                  he6710b0_1  
numpy                     1.20.2           py37h2d18471_0  
numpy-base                1.20.2           py37hfae3a4d_0  
oauthlib                  3.1.0                      py_0  
olefile                   0.46                     py37_0  
opencv                    3.4.2            py37h6fd60c2_1  
openssl                   1.1.1k               h27cfd23_0  
opt_einsum                3.3.0              pyhd3eb1b0_1  
pcre                      8.45                 h295c915_0  
pillow                    7.0.0            py37hb39fc2d_0  
pip                       21.1.2           py37h06a4308_0  
pixman                    0.40.0               h7b6447c_0  
protobuf                  3.14.0           py37h2531618_1  
py-opencv                 3.4.2            py37hb342d67_1  
pyasn1                    0.4.8                      py_0  
pyasn1-modules            0.2.8                      py_0  
pycparser                 2.20                       py_2  
pyjwt                     1.7.1                    py37_0  
pyopenssl                 20.0.1             pyhd3eb1b0_1  
pysocks                   1.7.1                    py37_1  
python                    3.7.10               h12debd9_4  
readline                  8.1                  h27cfd23_0  
requests                  2.25.1             pyhd3eb1b0_0  
requests-oauthlib         1.3.0                      py_0  
rsa                       4.7.2              pyhd3eb1b0_1  
scipy                     1.6.2            py37had2a1c9_1  
setuptools                52.0.0           py37h06a4308_0  
six                       1.16.0             pyhd3eb1b0_0  
sqlite                    3.36.0               hc218d9a_0  
tensorboard               2.4.0              pyhc547734_0  
tensorboard-plugin-wit    1.6.0                      py_0  
tensorflow                2.1.0           gpu_py37h7a4bb67_0  
tensorflow-base           2.1.0           gpu_py37h6c5654b_0  
tensorflow-estimator      2.5.0              pyh7b7c402_0  
tensorflow-gpu            2.1.0                h0d30ee6_0  
termcolor                 1.1.0            py37h06a4308_1  
tk                        8.6.10               hbc83047_0  
typing-extensions         3.7.4.3              hd3eb1b0_0  
typing_extensions         3.7.4.3            pyh06a4308_0  
urllib3                   1.26.4             pyhd3eb1b0_0  
werkzeug                  1.0.1              pyhd3eb1b0_0  
wheel                     0.36.2             pyhd3eb1b0_0  
wrapt                     1.12.1           py37h7b6447c_1  
xz                        5.2.5                h7b6447c_0  
yarl                      1.6.3            py37h27cfd23_0  
zipp                      3.4.1              pyhd3eb1b0_0  
zlib                      1.2.11               h7b6447c_3  
zstd                      1.4.9                haebb681_0  

Thank you so much for your help and for the awesome software!

albert597 commented 3 years ago

Hello! Sorry for the late response.

As suggested by the warning, could you try replacing line 60 with

vol = np.array(vol, dtype='object')