標準網(wǎng)站建設織夢模板怎么修改主頁
鶴壁市浩天電氣有限公司
2026/01/24 11:11:04
標準網(wǎng)站建設,織夢模板怎么修改主頁,如何寫作網(wǎng)站,做一張網(wǎng)站專欄背景圖一、項目介紹
結核病#xff08;Tuberculosis, TB#xff09;是一種由結核分枝桿菌引起的全球性傳染病#xff0c;早期準確檢測對疾病防控至關重要。本文提出了一種基于YOLOv11深度學習模型的結核病檢測系統(tǒng)#xff0c;通過目標檢測技術自動識別痰涂片樣本中的結核桿菌Tuberculosis, TB是一種由結核分枝桿菌引起的全球性傳染病早期準確檢測對疾病防控至關重要。本文提出了一種基于YOLOv11深度學習模型的結核病檢測系統(tǒng)通過目標檢測技術自動識別痰涂片樣本中的結核桿菌TBbacillus。系統(tǒng)采用包含1,098張訓練圖像和122張驗證圖像的自定義YOLO數(shù)據(jù)集進行模型訓練并集成用戶友好的UI界面支持登錄注冊功能便于醫(yī)療工作者快速篩查結核病。實驗結果表明該系統(tǒng)在驗證集上表現(xiàn)出較高的檢測精度與魯棒性為結核病的自動化診斷提供了有效工具。引言結核病是全球十大死因之一早期診斷是控制其傳播的關鍵。傳統(tǒng)的痰涂片鏡檢法依賴人工操作存在效率低、主觀性強等局限性。近年來深度學習技術在醫(yī)學影像分析中展現(xiàn)出顯著優(yōu)勢尤其是YOLO系列模型在實時目標檢測領域性能卓越。本文基于YOLOv11算法構建了一套端到端的結核病檢測系統(tǒng)針對結核桿菌TBbacillus單一類別進行優(yōu)化。系統(tǒng)采用1,220張標注圖像訓練集1,098張驗證集122張進行模型訓練并結合交互式UI界面與用戶管理模塊提升了實際應用的便捷性。該研究不僅驗證了YOLOv11在顯微醫(yī)學圖像檢測中的有效性還為基層醫(yī)療單位提供了低成本、高效率的輔助診斷方案。目錄一、項目介紹二、項目功能展示2.1 用戶登錄系統(tǒng)2.2 檢測功能2.3 檢測結果顯示2.4 參數(shù)配置2.5 其他功能3. 技術特點4. 系統(tǒng)流程三、數(shù)據(jù)集介紹數(shù)據(jù)集配置文件四、項目環(huán)境配置創(chuàng)建虛擬環(huán)境安裝所需要庫五、模型訓練訓練代碼訓練結果六、核心代碼登錄注冊驗證 多重檢測模式? 沉浸式可視化?? 參數(shù)配置系統(tǒng)? UI美學設計 智能工作流七、項目源碼視頻簡介基于深度學習YOLOv11的結核病檢測系統(tǒng)YOLOv11YOLO數(shù)據(jù)集UI界面登錄注冊界面Python項目源碼模型_嗶哩嗶哩_bilibili基于深度學習YOLOv11的結核病檢測系統(tǒng)YOLOv11YOLO數(shù)據(jù)集UI界面登錄注冊界面Python項目源碼模型二、項目功能展示? 用戶登錄注冊支持密碼檢測和安全性驗證。? 三種檢測模式基于YOLOv11模型支持圖片、視頻和實時攝像頭三種檢測精準識別目標。? 雙畫面對比同屏顯示原始畫面與檢測結果。? 數(shù)據(jù)可視化實時表格展示檢測目標的類別、置信度及坐標。?智能參數(shù)調(diào)節(jié)提供置信度滑塊動態(tài)優(yōu)化檢測精度適應不同場景需求。?科幻風交互界面深色主題搭配動態(tài)光效減少視覺疲勞提升操作體驗。?多線程高性能架構獨立檢測線程保障流暢運行實時狀態(tài)提示響應迅速無卡頓。2.1 用戶登錄系統(tǒng)提供用戶登錄和注冊功能用戶名和密碼驗證賬戶信息本地存儲(accounts.json)密碼長度至少6位的安全要求2.2 檢測功能圖片檢測支持JPG/JPEG/PNG/BMP格式圖片的火焰煙霧檢測視頻檢測支持MP4/AVI/MOV格式視頻的逐幀檢測攝像頭檢測實時攝像頭流檢測(默認攝像頭0)檢測結果保存到results目錄2.3 檢測結果顯示顯示原始圖像和檢測結果圖像檢測結果表格展示包含檢測到的類別置信度分數(shù)物體位置坐標(x,y)、2.4 參數(shù)配置模型選擇置信度閾值調(diào)節(jié)(0-1.0)IoU(交并比)閾值調(diào)節(jié)(0-1.0)實時同步滑塊和數(shù)值輸入框2.5 其他功能檢測結果保存功能視頻檢測時自動保存結果視頻狀態(tài)欄顯示系統(tǒng)狀態(tài)和最后更新時間無邊框窗口設計可拖動和調(diào)整大小3. 技術特點采用多線程處理檢測任務避免界面卡頓精美的UI設計具有科技感的視覺效果發(fā)光邊框和按鈕懸停和按下狀態(tài)效果自定義滑塊、表格和下拉框樣式檢測結果保存機制響應式布局適應不同窗口大小4. 系統(tǒng)流程用戶登錄/注冊選擇檢測模式(圖片/視頻/攝像頭)調(diào)整檢測參數(shù)(可選)開始檢測并查看結果可選擇保存檢測結果停止檢測或切換其他模式三、數(shù)據(jù)集介紹本系統(tǒng)使用的結核桿菌TBbacillus檢測數(shù)據(jù)集采用YOLO格式標注包含1,220張高質(zhì)量的痰涂片顯微圖像按照訓練集1,098張和驗證集122張劃分比例為9:1確保模型訓練和評估的可靠性。數(shù)據(jù)集配置文件數(shù)據(jù)集采用標準化YOLO格式組織train: F:結核病數(shù)據(jù)集 rain val: F:結核病數(shù)據(jù)集valid test: nc: 1 names: [TBbacillus]四、項目環(huán)境配置創(chuàng)建虛擬環(huán)境首先新建一個Anaconda環(huán)境每個項目用不同的環(huán)境這樣項目中所用的依賴包互不干擾。終端輸入conda create -n yolov11 python3.9激活虛擬環(huán)境conda activate yolov11安裝cpu版本pytorchpip install torch torchvision torchaudio安裝所需要庫pip install -r requirements.txtpycharm中配置anaconda五、模型訓練訓練代碼from ultralytics import YOLO model_path yolo11s.pt data_path data.yaml if __name__ __main__: model YOLO(model_path) results model.train(datadata_path, epochs100, batch8, device0, workers0, projectruns, nameexp, )根據(jù)實際情況更換模型 # yolov11n.yaml (nano)輕量化模型適合嵌入式設備速度快但精度略低。 # yolov11s.yaml (small)小模型適合實時任務。 # yolov11m.yaml (medium)中等大小模型兼顧速度和精度。 # yolov11b.yaml (base)基本版模型適合大部分應用場景。 # yolov11l.yaml (large)大型模型適合對精度要求高的任務。--batch 8每批次8張圖像。--epochs 100訓練100輪。--datasets/data.yaml數(shù)據(jù)集配置文件。--weights yolov11s.pt初始化模型權重yolov11s.pt是預訓練的輕量級YOLO模型。訓練結果六、核心代碼import sys import cv2 import numpy as np from PyQt5.QtWidgets import QApplication, QMessageBox, QFileDialog from PyQt5.QtCore import QThread, pyqtSignal from ultralytics import YOLO from UiMain import UiMainWindow import time import os from PyQt5.QtWidgets import QDialog from LoginWindow import LoginWindow class DetectionThread(QThread): frame_received pyqtSignal(np.ndarray, np.ndarray, list) # 原始幀, 檢測幀, 檢測結果 finished_signal pyqtSignal() # 線程完成信號 def __init__(self, model, source, conf, iou, parentNone): super().__init__(parent) self.model model self.source source self.conf conf self.iou iou self.running True def run(self): try: if isinstance(self.source, int) or self.source.endswith((.mp4, .avi, .mov)): # 視頻或攝像頭 cap cv2.VideoCapture(self.source) while self.running and cap.isOpened(): ret, frame cap.read() if not ret: break # 保存原始幀 original_frame frame.copy() # 檢測 results self.model(frame, confself.conf, iouself.iou) annotated_frame results[0].plot() # 提取檢測結果 detections [] for result in results: for box in result.boxes: class_id int(box.cls) class_name self.model.names[class_id] confidence float(box.conf) x, y, w, h box.xywh[0].tolist() detections.append((class_name, confidence, x, y)) # 發(fā)送信號 self.frame_received.emit( cv2.cvtColor(original_frame, cv2.COLOR_BGR2RGB), cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB), detections ) # 控制幀率 time.sleep(0.03) # 約30fps cap.release() else: # 圖片 frame cv2.imread(self.source) if frame is not None: original_frame frame.copy() results self.model(frame, confself.conf, iouself.iou) annotated_frame results[0].plot() # 提取檢測結果 detections [] for result in results: for box in result.boxes: class_id int(box.cls) class_name self.model.names[class_id] confidence float(box.conf) x, y, w, h box.xywh[0].tolist() detections.append((class_name, confidence, x, y)) self.frame_received.emit( cv2.cvtColor(original_frame, cv2.COLOR_BGR2RGB), cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB), detections ) except Exception as e: print(fDetection error: {e}) finally: self.finished_signal.emit() def stop(self): self.running False class MainWindow(UiMainWindow): def __init__(self): super().__init__() # 初始化模型 self.model None self.detection_thread None self.current_image None self.current_result None self.video_writer None self.is_camera_running False self.is_video_running False self.last_detection_result None # 新增保存最后一次檢測結果 # 連接按鈕信號 self.image_btn.clicked.connect(self.detect_image) self.video_btn.clicked.connect(self.detect_video) self.camera_btn.clicked.connect(self.detect_camera) self.stop_btn.clicked.connect(self.stop_detection) self.save_btn.clicked.connect(self.save_result) # 初始化模型 self.load_model() def load_model(self): try: model_name self.model_combo.currentText() self.model YOLO(f{model_name}.pt) # 自動下載或加載本地模型 self.update_status(f模型 {model_name} 加載成功) except Exception as e: QMessageBox.critical(self, 錯誤, f模型加載失敗: {str(e)}) self.update_status(模型加載失敗) def detect_image(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 請先停止當前檢測任務) return file_path, _ QFileDialog.getOpenFileName( self, 選擇圖片, , 圖片文件 (*.jpg *.jpeg *.png *.bmp)) if file_path: self.clear_results() self.current_image cv2.imread(file_path) self.current_image cv2.cvtColor(self.current_image, cv2.COLOR_BGR2RGB) self.display_image(self.original_image_label, self.current_image) # 創(chuàng)建檢測線程 conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, file_path, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(f正在檢測圖片: {os.path.basename(file_path)}) def detect_video(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 請先停止當前檢測任務) return file_path, _ QFileDialog.getOpenFileName( self, 選擇視頻, , 視頻文件 (*.mp4 *.avi *.mov)) if file_path: self.clear_results() self.is_video_running True # 初始化視頻寫入器 cap cv2.VideoCapture(file_path) frame_width int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) frame_height int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps cap.get(cv2.CAP_PROP_FPS) cap.release() # 創(chuàng)建保存路徑 save_dir results os.makedirs(save_dir, exist_okTrue) timestamp time.strftime(%Y%m%d_%H%M%S) save_path os.path.join(save_dir, fresult_{timestamp}.mp4) fourcc cv2.VideoWriter_fourcc(*mp4v) self.video_writer cv2.VideoWriter(save_path, fourcc, fps, (frame_width, frame_height)) # 創(chuàng)建檢測線程 conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, file_path, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(f正在檢測視頻: {os.path.basename(file_path)}) def detect_camera(self): if self.detection_thread and self.detection_thread.isRunning(): QMessageBox.warning(self, 警告, 請先停止當前檢測任務) return self.clear_results() self.is_camera_running True # 創(chuàng)建檢測線程 (默認使用攝像頭0) conf self.confidence_spinbox.value() iou self.iou_spinbox.value() self.detection_thread DetectionThread(self.model, 0, conf, iou) self.detection_thread.frame_received.connect(self.on_frame_received) self.detection_thread.finished_signal.connect(self.on_detection_finished) self.detection_thread.start() self.update_status(正在從攝像頭檢測...)登錄注冊驗證對應文件LoginWindow.py# 賬戶驗證核心邏輯 def handle_login(self): username self.username_input.text().strip() password self.password_input.text().strip() if not username or not password: QMessageBox.warning(self, 警告, 用戶名和密碼不能為空) return if username in self.accounts and self.accounts[username] password: self.accept() # 驗證通過 else: QMessageBox.warning(self, 錯誤, 用戶名或密碼錯誤) # 密碼強度檢查注冊時 def handle_register(self): if len(password) 6: # 密碼長度≥6位 QMessageBox.warning(self, 警告, 密碼長度至少為6位)多重檢測模式對應文件main.py圖片檢測def detect_image(self): file_path, _ QFileDialog.getOpenFileName( self, 選擇圖片, , 圖片文件 (*.jpg *.jpeg *.png *.bmp)) if file_path: self.detection_thread DetectionThread(self.model, file_path, conf, iou) self.detection_thread.start() # 啟動檢測線程視頻檢測def detect_video(self): file_path, _ QFileDialog.getOpenFileName( self, 選擇視頻, , 視頻文件 (*.mp4 *.avi *.mov)) if file_path: self.video_writer cv2.VideoWriter() # 初始化視頻寫入器 self.detection_thread DetectionThread(self.model, file_path, conf, iou)實時攝像頭def detect_camera(self): self.detection_thread DetectionThread(self.model, 0, conf, iou) # 攝像頭設備號0 self.detection_thread.start()?沉浸式可視化對應文件UiMain.py雙畫面顯示def display_image(self, label, image): q_img QImage(image.data, w, h, bytes_per_line, QImage.Format_RGB888) pixmap QPixmap.fromImage(q_img) label.setPixmap(pixmap.scaled(label.size(), Qt.KeepAspectRatio)) # 自適應縮放結果表格def add_detection_result(self, class_name, confidence, x, y): self.results_table.insertRow(row) items [ QTableWidgetItem(class_name), # 類別列 QTableWidgetItem(f{confidence:.2f}), # 置信度 QTableWidgetItem(f{x:.1f}), # X坐標 QTableWidgetItem(f{y:.1f}) # Y坐標 ]??參數(shù)配置系統(tǒng)對應文件UiMain.py雙閾值聯(lián)動控制# 置信度閾值同步 def update_confidence(self, value): confidence value / 100.0 self.confidence_spinbox.setValue(confidence) # 滑塊→數(shù)值框 self.confidence_label.setText(f置信度閾值: {confidence:.2f}) # IoU閾值同步 def update_iou(self, value): iou value / 100.0 self.iou_spinbox.setValue(iou)?UI美學設計對應文件UiMain.py科幻風格按鈕def create_button(self, text, color): return f QPushButton {{ border: 1px solid {color}; color: {color}; border-radius: 6px; }} QPushButton:hover {{ background-color: {self.lighten_color(color, 10)}; box-shadow: 0 0 10px {color}; # 懸停發(fā)光效果 }} 動態(tài)狀態(tài)欄def update_status(self, message): self.status_bar.showMessage( f狀態(tài): {message} | 最后更新: {time.strftime(%H:%M:%S)} # 實時時間戳 )智能工作流對應文件main.py線程管理class DetectionThread(QThread): frame_received pyqtSignal(np.ndarray, np.ndarray, list) # 信號量通信 def run(self): while self.running: # 多線程檢測循環(huán) results self.model(frame, confself.conf, iouself.iou) self.frame_received.emit(original_frame, result_frame, detections)七、項目源碼視頻簡介基于深度學習YOLOv11的結核病檢測系統(tǒng)YOLOv11YOLO數(shù)據(jù)集UI界面登錄注冊界面Python項目源碼模型_嗶哩嗶哩_bilibili基于深度學習YOLOv11的結核病檢測系統(tǒng)YOLOv11YOLO數(shù)據(jù)集UI界面登錄注冊界面Python項目源碼模型