You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the SAM2 video tracking example, and I encountered an issue where the program goes into an infinite loop due to an incorrect condition in the split_frame function. Specifically, the issue was that the counter was never incremented under certain conditions, which caused the loop to continue indefinitely without reaching an exit point. This bug made the video tracking example unusable in its current form.
I have identified and fixed the issue by correcting the loop condition, ensuring that the function properly iterates through the frames and exits as expected. With this fix, the code is now working properly, and the video tracking example can proceed as intended without any infinite looping behavior.
I've prepared a pull request with the fix, but since I'm not a collaborator, I'm unable to submit it directly. I would greatly appreciate it if a collaborator could review the changes I've made and apply the fix to the main repository. This would help other users who may encounter the same issue and improve the overall stability of the example.
Here is the corrected code snippet for the split_frames function:
defsplit_frames(self, video_path, temp_dir, start_frame=0, end_frame=100):
logger.debug(f'Opening video file: {video_path}')
video=cv2.VideoCapture(video_path)
ifnotvideo.isOpened():
raiseValueError(f"Could not open video file: {video_path}")
logger.debug(f'Number of frames: {int(video.get(cv2.CAP_PROP_FRAME_COUNT))}')
frame_count=0whileTrue:
success, frame=video.read()
ifnotsuccess:
logger.error(f'Failed to read frame {frame_count}')
breakifframe_count<start_frame:
frame_count+=1continueifframe_count>=end_frame:
breakframe_filename=os.path.join(temp_dir, f'{frame_count:05d}.jpg')
ifnotos.path.exists(frame_filename):
cv2.imwrite(frame_filename, frame)
logger.debug(f'Frame {frame_count}: {frame_filename}')
yieldframe_filename, frameframe_count+=1video.release()
The text was updated successfully, but these errors were encountered:
I'm using the SAM2 video tracking example, and I encountered an issue where the program goes into an infinite loop due to an incorrect condition in the
split_frame
function. Specifically, the issue was that the counter was never incremented under certain conditions, which caused the loop to continue indefinitely without reaching an exit point. This bug made the video tracking example unusable in its current form.I have identified and fixed the issue by correcting the loop condition, ensuring that the function properly iterates through the frames and exits as expected. With this fix, the code is now working properly, and the video tracking example can proceed as intended without any infinite looping behavior.
I've prepared a pull request with the fix, but since I'm not a collaborator, I'm unable to submit it directly. I would greatly appreciate it if a collaborator could review the changes I've made and apply the fix to the main repository. This would help other users who may encounter the same issue and improve the overall stability of the example.
Here is the corrected code snippet for the
split_frames
function:The text was updated successfully, but these errors were encountered: