1. Trang chủ
  2. » Luận Văn - Báo Cáo

Ứng dụng mạng nơron học sâu vào bài toán phát hiện dị thường trên module quang điện

107 2 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

ĐẠI HỌC QUỐC GIA TP HCM TRƯỜNG ĐẠI HỌC BÁCH KHOA PHAN KHẮC PHÚC THIỆN ỨNG DỤNG MẠNG NƠRON HỌC SÂU VÀO BÀI TOÁN PHÁT HIỆN DỊ THƯỜNG TRÊN MODULE QUANG ĐIỆN USING DEEP NEURAL NETWORK FOR ANOMALY DETECTION OF SOLAR PHOTOVOLTAIC MODULES Chuyên ngành: Kỹ thuật điện Mã số: 8520201 LUẬN VĂN THẠC SĨ TP HỒ CHÍ MINH, tháng 02 năm 2023 CƠNG TRÌNH ĐƯỢC HỒN THÀNH TẠI TRƯỜNG ĐẠI HỌC BÁCH KHOA – ĐHQG – HCM Cán hướng dẫn khoa học: TS Nguyễn Phúc Khải (Ghi rõ họ, tên, học hàm, học vị chữ ký) Cán chấm nhận xét 1: TS Lê Thị Tịnh Minh (Ghi rõ họ, tên, học hàm, học vị chữ ký) Cán chấm nhận xét 2: PGS TS Lê Mỹ Hà (Ghi rõ họ, tên, học hàm, học vị chữ ký) Luận văn thạc sĩ bảo vệ Trường Đại học Bách Khoa, ĐHQG Tp HCM ngày 04 tháng 02 năm 2023 Thành phần Hội đồng đánh giá luận văn thạc sĩ gồm: (Ghi rõ họ, tên, học hàm, học vị Hội đồng chấm bảo vệ luận văn thạc sĩ) PGS TS Võ Ngọc Điều - Chủ tịch Hội đồng TS Huỳnh Quang Minh - Thư ký Hội đồng TS Lê Thị Tịnh Minh - Cán Phản biện PGS TS Lê Mỹ Hà - Cán Phản biện PGS TS Huỳnh Châu Duy - Ủy viên Hội đồng Xác nhận Chủ tịch Hội đồng đánh giá Luận văn Trưởng Khoa quản lý chuyên ngành sau luận văn sửa chữa (nếu có) CHỦ TỊCH HỘI ĐỒNG TRƯỞNG KHOA ĐIỆN – ĐIỆN TỬ ĐẠI HỌC QUỐC GIA TP HCM CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự – Hạnh phúc TRƯỜNG ĐẠI HỌC BÁCH KHOA Tp Hồ Chí Minh, ngày … tháng … năm 2023 NHIỆM VỤ LUẬN VĂN THẠC SĨ Họ tên học viên: PHAN KHẮC PHÚC THIỆN Ngày tháng năm sinh: 14/11/1997 Chuyên ngành: Kỹ thuật điện MSHV: 1970631 Nơi sinh: Đồng Tháp Mã số: 8520201 I TÊN ĐỀ TÀI Tên tiếng việt: Ứng dụng mạng nơron học sâu vào toán phát dị thường module quang điện Tên tiếng anh: Using Deep Neural Network for anomaly detection of solar photovoltaic modules II NHIỆM VỤ VÀ NỘI DUNG Tìm hiểu tốn phát dị thường ứng dụng cho Module quang điện phương pháp tác giả thực Tìm hiểu mơ hình mạng học sâu DenseNet Tìm hiểu phương pháp học chuyển giao mạng học sâu Xây dựng huấn luyện mơ hình DenseNet dựa phương pháp huấn luyện học chuyển giao ứng dụng cho phát dị thường Module quang điện Áp dụng phương pháp toán: phát dị thường Module quang điện cho hai tiêu chí lớp 12 lớp Tìm hiểu áp dụng phương pháp cải tiến hiệu suất ứng dụng vào toán phát dị thường Module quang điện Trình bày, so sánh kết đạt nhận xét III NGÀY GIAO NHIỆM VỤ: 15/09/2021 IV NGÀY HOÀN THÀNH NHIỆM VỤ: 18/12/2022 V CÁN BỘ HƯỚNG DẪN: TS NGUYỄN PHÚC KHẢI CÁN BỘ HƯỚNG DẪN CHỦ NHIỆM BỘ MÔN ĐÀO TẠO TS NGUYỄN PHÚC KHẢI TS NGUYỄN NHẬT NAM TRƯỞNG KHOA ĐIỆN – ĐIỆN TỬ PGS TS ĐỖ HỒNG TUẤN i LỜI CẢM ƠN Đầu tiên, tơi xin bày tỏ lịng biết ơn sâu sắc chân thành đến tất thầy cô trường Đại Học Bách Khoa TP.HCM nói chung, khoa Điện – Điện tử thầy cô mơn Hệ thống điện nói riêng Những người hướng dẫn, giảng dạy trang bị cho nhiều kiến thức quý báu năm học qua Đặc biệt, xin chân thành cảm ơn TS Nguyễn Phúc Khải dành thời gian quý báu để hướng dẫn tận tình, tạo điều kiện thuận lợi cho tơi q trình thực đề tài Ngồi ra, tơi muốn gửi lời cảm ơn đến TS Trương Hoàng Khoa – Khoa Điện – Điện tử, bạn Trần Minh Mẩn hỗ trợ tơi suốt q trình thực đề tài Cảm ơn gia đình người thân hết lịng tin tưởng tạo cho tơi niềm tin vào sống, tạo điều kiện tốt từ vật chất đến tinh thần để an tâm học tập, hồn thành tốt nhiệm vụ thân Cảm ơn tất bạn bè, người giúp đỡ tôi, người chia sẻ tơi kiến thức, tư liệu hữu ích, cần thiết suốt trình học tập thực đề án Trong trình thực đề tài, hạn chế kiến thức, lực thân, nên khơng thể tránh khỏi thiếu sót Tơi hy vọng nhận lời khuyên, góp ý chân thành từ thầy để tơi hồn thiện Tôi xin chân thành cảm ơn quý thầy cơ! TP Hồ Chí Minh, ngày … tháng 12 năm 2022 Học viên/ Tác giả Phan Khắc Phúc Thiện ii TÓM TẮT LUẬN VĂN Sự gia tăng nhu cầu Năng lượng tái tạo trở thành xu hướng phát triển tồn cầu nhiều thập kỷ qua nguồn điện truyền thống – sản xuất điện từ nhiên liệu hóa thạch – nguyên nhân nhiều vấn đề ô nhiễm môi trường Được đánh giá nguồn lượng tái tạo hàng đầu, module quang điện mặt trời (Photovoltaic module) lại dễ gặp phải rủi ro tượng dị thường trình lắp đặt vận hành như: nứt, vỡ bề mặt (Cracking) điểm nóng cục (Hot spot) Nếu khơng có giải pháp tồn diện, tượng khơng rút ngắn đáng kể tuổi thọ module PV mà gây suy giảm điện sản xuất từ hệ thống điện mặt trời (ĐMT) Với phát triển hệ thống ĐMT quy mô dân dụng quy mơ lớn, quy trình vận hành bảo trì nhà máy thu hút nhiều nguồn lực từ nghiên cứu khoa học phương pháp phù hợp để ngăn ngừa thiệt hại kinh tế lỗi hệ thống từ tượng bất thường module PV Để giải vấn đề, Luận văn đề xuất phương pháp huấn luyện học chuyển tiếp hai giai đoạn cho mơ hình mạng học sâu DenseNet-201 Một liệu với 20.000 hình ảnh nhiệt hồng ngoại (IR) thu thập nhiều hệ thống quang điện mặt trời sử dụng làm liệu huấn luyện kiểm tra Phương pháp Tăng cường liệu (Data Augmentation) Điều chỉnh hàm tổn thất (Weighting loss) áp dụng để khắc phục tình trạng thiếu hụt liệu cho nhóm liệu thiểu số nâng cao hiệu suất tổng thể mơ hình học sâu Các kết thu sau trình huấn luyện kiểm tra phân tích so sánh với phương pháp học chuyển tiếp giai đoạn, huấn luyện mạng từ đầu mô hình học sâu DenseNet-121, DenseNet-169, DenseNet-201 ResNet152, Qua cho thấy độ xác phân loại cao đạt phương pháp đề xuất so với kịch huấn luyện khác Ngoài ra, kết thu từ Luận văn vượt trội so với mơ hình phương pháp khác sử dụng tập liệu, hai toán nhận diện dị thường loại 12 loại Từ kết nêu trên, thấy phương pháp đề xuất phát phân loại tượng dị thường hiệu module PV thơng qua hình ảnh IR Đây coi đóng góp quan trọng hướng tới mục tiêu đảm bảo vận hành ổn định hệ thống ĐMT iii ABSTRACT Increase in global demand for sustainable energy has become a major trend over the past decade since the traditional sources which produce electricity from fossil fuel appeared to be the cause of many environmental issues Emerged as a leading renewable energy resource, Solar photovoltaic modules are easily exposed to the risk of several defects such as Cracking and Hot spot during its installation and operation process Without sufficient measurement, those anomaly phenomena not only could dramatically shorten PV modules lifetime but also cause an entire reduction on production of PV system With the development of PV system in both residential and utility-scale, the operation and maintenance process for PV plant drawn more attention from the literature for an adequate technique to prevent economic losses from faults of the system and from the PV panels itself To resolve the problem, a two-stage training pipeline was proposed based on transfer learning strategy for the pre-trained DenseNet-201 A dataset with 20,000 IR images captured on several solar photovoltaic systems was used for training and experimental purposes The augmentation method and tuning the weighting loss function have also been applied to overcome the lack of data for minority classes and enhance the overall performance of the deep learning model The obtained results from proposed method are compared to one-stage transfer learning, training the network from scratch approach on DenseNet-121, DenseNet-169, DenseNet-201, ResNet-152, As analysis of all metric results, the accuracy obtained from the proposed method is calculated as the best performance among the methods Moreover, it is witnessed that the proposed CNN method improved considerably the prediction accuracy compared to other methods in the literature, for two types of problem as 2-class and 12-class respectively Hence, as shown results illustrate an outstanding performance, it is argued that the proposed method can detect and classify effectively faults in PV modules through IR images This can be considered as a vital contribution toward the purpose of ensuring the stable operation of solar PV system as a whole iv LỜI CAM ĐOAN Tôi xin cam đoan đề tài luận văn cơng trình nghiên cứu độc lập hướng dẫn TS Nguyễn Phúc Khải Các nội dung tham khảo hồn tồn thân tơi tự đọc, dịch tài liệu, tổng hợp thực Các trích dẫn tài liệu tham khảo đánh dấu theo danh sách tài liệu tham khảo trình bày cuối báo cáo Các số liệu, mơ hình mơ đề tài hồn tồn tơi xây dựng chạy thử nghiệm suốt trình thực luận văn Tơi xin chịu hồn tồn trách nhiệm có thiếu trung thực minh bạch trình thực báo cáo Học viên/ Tác giả PHAN KHẮC PHÚC THIỆN v Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải MỤC LỤC CHƯƠNG MỞ ĐẦU 1.1 ĐẶT VẤN ĐỀ 1.2 HƯỚNG TIẾP CẬN ĐỀ TÀI 1.3 PHẠM VI NGHIÊN CỨU 1.4 MỤC TIÊU NGHIÊN CỨU 1.5 NỘI DUNG NGHIÊN CỨU 1.6 Ý NGHĨA CỦA ĐỀ TÀI CHƯƠNG TỔNG QUAN 2.1 TỔNG QUAN VỀ NHẬN DIỆN DỊ THƯỜNG TRÊN MODULE PV 2.2 CÁC PHƯƠNG PHÁP ĐÃ ĐƯỢC NGHIÊN CỨU 2.3 GIỚI THIỆU TẬP DỮ LIỆU THÍ NGHIỆM CHƯƠNG GIỚI THIỆU VỀ BÀI TOÁN PHÂN LOẠI ẢNH 11 3.1 TỔNG QUAN XỬ LÝ ẢNH SỐ 11 3.2 BIỂU DIỄN ẢNH TRONG MÁY TÍNH 15 3.3 PHÉP TÍCH CHẬP TRONG XỬ LÝ ẢNH 18 3.4 LÝ THUYẾT PHÂN LOẠI ẢNH SỐ 22 3.5 MỘT SỐ THUẬT TOÁN TIÊU BIỂU TRONG PHÂN LOẠI ẢNH 27 3.6 CÁC KHÁI NIỆM CHUNG VỀ MẠNG NƠRON 30 3.7 MẠNG NƠRON TÍCH CHẬP (CNN) 39 3.8 CÁC MẠNG NƠ-RON TÍCH CHẬP THƠNG DỤNG 46 CHƯƠNG ĐỀ XUẤT CẢI TIẾN MẠNG NƠ-RON CNN DENSENET CHO BÀI TOÁN NHẬN DIỆN DỊ THƯỜNG CỦA MODULE QUANG ĐIỆN 50 4.1 GIỚI THIỆU MẠNG DENSENET 50 Học viên: Phan Khắc Phúc Thiện vi Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải 4.2 HỌC CHUYỂN TIẾP VÀ TINH CHỈNH MƠ HÌNH HUẤN LUYỆN 56 4.3 ĐỀ XUẤT CÁC PHƯƠNG ÁN CẢI TIẾN MẠNG NƠ-RON DENSENET CHO BÀI TOÁN NHẬN DIỆN DỊ THƯỜNG CỦA MODULE QUANG ĐIỆN 57 CHƯƠNG ỨNG DỤNG MẠNG DENSENET VÀO BÀI TOÁN NHẬN DIỆN DỊ THƯỜNG CỦA MODULE QUANG ĐIỆN 66 5.1 XÂY DỰNG CÁC MƠ HÌNH HUẤN LUYỆN 66 5.2 KẾT QUẢ TÍNH TỐN 70 5.3 NHẬN XÉT VÀ KẾT LUẬN 76 CHƯƠNG TỔNG KẾT 78 6.1 KẾT QUẢ NGHIÊN CỨU ĐÃ ĐẠT ĐƯỢC 78 6.2 HẠN CHẾ, THIẾU SÓT 78 6.3 HƯỚNG PHÁT TRIỂN CỦA ĐỀ TÀI 79 TÀI LIỆU THAM KHẢO 80 PHỤ LỤC DỮ LIỆU ẢNH NHIỆT HỒNG NGOẠI MODULE PV TỪ RAPTOR MAPS INC 85 PHỤ LỤC CHƯƠNG TRÌNH HUẤN LUYỆN HỌC CHUYỂN TIẾP HAI GIAI ĐOẠN TRÊN DENSENET-201 89 Học viên: Phan Khắc Phúc Thiện vii Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải DANH SÁCH HÌNH VẼ Hình 2.1 Module PV với cell bị che bóng diode bypass kích hoạt Hình 2.2 Các mẫu ngẫu nhiên cho lớp từ tập liệu [20] 10 Hình 3.1 Các giai đoạn xử lý ảnh [21] 13 Hình 3.2 Minh họa hệ màu RGB 16 Hình 3.3 Ví dụ ảnh màu 16 Hình 3.4 Ví dụ biểu diễn ảnh theo ma trận chiều 17 Hình 3.5 Ví dụ ảnh xám 18 Hình 3.6 Minh họa phép tích chập xử lý ảnh 19 Hình 3.7 Ma trận đầu Y chập ảnh X với kernel W 20 Hình 3.8 Stride=1, padding=1 20 Hình 3.9 Stride=2, padding=1 21 Hình 3.10 Phương pháp lưới [22] 24 Hình 3.11 Phương pháp cung [22] 25 Hình 3.12 Biểu diễn mẫu tập kí hiệu [22] 27 Hình 3.13 Minh họa thuật toán KNN [23] 28 Hình 3.14 Cấu trúc nơron sinh học [23] 30 Hình 3.15 Nơron nhân tạo [22] 32 Hình 3.16 Mơ hình tốn học mạng nơron nhân tạo [22] 34 Hình 3.17 Nơron đầu vào với hàm hoạt hoá hàm hardlimit [22] 36 Hình 3.18 Phân loại mạng nơ ron [22] 37 Hình 3.19 Học có giám sát [22] 38 Hình 3.20 Học khơng có giám sát [22] 38 Hình 3.21 Học tăng cường [22] 39 Hình 3.22 Cách máy tính “nhìn” hình [14] 39 Hình 3.23 Mạng nơ-ron thơng thường (trái) CNN (phải) [25] 41 Hình 3.24 Kiến trúc mạng CNN [25] 42 Hình 3.25 Max pooling kích thước 2×2 43 Hình 3.26 Lớp kết nối đầy đủ [25] 44 Hình 3.27 Ví dụ bước phân loại ảnh sử dụng mạng CNN 45 Hình 3.28 Cấu trúc AlexNet 46 Hình 3.29 Kiến trúc VGG16 47 Học viên: Phan Khắc Phúc Thiện viii Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải TÀI LIỆU THAM KHẢO [1] M Le, V S Luong, D K Nguyen, V.-D Dao, N H Vu, and H H T Vu, “Remote anomaly detection and classification of solar photovoltaic modules based on deep neural network,” Sustain Energy Technol Assess., vol 48, p 101545, Dec 2021, doi: 10.1016/j.seta.2021.101545 [2] A Fernández et al., “Robust Detection, Classification and Localization of Defects in Large Photovoltaic Plants Based on Unmanned Aerial Vehicles and Infrared Thermography,” Appl Sci., vol 10, no 17, p 5948, Aug 2020, doi: 10.3390/app10175948 [3] M Sun, S Lv, X Zhao, R Li, W Zhang, and X Zhang, “Defect Detection of Photovoltaic Modules Based on Convolutional Neural Network,” in Machine Learning and Intelligent Communications, vol 226, X Gu, G Liu, and B Li, Eds Cham: Springer International Publishing, 2018, pp 122–132 doi: 10.1007/978-3-319-73564-1_13 [4] P Banda and L Barnard, “A deep learning approach to photovoltaic cell defect classification,” in Proceedings of the Annual Conference of the South African Institute of Computer Scientists and Information Technologists, Port Elizabeth South Africa, Sep 2018, pp 215–221 doi: 10.1145/3278681.3278707 [5] R Pierdicca, E S Malinverni, F Piccinini, M Paolanti, A Felicetti, and P Zingaretti, “Deep convolutional neural network for automatic detection of damaged photovoltaic cells,” Int Arch Photogramm Remote Sens Spat Inf Sci., vol XLII–2, pp 893–900, May 2018, doi: 10.5194/isprs-archives-XLII-2893-2018 [6] A Bartler, L Mauch, B Yang, M Reuter, and L Stoicescu, “Automated Detection of Solar Cell Defects with Deep Learning,” in 2018 26th European Signal Processing Conference (EUSIPCO), Rome, Sep 2018, pp 2035–2039 doi: 10.23919/EUSIPCO.2018.8553025 [7] S Deitsch et al., “Automatic classification of defective photovoltaic module cells in electroluminescence images,” Sol Energy, vol 185, pp 455–468, Jun 2019, doi: 10.1016/j.solener.2019.02.067 Học viên: Phan Khắc Phúc Thiện 80 Luận văn Thạc sĩ [8] GVHD: TS Nguyễn Phúc Khải A K V de Oliveira, M Aghaei, and R Rüther, “Automatic Inspection of Photovoltaic Power Plants Using Aerial Infrared Thermography: A Review,” Energies, vol 15, no 6, p 2055, Mar 2022, doi: 10.3390/en15062055 [9] M R U Rahman and H Chen, “Defects Inspection in Polycrystalline Solar Cells Electroluminescence Images Using Deep Learning,” IEEE Access, vol 8, pp 40547–40558, 2020, doi: 10.1109/ACCESS.2020.2976843 [10] O Breitenstein et al., “Can Luminescence Imaging Replace Lock-in Thermography on Solar Cells?,” IEEE J Photovolt., vol 1, no 2, pp 159–167, Oct 2011, doi: 10.1109/JPHOTOV.2011.2169394 [11] J A Tsanakas, L Ha, and C Buerhop, “Faults and infrared thermographic diagnosis in operating c-Si photovoltaic modules: A review of research and future challenges,” Renew Sustain Energy Rev., vol 62, pp 695–709, Sep 2016, doi: 10.1016/j.rser.2016.04.079 [12] Y Wang, K Itako, T Kudoh, K Koh, and Q Ge, “Voltage-based hot-spot detection method for PV string using projector,” in 2016 IEEE International Conference on Power and Renewable Energy (ICPRE), Shanghai, Oct 2016, pp 570–574 doi: 10.1109/ICPRE.2016.7871140 [13] M R Maghami, H Hizam, C Gomes, M A Radzi, M I Rezadad, and S Hajighorbani, “Power loss due to soiling on solar panel: A review,” Renew Sustain Energy Rev., vol 59, pp 1307–1316, Jun 2016, doi: 10.1016/j.rser.2016.01.044 [14] D Sharma, M F Jalil, M S Ansari, and R C Bansal, “A review of PV array reconfiguration techniques for maximum power extraction under partial shading conditions,” Optik, vol 275, p 170559, Mar 2023, doi: 10.1016/j.ijleo.2023.170559 [15] T Sun, H Xing, S Cao, Y Zhang, S Fan, and P Liu, “A novel detection method for hot spots of photovoltaic (PV) panels using improved anchors and prediction heads of YOLOv5 network,” Energy Rep., vol 8, pp 1219–1229, Nov 2022, doi: 10.1016/j.egyr.2022.08.130 Học viên: Phan Khắc Phúc Thiện 81 Luận văn Thạc sĩ [16] GVHD: TS Nguyễn Phúc Khải I Sutskever, J Martens, G Dahl, and G Hinton, “On the Importance of Initialization and Momentum in Deep Learning,” in Proceedings of the 30th International Conference on International Conference on Machine Learning Volume 28, Atlanta, GA, USA, 2013, p III-1139-III–1147 [17] A Dosovitskiy et al., “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale.” arXiv, 03, 2021 Accessed: 14, 2022 [Online] Available: http://arxiv.org/abs/2010.11929 [18] W Tang, Q Yang, K Xiong, and W Yan, “Deep learning based automatic defect identification of photovoltaic module using electroluminescence images,” Sol Energy, vol 201, pp 453–460, May 2020, doi: 10.1016/j.solener.2020.03.049 [19] M W Akram, G Li, Y Jin, X Chen, C Zhu, and A Ahmad, “Automatic detection of photovoltaic module defects in infrared images with isolated and develop-model transfer deep learning,” Sol Energy, vol 198, pp 175–186, Mar 2020, doi: 10.1016/j.solener.2020.01.055 [20] M Matthew, O Edward, and N Vadhavkar, “Infrared solar module dataset for anomaly detection,” in Int Conf Learn Represent Published online, 2020, pp 1– [21] N Aloysius and M Geetha, “A review on deep convolutional neural networks,” in 2017 International Conference on Communication and Signal Processing (ICCSP), Chennai, Apr 2017, pp 0588–0592 doi: 10.1109/ICCSP.2017.8286426 [22] N Sharma, V Jain, and A Mishra, “An Analysis Of Convolutional Neural Networks For Image Classification,” Procedia Comput Sci., vol 132, pp 377– 384, 2018, doi: 10.1016/j.procs.2018.05.198 [23] A A M Al-Saffar, H Tao, and M A Talab, “Review of deep convolution neural network in image classification,” in 2017 International Conference on Radar, Antenna, Microwave, Electronics, and Telecommunications (ICRAMET), Jakarta, Oct 2017, pp 26–31 doi: 10.1109/ICRAMET.2017.8253139 [24] D Korkmaz, H Acikgoz, and C Yildiz, “A Novel Short-Term Photovoltaic Power Forecasting Approach based on Deep Convolutional Neural Network,” Học viên: Phan Khắc Phúc Thiện 82 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải Int J Green Energy, vol 18, no 5, pp 525–539, Apr 2021, doi: 10.1080/15435075.2021.1875474 [25] B Li, C Delpha, D Diallo, and A Migan-Dubois, “Application of Artificial Neural Networks to photovoltaic fault detection and diagnosis: A review,” Renew Sustain Energy Rev., vol 138, p 110512, Mar 2021, doi: 10.1016/j.rser.2020.110512 [26] D Han, Q Liu, and W Fan, “A new image classification method using CNN transfer learning and web data augmentation,” Expert Syst Appl., vol 95, pp 43– 56, Apr 2018, doi: 10.1016/j.eswa.2017.11.028 [27] B Cai et al., “Fault detection and diagnostic method of diesel engine by combining rule-based algorithm and BNs/BPNNs,” J Manuf Syst., vol 57, pp 148–157, Oct 2020, doi: 10.1016/j.jmsy.2020.09.001 [28] S Thalagala and C Walgampaya, “Application of AlexNet convolutional neural network architecture-based transfer learning for automated recognition of casting surface defects,” in 2021 International Research Conference on Smart Computing and Systems Engineering (SCSE), Colombo, Sri Lanka, Sep 2021, pp 129–136 doi: 10.1109/SCSE53661.2021.9568315 [29] K Simonyan and A Zisserman, “Very Deep Convolutional Networks for LargeScale Image Recognition.” arXiv, 10, 2015 Accessed: 16, 2023 [Online] Available: http://arxiv.org/abs/1409.1556 [30] K He, X Zhang, S Ren, and J Sun, “Deep Residual Learning for Image Recognition.” arXiv, 10, 2015 Accessed: 16, 2023 [Online] Available: http://arxiv.org/abs/1512.03385 [31] C Szegedy et al., “Going Deeper with Convolutions.” arXiv, 16, 2014 Accessed: 16, 2023 [Online] Available: http://arxiv.org/abs/1409.4842 [32] G Huang, Z Liu, L van der Maaten, and K Q Weinberger, “Densely Connected Convolutional Networks.” arXiv, 28, 2018 Accessed: 01, 2022 [Online] Available: http://arxiv.org/abs/1608.06993 [33] S Zagoruyko and N Komodakis, “Wide Residual Networks.” arXiv, 14, 2017 Accessed: 16, 2022 [Online] Available: http://arxiv.org/abs/1605.07146 Học viên: Phan Khắc Phúc Thiện 83 Luận văn Thạc sĩ [34] GVHD: TS Nguyễn Phúc Khải S Ioffe and C Szegedy, “Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift.” arXiv, 02, 2015 Accessed: 16, 2023 [Online] Available: http://arxiv.org/abs/1502.03167 [35] L Toth, “Phone recognition with deep sparse rectifier neural networks,” in 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, Vancouver, BC, Canada, May 2013, pp 6985–6989 doi: 10.1109/ICASSP.2013.6639016 [36] S J Pan and Q Yang, “A Survey on Transfer Learning,” IEEE Trans Knowl Data Eng., vol 22, no 10, pp 1345–1359, Oct 2010, doi: 10.1109/TKDE.2009.191 [37] J Meng, Z Tan, Y Yu, P Wang, and S Liu, “TL-med: A Two-stage transfer learning recognition model for medical images of COVID-19,” Biocybern Biomed Eng., vol 42, no 3, pp 842–855, Jul 2022, doi: 10.1016/j.bbe.2022.04.005 [38] Z Fan, M Jamil, M T Sadiq, X Huang, and X Yu, “Exploiting Multiple Optimizers with Transfer Learning Techniques for the Identification of COVID19 Patients,” J Healthc Eng., vol 2020, pp 1–13, Nov 2020, doi: 10.1155/2020/8889412 [39] A Kolesnikov et al., “Big Transfer (BiT): General Visual Representation Learning.” arXiv, 05, 2020 Accessed: 14, 2022 [Online] Available: http://arxiv.org/abs/1912.11370 [40] D P Kingma and J Ba, “Adam: A Method for Stochastic Optimization.” arXiv, 29, 2017 Accessed: 14, 2023 [Online] Available: http://arxiv.org/abs/1412.6980 Học viên: Phan Khắc Phúc Thiện 84 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải PHỤ LỤC DỮ LIỆU ẢNH NHIỆT HỒNG NGOẠI MODULE PV TỪ RAPTOR MAPS INC Bảng Một số mẫu ngẫu nhiên cho nhãn tập liệu Loại Dữ liệu ngẫu nhiên NoAnomaly Cell Cell-Multi Cracking Học viên: Phan Khắc Phúc Thiện 85 Luận văn Thạc sĩ Loại GVHD: TS Nguyễn Phúc Khải Dữ liệu ngẫu nhiên Diode DiodeMulti Hot-Spot Hot-Spot Multi Học viên: Phan Khắc Phúc Thiện 86 Luận văn Thạc sĩ Loại GVHD: TS Nguyễn Phúc Khải Dữ liệu ngẫu nhiên Offline Module Shadowing Soiling Vegetation Học viên: Phan Khắc Phúc Thiện 87 Luận văn Thạc sĩ Loại Học viên: Phan Khắc Phúc Thiện GVHD: TS Nguyễn Phúc Khải Dữ liệu ngẫu nhiên 88 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải PHỤ LỤC CHƯƠNG TRÌNH HUẤN LUYỆN HỌC CHUYỂN TIẾP HAI GIAI ĐOẠN TRÊN DENSENET-201 import tensorflow as tf import numpy as np import PIL import PIL.Image from tensorflow import keras import tensorflow_hub as hub import time import requests from io import BytesIO import matplotlib.pyplot as plt import os import pathlib from tensorflow.keras.regularizers import l2 #Select data for 2-class or 12-class use = '12-class' def addr_data(use): if use == '2-class': return "C:/Users/Admin/Desktop/lvtn/code/classification/dataset" elif use == '12-class': return "C:/Users/Admin/Desktop/lvtn/code/classification/dataset/for 12-class" else: return None def classes_name(use): if use == '2-class': return ['Anomaly','No-Anomaly'] elif use == '12-class': return ['Cell', 'Cell-Multi', 'Cracking', 'Diode', 'Diode-Multi', 'Hot-Spot', 'HotSpot-Multi', 'No-Anomaly', 'Offline-Module', 'Shadowing', 'Soiling', 'Vegetation'] else: return None data_dir = addr_data(use) IMG_HEIGHT = 40 IMG_WIDTH = 24 CLASS_NAMES = classes_name(use) NUM_CLASSES = len(CLASS_NAMES) Học viên: Phan Khắc Phúc Thiện 89 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải BATCH_SIZE = 32 from tensorflow.keras.preprocessing.image import ImageDataGenerator train_datagen = ImageDataGenerator(rescale=1./255, featurewise_center=False, # set input mean to over the dataset samplewise_center=False, # set each sample mean to featurewise_std_normalization=False, # divide inputs by std of the dataset samplewise_std_normalization=False, # divide each input by its std zca_whitening=False, # apply ZCA whitening zoom_range = 0, # Randomly zoom image width_shift_range=0.2, # randomly shift images horizontally (fraction of total width) height_shift_range=0.2, # randomly shift images vertically (fraction of total height) horizontal_flip=True, # randomly flip images vertical_flip=False, shear_range=0.2, fill_mode="nearest") # randomly flip images valid_datagen = ImageDataGenerator(rescale=1./255) train_ds = train_datagen.flow_from_directory( data_dir+'/train/', target_size=(96, 96), batch_size=batch_size, class_mode='categorical') val_ds = valid_datagen.flow_from_directory( data_dir+'/validation/', class_mode='categorical', target_size=(96, 96), batch_size=batch_size) from tensorflow.keras.optimizers import Adam import tempfile check_point = os.path.join(tempfile.mkdtemp(), 'check_point') lr = 0.03 * BATCH_SIZE / 512 base_model=tf.keras.applications.DenseNet201(include_top=False,weights='imagenet' ,input_shape=(96, 96,3)) model=keras.Sequential() model.add(base_model) model.add(keras.layers.GlobalAveragePooling2D()) model.add(keras.layers.Dense(1024,activation='relu', kernel_regularizer=l2(l=0.03))) model.add(keras.layers.Dropout(0.3)) Học viên: Phan Khắc Phúc Thiện 90 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải model.add(keras.layers.Dense(128,activation='relu', kernel_regularizer=l2(l=0.03))) model.add(keras.layers.Dropout(0.1)) model.add(keras.layers.BatchNormalization()) model.add(keras.layers.Dense(NUM_CLASSES,activation='softmax')) for layer in base_model.layers: layer.trainable = True model.build(input_shape=(96, 96,3)) model.summary() keras.utils.plot_model(model, show_shapes=True) lr_schedule = tf.keras.optimizers.schedules.PiecewiseConstantDecay(boundaries= SCHEDULE_BOUNDARIES, values=[lr, lr*0.1, lr*0.01, lr*0.001]) optimizer = tf.keras.optimizers.SGD(learning_rate=lr_schedule, momentum=0.9) loss_fn = "categorical_crossentropy" earlystop = keras.callbacks.ModelCheckpoint(check_point,monitor='val_accuracy', save_best_only=True, save_weights_only=True) callbacks = [earlystop] metrics = ['accuracy',keras.metrics.TruePositives(name='tp'), keras.metrics.FalsePositives(name='fp'), keras.metrics.TrueNegatives(name='tn'), keras.metrics.FalseNegatives(name='fn'), keras.metrics.Precision(name='precision'), keras.metrics.Recall(name='recall'), keras.metrics.AUC(name='auc'), keras.metrics.AUC(name='prc', curve='PR'), precision-recall curve] model.compile(optimizer=optimizer, loss=loss_fn, metrics=metrics) # Fine-tune-stage-1 the model history = model.fit( train_ds, batch_size=BATCH_SIZE, steps_per_epoch=STEPS_PER_EPOCH, epochs= int(SCHEDULE_LENGTH / STEPS_PER_EPOCH), epochs = 100, validation_data = val_ds, callbacks=callbacks) #fine-tune stage lr = 0.03 * BATCH_SIZE / 512 base_model= tf.keras.applications.DenseNet201(include_top=False, weights='imagenet',input_shape=(96, 96,3)) model=keras.Sequential() model.add(base_model) model.add(keras.layers.GlobalAveragePooling2D()) model.add(keras.layers.Dense(1024,activation='relu', kernel_regularizer=l2(l=0.03))) model.add(keras.layers.Dropout(0.3)) Học viên: Phan Khắc Phúc Thiện 91 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải model.add(keras.layers.BatchNormalization()) #Adapt for 2-class purpose model.add(keras.layers.Dense(2,activation='softmax')) model.load_weights('best_weights_12class') model.build(input_shape=images.shape) model.summary() #freezing the trained model base_model.trainable = True for u,layer in enumerate(base_model.layers): print(layer.name,u) layer.trainable = False if layer.name == "pool4_pool": break SCHEDULE_LENGTH = 10000 SCHEDULE_BOUNDARIES = [0.3*SCHEDULE_LENGTH, 0.6*SCHEDULE_LENGTH, 0.9*SCHEDULE_LENGTH] model.compile(optimizer=optimizer, loss=loss_fn, metrics=metrics) # Fine-tune the model history = model.fit( train_ds, batch_size=BATCH_SIZE, steps_per_epoch=STEPS_PER_EPOCH, epochs= int(SCHEDULE_LENGTH / STEPS_PER_EPOCH), epochs = 100, validation_data = val_ds, callbacks=callbacks) print('max accuracy achieved:', max(history.history["val_accuracy"])*100) N = len(history.history['loss']) plt.plot(np.arange(0, N),history.history['accuracy']) plt.plot(history.history['val_accuracy']) plt.title('model performance') plt.ylabel('loss/ acc') plt.xlabel('epoch') plt.legend(['loss', 'val-loss', 'acc', 'val-acc'], loc='upper left') plt.show() import sklearn.metrics Học viên: Phan Khắc Phúc Thiện 92 Luận văn Thạc sĩ GVHD: TS Nguyễn Phúc Khải import itertools def plot_confusion_matrix(cm, class_names): figure = plt.figure(figsize=(8, 8)) plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues) plt.title("Confusion matrix") plt.colorbar() tick_marks = np.arange(len(class_names)) plt.xticks(tick_marks, class_names, rotation=45) plt.yticks(tick_marks, class_names) # Compute the labels from the normalized confusion matrix labels = np.around(cm.astype('float') / cm.sum(axis=1)[:, np.newaxis], decimals=2) # Use white text if squares are dark; otherwise black threshold = cm.max() / for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])): color = "white" if cm[i, j] > threshold else "black" plt.text(j, i, labels[i, j], horizontalalignment="center", color=color) plt.tight_layout() plt.ylabel('True label') plt.xlabel('Predicted label') return figure def log_confusion_matrix(epoch, logs): # Use the model to predict the values from the validation dataset test_pred_raw = model.predict(test_images) test_pred = np.argmax(test_pred_raw, axis=1) # Calculate the confusion matrix cm = sklearn.metrics.confusion_matrix(test_labels, test_pred) # Log the confusion matrix as an image summary figure = plot_confusion_matrix(cm, class_names=class_names) cm_image = plot_to_image(figure) test_predictions_baseline = model.predict(pipeline_test, batch_size=BATCH_SIZE) _,test_labels = pipeline_test Plot_cm(test_labels, test_predictions_baseline) Học viên: Phan Khắc Phúc Thiện 93 PHẦN LÝ LỊCH TRÍCH NGANG - Họ tên: Phan Khắc Phúc Thiện - Năm sinh: 14/11/1997 - Nơi sinh: Đồng Tháp - Địa liên lạc: 669 Nguyễn Hữu Kiếng, phường Hòa Long, xã Hòa An, Thành phố Cao Lãnh, tỉnh Đồng Tháp QUÁ TRÌNH ĐÀO TẠO - 2015 – 2019: Sinh viên đại học Trường Đại học Bách Khoa – Đại học Quốc gia thành phố Hồ Chí Minh, chuyên ngành Kỹ thuật Điện - Điện tử - 2019 – 2022: Học viên cao học Trường Đại học Bách Khoa – Đại học Quốc gia thành phố Hồ Chí Minh, chun ngành Kỹ thuật điện Q TRÌNH CƠNG TÁC - 07/2019 – 6/2021: Kỹ sư tư vấn Công ty TNHH Tư vấn Xây dựng điện Hịa Bình - 7/2021 – nay: Kỹ sư phát triển dự án Công ty TNHH GreenYellow Việt Nam

Ngày đăng: 10/04/2023, 22:17

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w