UX-Decoder / Semantic-SAM

[ECCV 2024] Official implementation of the paper "Semantic-SAM: Segment and Recognize Anything at Any Granularity"
2.39k stars 118 forks source link

Error running local demo #79

Open BrianG13 opened 1 year ago

BrianG13 commented 1 year ago

Hi guys, thanks for sharing your work!

I am trying to run locally the demos: python demo.py --ckpt swinl_only_sam_many2many.pth OR python demo_auto_generation.py --ckpt swinl_only_sam_many2many.pth

But.. when I upload (or select) an image.. I see at the terminal the following error:

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/fastapi/applications.py", line 292, in __call__
    await super().__call__(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/fastapi/routing.py", line 273, in app
    raw_response = await run_endpoint_function(
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/fastapi/routing.py", line 192, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/gradio/routes.py", line 289, in api_info
    return gradio.blocks.get_api_info(config, serialize)  # type: ignore
  File "/home/brian/miniconda3/envs/Semantic-SAM/lib/python3.8/site-packages/gradio/blocks.py", line 518, in get_api_info
    serializer = serializing.COMPONENT_MAPPING[type]()
KeyError: 'dataset'

I didn't download the dataset, I don't really need it, I just want to inference with an image "from the wild". Is it possible?

Thanks!!

Gorluxor commented 10 months ago

As discussed here in the gradio issue below. @https://github.com/gradio-app/gradio/issues/5017 What worked for me was pip install gradio==3.37.0

RomainBertrand commented 10 months ago

As discussed here in the gradio issue below. @gradio-app/gradio#5017 What worked for me was pip install gradio==3.37.0

Thanks, it works now !