簡易檢索 / 詳目顯示

研究生: 張耀澤
Chang, Yao-Tse
論文名稱: 一個應用於穿戴裝置即時癲癇檢測與辨識之高效能可編程的RISC-V指令集卷積類神經網路協同處理器
An Energy-efficient and Programmable RISC-V CNN Coprocessor for Real-time Epilepsy Detection and Identification on Wearable Devices
指導教授: 李順裕
Lee, Shuenn-Yuh
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 電機工程學系
Department of Electrical Engineering
論文出版年: 2020
畢業學年度: 109
語文別: 中文
論文頁數: 104
中文關鍵詞: 腦電圖生醫訊號處理癲癇辨識人工智慧穿戴式裝置硬體加速
外文關鍵詞: EEG, bio-signal processing, epilepsy identification, artificial intelligence, wearable device, hardware acceleration
相關次數: 點閱:103下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 本論文提出一個應用於穿戴式裝置即時癲癇檢測與辨識的RISC-V指令集可編程卷積類神經網路協同處理器。癲癇是臨床上常見的腦部疾病,發生癲癇的原因有很多種,且發作時間通常難以預知。癲癇的發作會對正常的精神細胞造成損害,情況危急時可能危及生命。要在癲癇發作的黃金時間內檢測到癲癇以實施必要的醫療措施,沒有穿戴式裝置的協助將很難達到。觀察腦電圖(Electroencephalography, EEG)是診斷癲癇必然的方法,想在穿戴式裝置對腦電圖進行初步的檢測與辨識,卷積類神經網路(Convolutional Neural Network, CNN)是一個理想並極具有潛力的演算法。然而機器學習基礎的演算法需要大量的運算資源進行訓練以及推算,使僅有軟體或僅有硬體的方法無法將之實現在資源有限的穿戴式裝置上。針對上述的挑戰,本論文提出三個主要的貢獻:首先提出一個高準確率卷積類神經網路訓練(Training)以及低功耗推算(Inference)的癲癇辨識架構,並實現一個可編程的協同處理器對推算進行卸載以降低運算超過106倍的運算時間,此外提出一個高效能的協同處理器介面來傳輸腦電圖資料以及RISC-V指令。
    整個癲癇辨識的流程分成主要包含兩個相位(phase):卷積類神經網路參數訓練與資料推算。在參數訓練的相位中,1kHz採樣頻率的腦電圖會被降頻到250Hz來降低運算的複雜度,並且將已標記的數據進行正規化來減少樣本之間的個體差異及環境變化對數據造成的影響。處理過後的數據會進行神經網路的訓練,並對網路的架構與參數進行格式轉換,提供資料的推算使用。在第二個相位中,卷積類神經網路的模型可經由數位傳輸協定上傳到硬體。透過RISC-V指令集兼容的代碼,主處理器可對協同處理器進行初始化以及腦電圖的資料傳輸,進而對卷積神經網路的推算進行卸載與加速。
    本論文所提出的癲癇辨識演算法,透過與國立成功大學醫學院進行之動物實驗證明在浮點數以及定點數的辨識準確率分別達到97.8%和93.5%。在硬體的即時資料監測方面,協同處理器對每兩秒的腦電圖資料辨識僅有0.012秒的延遲,並分別消耗51nJ 與 0.9µJ 的能源在每兩秒的資料傳輸以及推算。
    經過本論文所提出的卷積類神經網路架構以及協同處理器的設計,證明了人工智慧演算法在穿戴式癲癇辨識裝置上可獲得即時辨識、低功耗及高準確度的特性,使癲癇患者在癲癇訊號發生第一時間進行必要的醫療措施之需求得以實現,未來搭配迴授刺激器可即時抑制癲癇動作的行為發生。

    This thesis proposes a programmable RISC-V CNN coprocessor for real-time epilepsy detection and identification on wearable devices. Epilepsy is a common clinical disease. There are many causes of epilepsy, and the time of seizure onset is usually unpredictable. The onset of a seizure causes damage to normal nerve cells, which can be life-threatening in critical situations. It will be difficult to detect seizures during the golden window to implement necessary medical measures without the assistance of wearable devices. The observation of the Electroencephalography (EEG) signal is an imperative way to ensure correct epilepsy diagnosis. To detect and classify EEG signals on wearable devices, Convolutional Neural Network (CNN) is an intuitive and appropriate way to borrow expertise from neurologists. However, the computational cost of training and inference on artificial intelligence (AI)-based solutions make both software-only and hardware-only solutions incompetent for real-time monitoring on embedded devices. This paper proposes three key contributions for the challenge: an epilepsy detection framework to provide high precision CNN training and low power inference, a programmable coprocessor offloads inference reducing the computational time by ~106x, and an energy-efficient interface to reconfigure the coprocessor and transfer data with RISC-V instructions.
    The epilepsy detection flow contains two phases: CNN parameter training and data inference. In the parameter training phase, EEG data sampled with 1kHz are downsampled to 250Hz to reduce computational complexity. Then, the data will be normalized to decrease the individual differences and the environmental changes between different samples. Normalized data will be trained by CNN, and parameters of the trained CNN model will be transformed into 32Q16 format for data inference used. In the second phase, the configuration and parameters of the trained CNN model are updated to hardware by serial protocols. Through program codes with custom RISC-V instructions, the RISC-V core can initialize the coprocessor and transfer EEG data to offload and accelerate the CNN inference.
    Through animal experiments with lab rats, the proposed epilepsy detection algorithm performs 97.8% accuracy for floating-point operation and 93.5% for fixed-point. For real-time monitoring on hardware, the coprocessor consumes 51nJ and 0.9µJ energy for each 2 seconds data frame on data transfer and inference respectively.
    With the proposed CNN framework and the design of the coprocessor, implementing AI on wearable devices with high accuracy and low power to detect seizures is feasible. That makes patients who suffer from epilepsy can acquire the necessary medical measurements at the time of the seizure onset, and provide the stimulation to inhibit the behavior of seizure.

    摘要 I 致謝 IX 目錄 X 表目錄 XIII 圖目錄 XIV 第一章 緒論 1 1.1 研究動機 1 1.2 研究背景 1 第二章 癲癇與RISC-V嵌入式架構 3 2.1 癲癇介紹 3 2.2 癲癇的診斷與治療 4 2.3 動物實驗資料庫 4 2.3.1 動物實驗背景 5 2.3.2 腦電圖資料 6 2.4 RISC-V介紹 7 2.4.1 RISC-V 指令集 8 2.4.2 嵌入式系統架構 11 第三章 系統架構實現 20 3.1 軟體模型定義 22 3.1.1 訊號前處理 22 3.1.2 人工智慧演算法 25 3.1.2.1 卷積類神經網路 25 3.1.2.2 訓練參數 29 3.1.2.3 定義最佳模型 33 3.2 模型的格式轉換與傳輸 39 3.3 硬體設計 43 3.3.1 客製化指令 43 3.3.2 處理器與協同處理器的整合 45 3.3.3 客製化協同處理器介面 48 第四章 協同處理器的實現 56 4.1 協同處理器介面控制 57 4.2 卷積類神經網路狀態機 59 4.3 處理單元的設計 63 4.3.1 硬體的運算法則 63 4.3.2 處理單元的控制 66 第五章 晶片量測與模擬結果 68 5.1 數位電路設計流程 68 5.2 演算法量測結果 69 5.2.1 軟體量測結果 71 5.2.2 硬體量測結果 73 5.3 晶片量測結果 74 5.3.1 客製化協同處理器介面量測結果 75 5.3.2 癲癇辨識量測結果 78 5.3.3 晶片規格表 82 5.4 指令集模擬器分析結果 83 5.4.1 Gem5模擬器 84 5.4.2 指令集架構的模擬與比較 87 5.4.3 軟體實現與硬體實現之比較 90 第六章 結論與未來展望 92 6.1 作品比較 92 6.2 癲癇辨識演算法討論 94 6.3 嵌入式系統討論 96 6.4 未來展望 97 參考文獻 98 口試委員意見回覆 102

    [1] B. Abou-Khalil et al., Atlas of EEG & Seizure Semiology, Elsevier, 2006.
    [2] G. E. Hinton et al., A fast learning algorithm for deep belief nets, Neural Comp. 18, 1527–1554 (2006).
    [3] M. Salem, S. Taheri and J. Yuan, "ECG Arrhythmia Classification Using Transfer Learning from 2- Dimensional Deep CNN Features," 2018 IEEE Biomedical Circuits and Systems Conference (BioCAS), Cleveland, OH, 2018, pp. 1-4.
    [4] Ç. Sarvan and N. Özkurt, "ECG Beat Arrhythmia Classification by using 1-D CNN in case of Class Imbalance," 2019 Medical Technologies Congress (TIPTEKNO), Izmir, Turkey, 2019, pp. 1-4.
    [5] P. Nagabushanam, S. T. George, P. Davu, P. Bincy, M. Naidu and S. Radha, "Artifact Removal using Elliptic Filter and Classification using 1D-CNN for EEG signals," 2020 6th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 2020, pp. 551-556.
    [6] J. Wang, G. Yu, L. Zhong, W. Chen and Y. Sun, "Classification of EEG signal using convolutional neural networks," 2019 14th IEEE Conference on Industrial Electronics and Applications (ICIEA), Xi'an, China, 2019, pp. 1694-1698.
    [7] “Epilepsy factsheets.” World Health Organization. June 2019.
    [8] Commission on Classification and Terminology of the International League Against Epilepsy.: Proposal for revised clinical and electroencephalographic classification of epileptic seizures. Epilepsia 1981; 22: 489-501.
    [9] 陳倩, 臺北榮民總醫院神經內科癲癇科主治醫師, "抗癲癇藥物治療", http://vghtpe2015.hihost.com.tw/infors_view.php?minfoid=45&lmenuid=6&smenuid=16&pm=B04
    [10] Commission on classification and Terminology of the International League Against Epilepsy.: Proposal for revised classification of epilepsy and epileptic syndrome. Epilepsia 1989; 30: 389-99.
    [11] 陳倩, 臺北榮民總醫院神經內科癲癇科主治醫師, "什麼是癲癇", http://vghtpe2015.hihost.com.tw/infors_view.php?minfoid=42&lmenuid=6&smenuid=16&pm=B04
    [12] 林光麟, 林口長庚兒童醫院兒童神經科主任, “癲癇的診斷與治療”, https://www1.cgmh.org.tw/chldhos/intr/c4a90/new_page_52.htm
    [13] 林光麟, 林口長庚兒童醫院兒童神經科主任, “生酮優油飲食--吃好了癲癇”, http://www.chang-gung.com/news-1.aspx?type=Photo&id=233&mid=119&bid=3
    [14] 廖啟仲, 應用於癲癇抑制之光電刺激系統與癲癇辨識演算法硬體設計, 國立成功大學電機工程學系碩士論文, 2018.
    [15] Blume H. The surgical treatment of epilepsy. In: Schachter SC, Schomer DL, eds. The comprehensive evaluation and treatment of epilepsy. San Diego, CA: Academic Press; 1997. p. 197-206.
    [16] Reif PS, Strzelczyk A, Rosenow F. The history of invasive EEG evaluation in epilepsy patients. Seizure 2016.
    [17] D. A. Patterson and C. H. Sequin, “RISC I: A Reduced Instruction Set VLSI Computer,” Proceedings of the 8th annual symposium on Computer Architecture, Minneapolis, Minnesota, USA, 1981, pp. 443-457.
    [18] A. Waterman, et al., “The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Document Version 2.2,” RISC-V Foundation, May 2017.
    [19] RISC-V Foundation, Exchange. Available: https://riscv.org/exchange/cores-socs/
    [20] Hummingbird E203 Opensource Processor Core. Available: https://github.com/SI-RISCV/e200_opensource
    [21] 胡振波, 手把手教你設計CPU─RISC-V處理器篇, 2018.
    [22] A. Krizhevsky, et al., “ImageNet classification with deep convolutional neural networks,” Proceedings of the 25th International Conference on Neural Information Processing Systems, Lake Tahoe, Nevada, USA, 2012, pp. 1097-1105.
    [23] LeCun, Yann; Cortez, Corinna; Burges, Christopher C.J. "The MNIST Handwritten Digit Database". Yann LeCun's Website yann.lecun.com. Retrieved 30 April 2020.
    [24] Ali Shoeb. Application of Machine Learning to Epileptic Seizure Onset Detection and Treatment. PhD Thesis, Massachusetts Institute of Technology, September 2009.
    [25] Kingma, Diederik, and Jimmy Ba. "Adam: A method for stochastic optimization." arXiv preprint arXiv:1412.6980 (2014).
    [26] Russell D. Reed et al., Neural Smithing: Supervised Learning in Feedforward Artificial Neural Networks, 1999.
    [27] Smith, Leslie N., and Nicholay Topin. "Deep convolutional neural network design patterns." arXiv preprint arXiv:1611.00847 (2016).
    [28] S. Savas et al., Designing domain-specific heterogeneous architectures from dataflow programs, Computers 7 (2018) 27.
    [29] MATLAB Fixed-Point Concepts and Terminology, https://www.mathworks.com/help/dsp/ug/concepts-and-terminology.html
    [30] N. Binkert, et al., “The gem5 Simulator,” ACM SIGARCH Computer Architecture News, May 2011.
    [31] Jason Lowe-Power, “Learning Gem5”. Available: https://www.gem5.org/documentation/learning_gem5/introduction/
    [32] K. H. Lee, et al., “A Low-Power Processor With Configurable Embedded Machine-Learning Accelerators for High-Order and Adaptive Analysis of Medical-Sensor Signals,” IEEE JSSC, vol. 48, no. 7, pp. 1625-1637, July 2013.
    [33] S. Huang, et al., “A 1.9MW SVM Processor with On-Chip Active Learning for Epileptic Seizure Control,” IEEE Symp. VLSI Circuits, pp. 259-260, 2018.
    [34] M. Yang, et al., “Design of an Always-On Deep Neural Network-Based 1-µW Voice Activity Detector Aided With a Customized Software Model for Analog Feature Extraction,” IEEE JSSC, vol. 54, no. 6, pp. 1764-1777, June 2019.
    [35] M. A. Bin Altaf et al., “A 16-Channel Patient-Specific Seizure Onset and Termination Detection SoC With Impedance-Adaptive Transcranial Electrical Stimulator,” IEEE JSSCC, vol. 50, no. 11, pp. 2728-2740, Nov. 2015.
    [36] C. Cheng et al., “A Fully Integrated 16-Channel Closed-Loop Neural-Prosthetic CMOS SoC With Wireless Power and Bidirectional Data Telemetry for Real-Time Efficient Human Epileptic Seizure Control,” IEEE JSSCC, vol. 53, no. 11, pp. 3314-3326, Nov. 2018.
    [37] S. Huang et al., “A 1.9-mW SVM Processor With On-Chip Active Learning for Epileptic Seizure Control,” IEEE JSSCC, vol. 55, no. 2, pp. 452-464, Feb. 2020.
    [38] Tensorflow Post-training quantization, https://www.tensorflow.org/lite/performance/post_training_quantization

    無法下載圖示 校內:2025-12-01公開
    校外:不公開
    電子論文尚未授權公開,紙本請查館藏目錄
    QR CODE