voxel51 / fiftyone

The open-source tool for building high-quality datasets and computer vision models
https://fiftyone.ai
Apache License 2.0
8.06k stars 537 forks source link

[BUG] InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D' #3216

Open tomeravgil opened 1 year ago

tomeravgil commented 1 year ago

Instructions

Thank you for submitting an issue. Please refer to our issue policy for information on what types of issues we address.

  1. Please fill in this template to ensure a timely and thorough response
  2. Place an "x" between the brackets next to an option if it applies. For example:
    • [x] Selected option
  3. Please delete everything above this line before submitting the issue

System information

Commands to reproduce

As thoroughly as possible, please provide the Python and/or shell commands used to encounter the issue. Application steps can be described in the next section.

Hi, I am trying to run a database with .avi and .mp4 files. For now I am not using reencodevideos, but I am getting a problem randomly. image

# commands here

Describe the problem

Describe the problem clearly here. Include descriptions of the expected behavior and the actual behavior.

Code to reproduce issue

Provide a reproducible test case that is the bare minimum necessary to generate the problem.

Other info/logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Please do not use screenshots for sharing text. Code snippets should be used instead when providing tracebacks, logs, etc.

What areas of FiftyOne does this bug affect?

Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?

benjaminpkane commented 1 year ago

Hi @tomeravgil, this looks like an edge case issue with image data. Do you have example data that reproduces this issue? To start, I will look into 0x0 images

jneeven commented 5 months ago

I doubt @tomeravgil will have had the same cause, but I ran into this issue as well. After a lengthy elimination process, it turns out to be because I have a fo.Detection with an empty mask array. Setting the mask to None fixes the problem.

To reproduce:

          broken_dataset = fo.Dataset.from_json("debug.json", name="debug")

          # Fix broken mask
          sample = broken_dataset.first()
          for detection in sample["labels"]["detections"]:
              if detection.mask.size == 0:
                  detection.set_field("mask", None)

          dataset = broken_dataset.clone()
          dataset.clear()
          dataset.add_sample(sample)

      with record_function("launch_app"):
          # sesh = fo.launch_app(broken_dataset)
          sesh = fo.launch_app(dataset)

The loaded JSON file: debug.json And the image it refers to: 000000247306