z-x-yang / Segment-and-Track-Anything

An open-source project dedicated to tracking and segmenting any objects in videos, either automatically or interactively. The primary algorithms utilized include the Segment Anything Model (SAM) for key-frame segmentation and Associating Objects with Transformers (AOT) for efficient tracking and propagation purposes.
GNU Affero General Public License v3.0
2.75k stars 332 forks source link

Error in demo_instseg.ipynb? #136

Open crankler opened 5 months ago

crankler commented 5 months ago

Hi, thanks for your interesting work. I've reimplemented this pkg, but when I try to test demo_instseg.ipynb as you suggested, I found the error below:

/home/yc/.conda/envs/track/lib/python3.9/site-packages/torch/utils/checkpoint.py:460: UserWarning: torch.utils.checkpoint: please pass in use_reentrant=True or use_reentrant=False explicitly. The default value of use_reentrant will be updated to be False in the future. To maintain current behavior, pass use_reentrant=True. It is recommended that you use use_reentrant=False. Refer to docs for more details on the differences between the two variants.
  warnings.warn(
/home/yc/.conda/envs/track/lib/python3.9/site-packages/torch/utils/checkpoint.py:90: UserWarning: None of the inputs have requires_grad=True. Gradients will be None
  warnings.warn(
Traceback (most recent call last):
  File "/home/yc/catkin_map/catkin_deva/src/sam_track_ros/scripts/samtrack/sam2trackseg_ros.py", line 242, in <module>
    TrackSAMNode()
  File "/home/yc/catkin_map/catkin_deva/src/sam_track_ros/scripts/samtrack/sam2trackseg_ros.py", line 128, in TrackSAMNode
    segtracker.add_reference(frame, pred_mask)
  File "/home/yc/catkin_map/catkin_deva/src/sam_track_ros/scripts/samtrack/SegTracker.py", line 98, in add_reference
    self.curr_idx = self.get_obj_num()
  File "/home/yc/catkin_map/catkin_deva/src/sam_track_ros/scripts/samtrack/SegTracker.py", line 125, in get_obj_num
    return int(max(objs))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

It seems that this error located at segtracker.add_reference() when frame=0. Can you tell me how to fix it? Thanks for your reply here.