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

ValueError: zero-size array to reduction operation maximum which has no identity #606

Closed
7 tasks
Dean-Corso opened this issue Apr 12, 2024 · 4 comments
Closed
7 tasks
Labels

Comments

@Dean-Corso
Copy link

Describe the bug
"Face Swap frames" isn't working. I get that error "ValueError: zero-size array to reduction operation maximum which has no identity" every time I press on refresh button when I have this option checked.

CMD LOG
Traceback (most recent call last):
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\gradio\queueing.py", line 527, in process_events
  response = await route_utils.call_process_api(
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\gradio\route_utils.py", line 261, in call_process_api
  output = await app.get_blocks().process_api(
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\gradio\blocks.py", line 1786, in process_api
  result = await self.call_function(
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\gradio\blocks.py", line 1338, in call_function
  prediction = await anyio.to_thread.run_sync(
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
  return await get_async_backend().run_sync_in_worker_thread(
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 2144, in run_sync_in_worker_thread
  return await future
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
  result = context.run(func, *args)
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\gradio\utils.py", line 759, in wrapper
  response = f(*args, **kwargs)
File "C:\Users\***\roop-unleashed\roop-unleashed\ui\tabs\faceswap_tab.py", line 445, in on_preview_frame_changed
  current_frame = live_swap(current_frame, roop.globals.face_swap_mode, use_clip, clip_text, maskimage, show_mask, SELECTED_INPUT_FACE_INDEX)
File "C:\Users\***\roop-unleashed\roop-unleashed\roop\core.py", line 194, in live_swap
  process_mgr.initialize(roop.globals.INPUT_FACESETS, roop.globals.TARGET_FACES, options)
File "C:\Users\***\roop-unleashed\roop-unleashed\roop\ProcessMgr.py", line 124, in initialize
  self.options.imagemask = self.blur_area(self.options.imagemask, mo[4], mo[5])
File "C:\Users\***\roop-unleashed\roop-unleashed\roop\ProcessMgr.py", line 607, in blur_area
  mask_h = np.max(mask_h_inds) - np.min(mask_h_inds)
File "<__array_function__ internals>", line 200, in amax
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\numpy\core\fromnumeric.py", line 2820, in amax
  return _wrapreduction(a, np.maximum, 'max', axis, None, out,
File "C:\Users\***\roop-unleashed\installer_files\env\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction
  return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity

To Reproduce
Steps to reproduce the behavior:

  1. Load source & target image
  2. Select face of target image (if more than one)
  3. Check Face Swap frames / or refresh button
  4. See error

Details
What OS are you using?

  • Linux
  • Linux in WSL
  • [x ] Windows
  • Mac

Are you using a GPU?

  • [x ] No. CPU FTW
  • NVIDIA
  • AMD
  • Intel
  • Mac

Which version of roop unleashed are you using?
3.6.7 - Installer Version roop-unleashed_win3.6.7_installer.zip

@C0untFloyd
Copy link
Owner

Does this also happen when using "First found" or any other face selection mode?

@Dean-Corso
Copy link
Author

It happens all the time with any selection type when I have checked the "Face swap frames" checkbox. It was working correctly in the version 3.5.0 I used before. Otherwise the Start button does work to process the face swap to show the final image below. Only the preview window above it's working with the enabled Face swap option and it does always print that error "zero-size array".

I also have an issue with the manual masking feature. When I press on "toggle manual masking" then the loaded image in the preview window does disappear and I just see some new small buttons for paste, image button, draw button & erase button but how to use them when no image is showing anymore? Is this a bug? Otherwise if I do anything wrong then you could maybe tell us how to use it.

I also tried the text mask feature which was not working for me in the older 3.5.0 version. This time it seems to work to mask something on the image like "hair" or "glasses" but in case of other objects it does fail and just showing a full black image. I even can not mask anything manually on the image because it's when gone when I press on toggle manually masking as I said above.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label May 23, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

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

No branches or pull requests

2 participants