deepfakes / faceswap

Deepfakes Software For All
https://www.faceswap.dev
GNU General Public License v3.0
52.54k stars 13.24k forks source link

Exception in Tkinter callback on selecting Analysis Tab in GUI #1159

Closed HoloByteus closed 2 years ago

HoloByteus commented 3 years ago

Describe the bug Getting the following Tkinter Exception after selecting Analysis tab in GUI using the Dlight model. Initially experienced this after 200000 iterations and tried rolling back models to previous iterations. Eventually just started over completely and still get the error on a new model.

Exception in Tkinter callback TypeError: float() argument must be a string or a number, not 'list'

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

Traceback (most recent call last): File "C:\Users\mmcgu\MiniConda3\envs\faceswap\lib\tkinter__init.py", line 1892, in call return self.func(*args) File "C:\Users\mmcgu\MiniConda3\envs\faceswap\lib\tkinter\init__.py", line 814, in callit func(args) File "F:\program files\faceswap\lib\gui\display_analysis.py", line 190, in self.after(1000, lambda msg=message: self._set_session_summary(msg)) File "F:\program files\faceswap\lib\gui\display_analysis.py", line 196, in _set_session_summary result = self._thread.get_result() File "F:\program files\faceswap\lib\gui\utils.py", line 1222, in get_result raise self.err[1].with_traceback(self.err[2]) File "F:\program files\faceswap\lib\gui\utils.py", line 1193, in run retval = self._target(self._args, **self._kwargs) File "F:\program files\faceswap\lib\gui\display_analysis.py", line 215, in _summarise_data return session.full_summary File "F:\program files\faceswap\lib\gui\analysis\stats.py", line 70, in full_summary return self._summary.get_summary_stats() File "F:\program files\faceswap\lib\gui\analysis\stats.py", line 283, in get_summary_stats self._get_time_stats() File "F:\program files\faceswap\lib\gui\analysis\stats.py", line 315, in _get_time_stats latest = self._session.get_timestamps(session_id) File "F:\program files\faceswap\lib\gui\analysis\stats.py", line 205, in get_timestamps retval = self._tb_logs.get_timestamps(session_id=session_id) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 498, in get_timestamps self._check_cache(idx) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 440, in _check_cache self._cache_data(session_id) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 428, in _cache_data parser.cache_events(session_id) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 584, in cache_events self._cache.cache_data(session_id, data, self._loss_labels, is_live=self._live_data) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 169, in cache_data timestamps, loss = self._to_numpy(data, is_live) File "F:\program files\faceswap\lib\gui\analysis\event_reader.py", line 210, in _to_numpy times, loss = (np.array(times, dtype="float64"), np.array(loss, dtype="float32")) ValueError: setting an array element with a sequence.

To Reproduce Steps to reproduce the behavior:

  1. Start a new Dlight model training, new preview window enabled.
  2. Wait for first save model text in console
  3. Click on the Analysis Tab to see tkinter error

Expected behavior Analysis data is displayed in tables.

Desktop (please complete the following information):

Crash Report No Crash report, FS is still running. Just no analysis data or graph updates. faceswap.log faceswap_gui.log

aminhusni commented 3 years ago

I can confirm the reproduction steps.

Exception in Tkinter callback
TypeError: float() argument must be a string or a number, not 'list'

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

Traceback (most recent call last):
  File "C:\ExtProgram\anaconda3\envs\faceswap\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display.py", line 186, in _on_tab_change
    selected_object.on_tab_select()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_command.py", line 254, in on_tab_select
    self._update_page()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_page.py", line 273, in _update_page
    self.load_display()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_page.py", line 285, in load_display
    self.display_item_process()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_command.py", line 388, in display_item_process
    for key in self.display_item.get_loss_keys(Session.session_ids[-1])
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\stats.py", line 243, in get_loss_keys
    for sess_id, logs in self._tb_logs.get_loss(session_id=session_id).items()}
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 466, in get_loss
    self._check_cache(idx)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 442, in _check_cache
    self._cache_data(session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 428, in _cache_data
    parser.cache_events(session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 584, in cache_events
    self._cache.cache_data(session_id, data, self._loss_labels, is_live=self._live_data)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 169, in cache_data
    timestamps, loss = self._to_numpy(data, is_live)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 210, in _to_numpy
    times, loss = (np.array(times, dtype="float64"), np.array(loss, dtype="float32"))
ValueError: setting an array element with a sequence.
Exception in Tkinter callback
TypeError: float() argument must be a string or a number, not 'list'

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

Traceback (most recent call last):
  File "C:\ExtProgram\anaconda3\envs\faceswap\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\ExtProgram\anaconda3\envs\faceswap\lib\tkinter\__init__.py", line 814, in callit
    func(*args)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_analysis.py", line 190, in <lambda>
    self.after(1000, lambda msg=message: self._set_session_summary(msg))
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_analysis.py", line 196, in _set_session_summary
    result = self._thread.get_result()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\utils.py", line 1230, in get_result
    raise self.err[1].with_traceback(self.err[2])
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\utils.py", line 1201, in run
    retval = self._target(*self._args, **self._kwargs)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\display_analysis.py", line 215, in _summarise_data
    return session.full_summary
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\stats.py", line 72, in full_summary
    return self._summary.get_summary_stats()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\stats.py", line 287, in get_summary_stats
    self._get_time_stats()
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\stats.py", line 319, in _get_time_stats
    latest = self._session.get_timestamps(session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\stats.py", line 209, in get_timestamps
    retval = self._tb_logs.get_timestamps(session_id=session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 498, in get_timestamps
    self._check_cache(idx)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 442, in _check_cache
    self._cache_data(session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 428, in _cache_data
    parser.cache_events(session_id)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 584, in cache_events
    self._cache.cache_data(session_id, data, self._loss_labels, is_live=self._live_data)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 169, in cache_data
    timestamps, loss = self._to_numpy(data, is_live)
  File "C:\Users\Base Terminal 01\faceswap\lib\gui\analysis\event_reader.py", line 210, in _to_numpy
    times, loss = (np.array(times, dtype="float64"), np.array(loss, dtype="float32"))
ValueError: setting an array element with a sequence.
ayaya118 commented 3 years ago

can anybody fix it 1 ?

callmejm commented 2 years ago

I have same error https://github.com/deepfakes/faceswap/issues/1199

Alcantara98 commented 2 years ago

Is this still not fixed? Basically, when creating the 'loss' array which is a 2-dimensional array (array for arrays that contain the loss measurement for both face A and face B), the loss for one of the faces is missing, and numpy does not allow the creation of an array of arrays of differing lengths.

I'm not the best programmer, and I just created a loop that removes an array if its length is not two, but I assume that as the session goes on, the length of the array will increase and this method will not be the most efficient. Probably better to fix it at the source and stop putting a list of size one in. I think this is caused by the iteration not being done yet, and hence missing the result for the second face. Not sure though, but yeah, my temporary fix is fine for now. O(n).

torzdf commented 2 years ago

This particular issue should have been fixed.