Skip to content
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

Error when Running on Higher-Resolution Images #209

Open
aryker opened this issue Jun 26, 2022 · 3 comments
Open

Error when Running on Higher-Resolution Images #209

aryker opened this issue Jun 26, 2022 · 3 comments

Comments

@aryker
Copy link

aryker commented Jun 26, 2022

I am trying to get this working with images outside the ones in the example folder, and I am running into issues whenever I try to use images that are of a resolution other than 640x480. For example, when trying an image of resolution 5184 x 3456 I get the following stack trace:

File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1845, in predict_function  *
        return step_function(self, iterator)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1834, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1823, in run_step  **
        outputs = model.predict_step(data)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1791, in predict_step
        return self(x, training=False)
    File "E:\Data\miniconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\input_spec.py", line 264, in assert_input_compatibility
        raise ValueError(f'Input {input_index} of layer "{layer_name}" is '

    ValueError: Input 0 of layer "model_1" is incompatible with the layer: expected shape=(None, None, None, 3), found shape=(None, 3456, 5184, 4)

As another example, when I try an image of resolution 1920 x 1080 I see the following:

File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1845, in predict_function  *
        return step_function(self, iterator)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1834, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1823, in run_step  **
        outputs = model.predict_step(data)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1791, in predict_step
        return self(x, training=False)
    File "E:\Data\miniconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None
    File "E:\Data\miniconda3\lib\site-packages\keras\backend.py", line 3313, in concatenate
        return tf.concat([to_dense(x) for x in tensors], axis)

    ValueError: Exception encountered when calling layer "up1_concat" (type Concatenate).
    
    Dimension 1 in both shapes must be equal, but are 66 and 67. Shapes are [?,66,120] and [?,67,120]. for '{{node model_1/up1_concat/concat}} = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32](model_1/up1_upsampling2d/resize/ResizeBilinear, model_1/pool3_pool/AvgPool, model_1/up1_concat/concat/axis)' with input shapes: [?,66,120,1664], [?,67,120,256], [] and with computed input tensors: input[2] = <3>.
    
    Call arguments received by layer "up1_concat" (type Concatenate):
      • inputs=['tf.Tensor(shape=(None, 66, 120, 1664), dtype=float32)', 'tf.Tensor(shape=(None, 67, 120, 256), dtype=float32)']
@NimaGhasemzadeh1
Copy link

I am trying to get this working with images outside the ones in the example folder, and I am running into issues whenever I try to use images that are of a resolution other than 640x480. For example, when trying an image of resolution 5184 x 3456 I get the following stack trace:

File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1845, in predict_function  *
        return step_function(self, iterator)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1834, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1823, in run_step  **
        outputs = model.predict_step(data)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1791, in predict_step
        return self(x, training=False)
    File "E:\Data\miniconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\input_spec.py", line 264, in assert_input_compatibility
        raise ValueError(f'Input {input_index} of layer "{layer_name}" is '

    ValueError: Input 0 of layer "model_1" is incompatible with the layer: expected shape=(None, None, None, 3), found shape=(None, 3456, 5184, 4)

As another example, when I try an image of resolution 1920 x 1080 I see the following:

File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1845, in predict_function  *
        return step_function(self, iterator)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1834, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1823, in run_step  **
        outputs = model.predict_step(data)
    File "E:\Data\miniconda3\lib\site-packages\keras\engine\training.py", line 1791, in predict_step
        return self(x, training=False)
    File "E:\Data\miniconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
        raise e.with_traceback(filtered_tb) from None
    File "E:\Data\miniconda3\lib\site-packages\keras\backend.py", line 3313, in concatenate
        return tf.concat([to_dense(x) for x in tensors], axis)

    ValueError: Exception encountered when calling layer "up1_concat" (type Concatenate).
    
    Dimension 1 in both shapes must be equal, but are 66 and 67. Shapes are [?,66,120] and [?,67,120]. for '{{node model_1/up1_concat/concat}} = ConcatV2[N=2, T=DT_FLOAT, Tidx=DT_INT32](model_1/up1_upsampling2d/resize/ResizeBilinear, model_1/pool3_pool/AvgPool, model_1/up1_concat/concat/axis)' with input shapes: [?,66,120,1664], [?,67,120,256], [] and with computed input tensors: input[2] = <3>.
    
    Call arguments received by layer "up1_concat" (type Concatenate):
      • inputs=['tf.Tensor(shape=(None, 66, 120, 1664), dtype=float32)', 'tf.Tensor(shape=(None, 67, 120, 256), dtype=float32)']

Did you solve this problem? I am struggling to overcome this issue right now. I would appreciate your guidance.

@aryker
Copy link
Author

aryker commented Aug 24, 2024

Unfortunately no. I never heard back on this issue from anyone, and this project seems to be abandoned. The authors suggest using their AdaBins project instead, however that also has not seen a commit in several years.

@NimaGhasemzadeh1
Copy link

NimaGhasemzadeh1 commented Aug 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants