EdgeTAM icon indicating copy to clipboard operation
EdgeTAM copied to clipboard

list index out of range

Open hilaryliang opened this issue 1 year ago • 1 comments

Hi, thanks for your great work!

I try the demo, and the output looks great.

However, sometimes an error occurred.

TRACKING INPUT POINT: [[807, 377]] TRACKING INPUT LABEL: [1] TRACKING INPUT POINT: [[807, 377], [907, 353]] TRACKING INPUT LABEL: [1, 1] TRACKING INPUT POINT: [[807, 377], [907, 353], [1095, 416]] TRACKING INPUT LABEL: [1, 1, 1] starting propagate_in_video propagate in video: 100%|████████████████████| 361/361 [00:06<00:00, 51.64it/s] Traceback (most recent call last): File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/gradio/routes.py", line 791, in predict output = await route_utils.call_process_api( File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api output = await app.get_blocks().process_api( File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/gradio/blocks.py", line 1935, in process_api result = await self.call_function( File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function prediction = await anyio.to_thread.run_sync( # type: ignore File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/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/envs/sat/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread return await future File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run result = context.run(func, *args) File "/home/ubuntu/miniconda3/envs/sat/lib/python3.10/site-packages/gradio/utils.py", line 826, in wrapper response = f(*args, **kwargs) File "/home/ubuntu/Dreame/tool/EdgeTAM/gradio_app.py", line 299, in propagate_to_all session_state["all_frames"][out_frame_idx] IndexError: list index out of range

please help, thanks

hilaryliang avatar Jun 24 '25 06:06 hilaryliang

I saw this as well with some of my videos and did a little digging. In propagate_to_all there is a discrepancy in the number of frames between video_segments (has more frames) and session_state["all_frames"] (has less frames) within this for loop https://github.com/facebookresearch/EdgeTAM/blob/main/gradio_app.py#L297. Each uses a different mechanism for loading the video. video_segments is ultimately constructed from decord.VideoReader at https://github.com/facebookresearch/EdgeTAM/blob/main/sam2/utils/misc.py#L295 whereas session_state["all_frames"] is constructed from cv2.VideoCapture at https://github.com/facebookresearch/EdgeTAM/blob/main/gradio_app.py#L148. I am not sure of the proper fix, but you can temporarily alter the for loop to be consistent in which object you are going to iterate and manipulate frames on.

Lexmark-chad avatar Nov 17 '25 15:11 Lexmark-chad