SAM V2 Model Not Redetecting when Object Dissapears

Hi, I am doing a project where I have mice in a box and I am recording the coordinates of the mice so that I can know if the mice are standing, on the walls, stationary, or hiding. (there is a black roof on the right where mouse can hide.

The problem is, everything works fine until the mouse decides to hide, and then the SAM V2 model from meta can’t seem to detect the mouse once it decides to stop hiding.

You can see this happening in the attached image. the mouse has just left the black roof on the right and is not highilghted purple (which is shoudl be if detected)

For reference, my code is attached below. i am bassically just prompting sam to detect with a point and then use the x and y coordinate to find various behaviors of the mice. but the model cant find the mice again after it hides,

sam2.ipynb (449.4 KB)

It also seems to work in the SAM 2 web demo, but not here when i do it with code.

i was told that i coudl fix it by somehow adding another reference point, and i get how to dot his with the demo, but how do i do it with code???