YunxuanMao / SAM2-GUI

30 stars 2 forks source link

click on Input Frame is not working #1

Open AbedSoleymani opened 3 months ago

AbedSoleymani commented 3 months ago

Thank you for sharing the code. I can choose the folder with frames and can see the specified frame in the "Input Frame" window. However, none of the clicks work, and I cannot see a mask in the "Current Selection" window. Do you have any thoughts? Could you please specify the versions of the libraries you used?

YunxuanMao commented 3 months ago

You should first click on 'Get SAM features' button before any other cooperation.

AbedSoleymani commented 3 months ago

Thank you for the response. Clicking ‘Get SAM features’ returns this error: RuntimeError: no images found in data/images/seq1. However, I am sure there are images in this folder, as I pressed the ‘extract frames’ button, and the folder is full of frames. I can select one of them and see that frame in the Input frame window. Here is the full error:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/gradio/route_utils.py", line 321, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/gradio/blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/gradio/blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/gradio/utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/Abed/segment-anything-2/app.py", line 117, in get_sam_features
    self.inference_state = self.sam_model.init_state(video_path=self.img_dir)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/miniconda3/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/Abed/segment-anything-2/sam2/sam2_video_predictor.py", line 47, in init_state
    images, video_height, video_width = load_video_frames(
                                        ^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/Abed/segment-anything-2/sam2/utils/misc.py", line 192, in load_video_frames
    raise RuntimeError(f"no images found in {jpg_folder}")
RuntimeError: no images found in data/images/seq1
AbedSoleymani commented 3 months ago

I am still doubtful about the discrepancy between the python version or other libraries (specifically gradio).

YunxuanMao commented 3 months ago

I don't think this is a problem with my code. You should check whether the input folder is a relative path or not.

xbmatrix commented 3 months ago

I'm having the same issue, click on Input Frame is not working. My gradio version is 4.42.0.

xbmatrix commented 3 months ago

After downgrading gradio from 4.42.0 to 4.29.0 it worked fine. I haven't tried other versions

kirilllzaitsev commented 1 month ago

If you face the pydantic issue after downgrading gradio, you could also downgrade fastapi as mentioned in this discussion: pip install fastapi==0.112.2.

This way, gradio==4.37.2 resolved the issue with unresponsive point clicks