修正 video inference 回傳為 none 時會出現大量的 popup 導致 crash, 更新 update_diary.md
This commit is contained in:
parent
89fcb4e6bb
commit
0c33dd059f
@ -54,7 +54,9 @@ class InferenceWorkerThread(QThread):
|
|||||||
try:
|
try:
|
||||||
mse = np.mean((frame.astype(np.float32) - self.last_frame.astype(np.float32)) ** 2)
|
mse = np.mean((frame.astype(np.float32) - self.last_frame.astype(np.float32)) ** 2)
|
||||||
if mse < self.mse_threshold and self.cached_result is not None:
|
if mse < self.mse_threshold and self.cached_result is not None:
|
||||||
self.inference_result_signal.emit(self.cached_result)
|
# 只有在結果不為 None 時才發送信號
|
||||||
|
if self.cached_result is not None:
|
||||||
|
self.inference_result_signal.emit(self.cached_result)
|
||||||
if self.once_mode:
|
if self.once_mode:
|
||||||
self._running = False
|
self._running = False
|
||||||
break
|
break
|
||||||
@ -74,7 +76,10 @@ class InferenceWorkerThread(QThread):
|
|||||||
self.last_inference_time = current_time
|
self.last_inference_time = current_time
|
||||||
self.last_frame = frame.copy()
|
self.last_frame = frame.copy()
|
||||||
self.cached_result = result
|
self.cached_result = result
|
||||||
self.inference_result_signal.emit(result)
|
|
||||||
|
# 只有在結果不為 None 時才發送信號
|
||||||
|
if result is not None:
|
||||||
|
self.inference_result_signal.emit(result)
|
||||||
|
|
||||||
if self.once_mode:
|
if self.once_mode:
|
||||||
self._running = False
|
self._running = False
|
||||||
|
|||||||
@ -204,6 +204,11 @@ class MainWindow(QWidget):
|
|||||||
def handle_inference_result(self, result):
|
def handle_inference_result(self, result):
|
||||||
"""處理來自推論工作器的結果"""
|
"""處理來自推論工作器的結果"""
|
||||||
try:
|
try:
|
||||||
|
# 如果結果為 None,直接返回不處理
|
||||||
|
if result is None:
|
||||||
|
print("收到空的推論結果 (None),略過處理")
|
||||||
|
return
|
||||||
|
|
||||||
# 輸出結果到控制台
|
# 輸出結果到控制台
|
||||||
print("收到推論結果:", result)
|
print("收到推論結果:", result)
|
||||||
|
|
||||||
@ -251,7 +256,13 @@ class MainWindow(QWidget):
|
|||||||
# 不需要顯示彈窗,因為邊界框會直接繪製在畫面上
|
# 不需要顯示彈窗,因為邊界框會直接繪製在畫面上
|
||||||
return
|
return
|
||||||
|
|
||||||
# 對於非邊界框結果,使用彈窗顯示
|
# 對於非邊界框結果,使用彈窗顯示 (限制每次只顯示一個彈窗)
|
||||||
|
# 檢查是否有其他消息框正在顯示
|
||||||
|
for widget in QApplication.topLevelWidgets():
|
||||||
|
if isinstance(widget, QMessageBox) and widget.isVisible():
|
||||||
|
print("已有彈窗顯示中,跳過此次結果顯示")
|
||||||
|
return
|
||||||
|
|
||||||
# 創建QMessageBox
|
# 創建QMessageBox
|
||||||
msgBox = QMessageBox(self)
|
msgBox = QMessageBox(self)
|
||||||
msgBox.setWindowTitle("推論結果")
|
msgBox.setWindowTitle("推論結果")
|
||||||
|
|||||||
@ -20,3 +20,13 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
5. 更新 README.md: 添加 bounding boxes 的 return value
|
5. 更新 README.md: 添加 bounding boxes 的 return value
|
||||||
|
#### total: 3.5 hrs
|
||||||
|
|
||||||
|
### 0415
|
||||||
|
1. 尋找 Face detection and Face recognition's pretrained model
|
||||||
|
#### total: 1 hrs
|
||||||
|
|
||||||
|
### 0416
|
||||||
|
1. 將 arcface's pth model 轉換成 onnx
|
||||||
|
2. 修正 video inference return none 導致的 crash
|
||||||
|
#### total: 3 hrs
|
||||||
Loading…
x
Reference in New Issue
Block a user