Skip to content

Commit

Permalink
- 在使用float32模式下调用sam2模型,现在会进行提示。
Browse files Browse the repository at this point in the history
  在float32数据类型下,sam2视频分割速度超慢;bfloat16下快很多。建议使用bfloat16进行视频分割。
  • Loading branch information
yatengLG committed Sep 27, 2024
1 parent ea8fbd1 commit 1b1e8d1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ISAT/widgets/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,17 @@ def init_sam_finish(self, sam_tag:bool, sam_video_tag:bool):
self.segany_video_thread = SegAnyVideoThread(self)
self.segany_video_thread.tag.connect(self.seg_video_finish)

# sam2 建议使用bfloat16
if self.segany.model_dtype == torch.float32:
if self.actionChinese.isChecked():
QtWidgets.QMessageBox.warning(self,
'warning',
"""建议使用bfloat16模式进行视频分割\n在[菜单栏]-[SAM]-[模型管理]界面打开该功能""")
else:
QtWidgets.QMessageBox.warning(self,
'warning',
"""Suggest Use bfloat16 mode to segment video.\nYou can open it in [Menubar]-[SAM]-[model manage].""")

else:
self.segany_video_thread = None
self.use_segment_anything_video = False
Expand Down

0 comments on commit 1b1e8d1

Please sign in to comment.