Skip to content

ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (0, 1) #17

Description

@st-pfister

Hey,

thank you for developing this tool, very excited to use it.
I wanted to run the following script on my fast5_pass files:

(Deeplexicon) beckmannlab-arch% python3 deeplexicon.py -p ~/"run/user/1005/gvfs/afp-volume:host=XXX.XX.XX.XX,user=stefan,volume=beckmannlab/stefan/Data (not complete)/read files DeePlexiCon/DeePlexiCon test 1/fast5_pass/fast5_pass" -f multi -m /home/beckmannlab/deeplexicon/models/resnet20-final.h5 > output.tsv

When running this script, I get the following:

Using TensorFlow backend.
WARNING: Logging before flag parsing goes to stderr.
W0825 11:59:11.809371 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0825 11:59:11.833133 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4185: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.

W0825 11:59:11.845560 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:245: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

W0825 11:59:11.845713 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

W0825 11:59:11.845817 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-08-25 11:59:11.845981: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2021-08-25 11:59:11.865134: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3401065000 Hz
2021-08-25 11:59:11.865529: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55aff10a6260 executing computations on platform Host. Devices:
2021-08-25 11:59:11.865553: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): ,
2021-08-25 11:59:11.877678: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
W0825 11:59:11.893048 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:1834: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.

W0825 11:59:13.072088 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3980: The name tf.nn.avg_pool is deprecated. Please use tf.nn.avg_pool2d instead.

W0825 11:59:17.393233 140291947890368 deprecation_wrapper.py:119] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

W0825 11:59:17.728567 140291947890368 deprecation.py:323] From /home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/tensorflow/python/ops/math_grad.py:1250: add_dispatch_support..wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
Traceback (most recent call last):
File "deeplexicon.py", line 622, in
main()
File "deeplexicon.py", line 304, in main
C = classify(model, labels, np.array(images), False, args.threshold)
File "deeplexicon.py", line 611, in classify
y = model.predict(x, verbose=0)
File "/home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/engine/training.py", line 1149, in predict
x, _, _ = self._standardize_user_data(x)
File "/home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/engine/training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "/home/beckmannlab/Deeplexicon/Deeplexicon/lib/python3.7/site-packages/keras/engine/training_utils.py", line 128, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (0, 1)
(Deeplexicon) beckmannlab-arch% --vmodule=xla_compilation_cache=1
zsh: command not found: --vmodule=xla_compilation_cache=1

I installed all packages in the versions given in the "Additional Information" section and am using Linux. I also tried it on a Mac using conda, but also could not get the script running (here with different Errors).

Hope I was able to state my problem and hope one can help me!

Bests,
stefan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions