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

DHM throws OverflowError with large images #8

Open
nfhktwrbq opened this issue Mar 6, 2024 · 0 comments
Open

DHM throws OverflowError with large images #8

nfhktwrbq opened this issue Mar 6, 2024 · 0 comments

Comments

@nfhktwrbq
Copy link

DHM fails to handle images with resolution 5616x3744:

Failed handle \awb\awb_dataset\JPG\Canon1DsMkIII_0015.jpg with DHM: Traceback (most recent call last):
  File "\awb_ext.py", line 87, in awb_pic
    handled_pic = m(src_img.copy())
                  ^^^^^^^^^^^^^^^^^
  File "\awblib\dhm.py", line 130, in balance
    idx, k = jax.lax.cond(
             ^^^^^^^^^^^^^
  File "\venv\Lib\site-packages\awblib\dhm.py", line 107, in find_best_fit_channel_if_majority_below_half
    ch_ = channel_intensity.at[channel_idx].set(total_pixels * max_value)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\venv\Lib\site-packages\jax\_src\numpy\array_methods.py", line 490, in set
    return scatter._scatter_update(self.array, self.index, values, lax.scatter,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\venv\Lib\site-packages\jax\_src\ops\scatter.py", line 75, in _scatter_update
    y = jnp.asarray(y)
        ^^^^^^^^^^^^^^
  File "\venv\Lib\site-packages\jax\_src\numpy\lax_numpy.py", line 2233, in asarray
    return array(a, dtype=dtype, copy=bool(copy), order=order)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\venv\Lib\site-packages\jax\_src\numpy\lax_numpy.py", line 2121, in array
    _ = dtypes.coerce_to_array(object, dtype)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: Python int 5382733824 too large to convert to int32
--------------------
For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.
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

1 participant