ocean-data-factory-sweden / kso

Notebooks to upload/download marine footage, connect to a citizen science project, train machine learning models and publish marine biological observations.
GNU General Public License v3.0
4 stars 12 forks source link

Notebook #4 error: Extracting frames manually #315

Closed XhD98 closed 7 months ago

XhD98 commented 7 months ago

Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:

If this is a custom dataset/training question you must include your train*.jpg, test*.jpg and results.png figures, or we can not help you. You can generate these with utils.plot_results().

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

Input:

# Generate suitable frames for upload by modifying initial frames
pp.generate_custom_frames(
    input_path=input_folder.selected,
    output_path=output_folder.selected,
    skip_start=5,
    skip_end=5,
    num_frames=50,
    frames_skip=None,
)

Output:

   0%|          | 0/950 [00:00<?, ?it/s]INFO:root:ffmpeg.input('/mimer/NOBACKUP/groups/snic2021-6-9/tmp_dir/cb_frames_XD/tjorn_frames/gp_tjorn_control_s-bruv_1_07_11_frame_15732.jpg').output('/mimer/NOBACKUP/groups/snic2021-6-9/tmp_dir/frames/modified_European green crab_frames_modified_gp_tjorn_control_s-bruv_1_07_11_frame_15732.jpg', q=25)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/src/app/kso-dev/kso_utils/zooniverse_utils.py", line 1774, in modify_frames
    eval(full_prompt).run(capture_stdout=True, capture_stderr=True)
  File "/usr/local/lib/python3.8/dist-packages/ffmpeg/_run.py", line 325, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/__init__.py", line 1085, in emit
    msg = self.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 929, in format
    return fmt.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 668, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.8/logging/__init__.py", line 373, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 17, in <module>
    app.launch_new_instance()
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 1043, in launch_instance
    app.start()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 737, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 195, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
    handle._run()
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 524, in dispatch_queue
    await self.process_one()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 513, in process_one
    await dispatch(*args)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 416, in dispatch_shell
    result = handler(self.shell_stream, idents, msg)
  File "/usr/local/lib/python3.8/dist-packages/comm/base_comm.py", line 261, in comm_msg
    comm.handle_msg(msg)
  File "/usr/local/lib/python3.8/dist-packages/comm/base_comm.py", line 157, in handle_msg
    self._msg_callback(msg)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 237, in m
    return(method(self, *args, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 765, in _handle_msg
    self._handle_custom_msg(data['content'], msg['buffers'])
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 773, in _handle_custom_msg
    self._msg_callbacks(self, content, buffers)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 206, in __call__
    local_value = callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget_button.py", line 105, in _handle_button_msg
    self.click()
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget_button.py", line 94, in click
    self._click_handlers(self)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 206, in __call__
    local_value = callback(*args, **kwargs)
  File "/usr/src/app/kso-dev/kso_utils/project.py", line 910, in on_button_clicked
    self.generated_frames = zoo_utils.modify_frames(
  File "/usr/src/app/kso-dev/kso_utils/zooniverse_utils.py", line 1777, in modify_frames
    logging.info("stdout: {}", e.stdout.decode("utf8"))
Message: 'stdout: {}'
Arguments: ('',)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/src/app/kso-dev/kso_utils/zooniverse_utils.py", line 1774, in modify_frames
    eval(full_prompt).run(capture_stdout=True, capture_stderr=True)
  File "/usr/local/lib/python3.8/dist-packages/ffmpeg/_run.py", line 325, in run
    raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/logging/__init__.py", line 1085, in emit
    msg = self.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 929, in format
    return fmt.format(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 668, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.8/logging/__init__.py", line 373, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 17, in <module>
    app.launch_new_instance()
  File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 1043, in launch_instance
    app.start()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 737, in start
    self.io_loop.start()
  File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 195, in start
    self.asyncio_loop.run_forever()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
    handle._run()
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 524, in dispatch_queue
    await self.process_one()
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 513, in process_one
    await dispatch(*args)
  File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 416, in dispatch_shell
    result = handler(self.shell_stream, idents, msg)
  File "/usr/local/lib/python3.8/dist-packages/comm/base_comm.py", line 261, in comm_msg
    comm.handle_msg(msg)
  File "/usr/local/lib/python3.8/dist-packages/comm/base_comm.py", line 157, in handle_msg
    self._msg_callback(msg)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 237, in m
    return(method(self, *args, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 765, in _handle_msg
    self._handle_custom_msg(data['content'], msg['buffers'])
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 773, in _handle_custom_msg
    self._msg_callbacks(self, content, buffers)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 206, in __call__
    local_value = callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget_button.py", line 105, in _handle_button_msg
    self.click()
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget_button.py", line 94, in click
    self._click_handlers(self)
  File "/usr/local/lib/python3.8/dist-packages/ipywidgets/widgets/widget.py", line 206, in __call__
    local_value = callback(*args, **kwargs)
  File "/usr/src/app/kso-dev/kso_utils/project.py", line 910, in on_button_clicked
    self.generated_frames = zoo_utils.modify_frames(
  File "/usr/src/app/kso-dev/kso_utils/zooniverse_utils.py", line 1778, in modify_frames
    logging.info("stderr: {}", e.stderr.decode("utf8"))
Message: 'stderr: {}'
Arguments: ('ffmpeg version git-2023-10-31-f2687a3 Copyright (c) 2000-2023 the FFmpeg developers\n  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)\n  configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --enable-openssl --disable-doc --disable-ffplay --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64\n  libavutil      58. 31.100 / 58. 31.100\n  libavcodec     60. 32.102 / 60. 32.102\n  libavformat    60. 17.100 / 60. 17.100\n  libavdevice    60.  4.100 / 60.  4.100\n  libavfilter     9. 13.100 /  9. 13.100\n  libswscale      7.  6.100 /  7.  6.100\n  libswresample   4. 13.100 /  4. 13.100\n  libpostproc    57.  4.100 / 57.  4.100\n[in#0 @ 0x560658ef3440] Error opening input: No such file or directory\nError opening input file /mimer/NOBACKUP/groups/snic2021-6-9/tmp_dir/cb_frames_XD/tjorn_frames/gp_tjorn_control_s-bruv_1_07_11_frame_15732.jpg.\nError opening input files: No such file or directory\n',)
  0%|          | 0/950 [00:00<?, ?it/s]
---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
File /usr/src/app/kso-dev/kso_utils/project.py:910, in ProjectProcessor.generate_custom_frames.<locals>.on_button_clicked(b)
    908     self.frames_to_upload_df = pd.DataFrame()
    909 self.project.output_path = output_path
--> 910 self.generated_frames = zoo_utils.modify_frames(
    911     project=self.project,
    912     frames_to_upload_df=self.frames_to_upload_df.reset_index(drop=True),
    913     species_i=species_list.value,
    914     modification_details=frame_modification.checks,
    915 )
    916 self.modified_frames = self.generated_frames

File /usr/src/app/kso-dev/kso_utils/zooniverse_utils.py:1779, in modify_frames(project, frames_to_upload_df, species_i, modification_details)
   1777                 logging.info("stdout: {}", e.stdout.decode("utf8"))
   1778                 logging.info("stderr: {}", e.stderr.decode("utf8"))
-> 1779                 raise e
   1781     logging.info("Frames modified successfully")
   1783 else:
   1784     # Save the modification details to include as subject metadata

File /usr/src/app/kso-dev/kso_utils/zooniverse_utils.py:1774, in modify_frames(project, frames_to_upload_df, species_i, modification_details)
   1772 try:
   1773     logging.info(full_prompt)
-> 1774     eval(full_prompt).run(capture_stdout=True, capture_stderr=True)
   1775     os.chmod(row["modif_frame_path"], 0o777)
   1776 except ffmpeg.Error as e:

File /usr/local/lib/python3.8/dist-packages/ffmpeg/_run.py:325, in run(stream_spec, cmd, capture_stdout, capture_stderr, input, quiet, overwrite_output)
    323 retcode = process.poll()
    324 if retcode:
--> 325     raise Error('ffmpeg', out, err)
    326 return out, err

Error: ffmpeg error (see stderr output for detail)

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

Assignees

@jannesgg

Additional context

Add any other context about the problem here.