VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY FACULTY OF COMPUTER SCIENCE & ENGINEERING ——————– * ——————— BACHELOR THESIS Study and Improve Few-shot Learning Techniques in Computer Vision Application Major: Computer Engineering Council: Computer Engineering 1 Supervisor: Dr. Le Thanh Sach Dr. Nguyen Ho Man Rang Reviewer: Dr. Nguyen Duc Dung —o0o— Student: Nguyen Duc Khoi (1752302) HO CHI MINH CITY, 8/2021 ĐẠ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ự do - Hạnh phúc TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA:KH & KT Máy tính ____ NHIỆM VỤ LUẬN ÁN TỐT NGHIỆP BỘ MÔN: KHMT ___________ Chú ý: Sinh viên phải dán tờ này vào trang nhất của bản thuyết trình MSSV: 1752302 Họ và Tên SV: NGUYEN DUC KHOI Ngành: Kỹ thuật Máy tính 1.
Đầu đề luận án: EN: A study on few-shot learning for computer vision applications VN: Nghiên cứu và cải tiến kỹ thuật học với số ít mẫu được làm nhãn cho các ứng dụng trong thị giác máy tính 2. Nhiệm vụ (yêu cầu về nội dung và số liệu ban đầu): • Study Deep learning, and do literature review for few-shot learning; • Propose a learning techinque for training deep models (in computer vision) with popuplar datasets on the Internet; • Apply few-learning to an application in computer vision, from training, tuning, to deploying the trained model on embeded systems supported by NVIDIA’s technologies. Ngày giao nhiệm vụ luận án: 01/ 01 /2021 4. Ngày hoàn thành nhiệm vụ: 01/ 08 /2021 5.
Họ tên giảng viên hướng dẫn: Phần hướng dẫn: 1) Lê Thành Sách Đồng hướng dẫn __________________ 2) Nguyễn Hồ Mẫn Rạng Đồng hướng dẫn __________________ Nội dung và yêu cầu LVTN đã được thông qua Bộ môn. Ngày tháng năm 2021 CHỦ NHIỆM BỘ MÔN GIẢNG VIÊN HƯỚNG DẪN CHÍNH (Ký và ghi rõ họ tên) (Ký và ghi rõ họ tên) Lê Thành Sách PHẦN DÀNH CHO KHOA, BỘ MÔN: Người duyệt (chấm sơ bộ): ________________________ Đơn vị: _______________________________________ Ngày bảo vệ: ___________________________________ Điểm tổng kết: _________________________________ Nơi lưu trữ luận án: _____________________________ TRƯỜNG ĐẠI HỌC BÁCH KHOA CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA KH & KT MÁY TÍNH Độc lập - Tự do - Hạnh phúc ---------------------------- Ngày 09 tháng 08 năm 2021 PHIẾU CHẤM BẢO VỆ LVTN (Dành cho người hướng dẫn) 1. Họ và tên SV: MSSV: 1752302 Họ và Tên SV: NGUYEN DUC KHOI Ngành: Kỹ thuật Máy tính 2. Đề tài: EN: A study on few-shot learning for computer vision applications VN: Nghiên cứu và cải tiến kỹ thuật học với số ít mẫu được làm nhãn cho các ứng dụng trong thị giác máy tính 3.
Họ tên người hướng dẫn: TS. Lê Thành Sách 4. Tổng quát về bản thuyết minh: Số trang: Số chương: Số bảng số liệu Số hình vẽ: Số tài liệu tham khảo: Phần mềm tính toán: Hiện vật (sản phẩm) 5. Tổng quát về các bản vẽ: - Số bản vẽ: Bản A1: Bản A2: Khổ khác: - Số bản vẽ vẽ tay Số bản vẽ trên máy tính: 6.
Những ưu điểm chính của LVTN: • The author masters different techniques required for designing deep learning models, and for training, tunning, and deploying models to GPU cards with NVIDIA’s technologies. • The thesis consists of a science and an engineering task related to deep learning as follows: (a) Science: improve a selected few-shot learning technique for computer vision. The author has proposed an idea that is based on the episodic training and the dense convolution. The proposed idea has been evaluated with popular datasets reserved for the reseach field, it can gain some improvements.
The reseach’s results have been submitted to an international conference and wait for the reviewers’ conclusions. (b) Engineering: apply the few-shot to train a selected computer vision task and then deploy the trained model to an embeded system GPU card. To this end, the author selected application “drowsiness detection”. He utilized few-shot to train YOLOv5 and then deploy the trained model to NVIDIA Jetson TX2 successfully.
The demo application can run and detect the drowsiness live. Những thiếu sót chính của LVTN: • The publication is not available at the defense’s time as designed. Đề nghị: Được bảo vệ þ Bổ sung thêm để bảo vệ o Không được bảo vệ o 9. Ba câu hỏi SV phải trả lời trước Hội đồng: 10.
Đánh giá chung (bằng chữ: giỏi, khá, TB): 10 (mười) Ký tên (ghi rõ họ tên) Lê Thành Sách TRƯỜNG ĐẠI HỌC BÁCH KHOA CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA KH & KT MÁY TÍNH Độc lập - Tự do - Hạnh phúc ---------------------------- Ngày 01 tháng 08 năm 2021 PHIẾU CHẤM BẢO VỆ LVTN (Dành cho người hướng dẫn/phản biện) 1. Họ và tên SV: Nguyễn Đức Khôi MSSV: 1752302 Ngành (chuyên ngành): Computer Engineering 2. Đề tài: Research and Apply Few-shot Learning Techniques in Drowsiness Detection 3. Họ tên người hướng dẫn/phản biện: Nguyễn Đức Dũng 4.
Tổng quát về bản thuyết minh: Số trang: Số chương: Số bảng số liệu Số hình vẽ: Số tài liệu tham khảo: Phần mềm tính toán: Hiện vật (sản phẩm) 5. Tổng quát về các bản vẽ: - Số bản vẽ: Bản A1: Bản A2: Khổ khác: - Số bản vẽ vẽ tay Số bản vẽ trên máy tính: 6. Những ưu điểm chính của LVTN: The thesis focus on detecting drowsiness from the human face using deep learning approaches. The team proposed using ResNet block instead of normal convolutional block in the YOLOv5 network to improve the detection accuracy.
The team also deploy this model to the embedded system (Jetson TX2) for realtime performance. The results show some improvement in the detection accuracy. Những thiếu sót chính của LVTN: The replacement of ResNet block in the network has been utilized for awhile, which makes this contribution a bit weak. The drowsiness detection problem, however, can be solved better by other vision techniques, which can be very fast and realtime.
The choice of current approach is very bias and need to be considered in the future. The few-shot learning scheme is irrelevant to the main topic we are discussing. Đề nghị: Được bảo vệ o Bổ sung thêm để bảo vệ o Không được bảo vệ o 9. 3 câu hỏi SV phải trả lời trước Hội đồng: a.
Why don't you use other vision algorithms to detect drowsiness? Even if it will give much better performance comparing to YOLO? b. Explain why Few-shot learning matter. The discussion need to be improved. Đánh giá chung (bằng chữ: giỏi, khá, TB): Giỏi Điểm: 9 /10 Ký tên (ghi rõ họ tên) Nguyễn Đức Dũng Declaration We hereby declare that this thesis titled ‘Research and Apply Few-shot LearningTech- niques in Computer Vision Application’ and the work presented in it are our own.
We confirm that: • This work was done wholly or mainly while in candidature for a degree at this Uni- versity. • Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this has been clearly stated. • Where we have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely our own work.
• We have acknowledged all main sources of help. • Where the thesis is based on work done by ourselves jointly with others, we have made clear exactly what was done by others and what we have contributed ourselves. Acknowledgments First and foremost, I am tremendously grateful for my advisers Dr. Sach Le Thanh and Dr.
Rang Nguyen Ho Man for their continuous support and guidance throughout my project, and for providing me the freedom to work on a variety of problems. Second, I take this opportunity to express gratitude to all of the Faculty of Computer Science and Engineering members for their help and support. I also thank my parents for the unceasin encouragement, support and attention. Abstract Artificial intelligence for driving is receiving more attention.
Drowsiness detection is one of the smaller tasks to improve the driving experience. A drowsiness detector can detect and warn the drivers when they fall asleep and prevent accidents caused by drivers’ drowsiness. A simple approach is to consider the drowsiness detection problem as an object detection problem. In this thesis, we adopt a powerful object detector called YOLOv5.
It is one of the most pop- ular frameworks for object detection that was released to the public. In our experiments, the YOLOv5 framework can achieve excellent detection performance with abundant supervised data. In terms of speed performance, we deploy the trained model to the Jetson TX2 using TensorRT, which significantly outperforms the released Pytorch implementation. In practice, we are not always able to access an abundant amount of labeled data.
The limited number of training examples can lead to severely deficient performance, as shown in our experiments. We propose to pretrain the model with other datasets to improve the overall performance without in- troducing any computational inference cost. We introduce a pretraining method from few-shot learning that achieves state-of-the-art in widely used few-shot learning benchmarks to pretrain the model. We extensively conduct experiments with several pretraining methods to analyze their transfer performance to object detection tasks.2 The Scope of the Thesis .3 Organization of the Thesis .1 Probabilities and Statistic Basics .3 Discrete Random Variables - Probability Mass Function .4 Continuous Random Variables - Probability Density Function .7 Expectation and Variance .2 Machine Learning Basics .3 Semi-supervised learning .3 Few-shot Learning .1 Few-shot Learning .3 Boosting few-shot visual learning with self-supervision .1 Two-stage Detectors .2 One-stage Detectors .2 Bag of freebies .3 A Strong Baseline for Few-Shot Learning .1 Joint Training of Episodic and Standard Supervised Strategies .2 Revisiting Pooling Layer .2 Results of Training ResNet-50-YOLOv5 from Scratch with Abundant Annota- tions .3 Performance of Deploying ResNet-50-YOLOv5 with TensorRT .1 Comparison between TensorRT and Pytorch .2 Effective of image’s resolution on performance .4 Result of Baseline on Few-shot Benchmarks .5 Results of Training ResNet-50-YOLOv5 with Limited Annotations .1 Results of Training ResNet-50-YOLOv5 from Scratch with Limited Annotations .2 Results of Training Pretrained ResNet-50-YOLOv5 with Limited An- notations .1 Network architecture terminology .1 Jetson TX2 Developer Kit .1 Developing and Deploying with Tensor RT.
48 List of Tables 2.2 Quantities in Confusion Matrix of Testing for Coronavirus .1 Evaluation of training ResNet-50-YOLOv5 from scratch .2 Performance of deploying trained ResNet-50-YOLOv5 into Jetson TX2 .3 Comparison to prior work on CIFAR-FS and FC100 .4 Comparison with previous works on mini-ImageNet .5 Evaluation of training ResNet-50-YOLOv5 from scratch .6 Comparison between Our Baseline and Standard Supervised Training on mini- ImageNet benchmark .7 Performance of mini-ImageNet-pretrained ResNet-50-YOLOv5 .8 Performance of ImageNet-pretrained ResNet-50-YOLOv5. 39 iii List of Figures 1.1 The graph of the standard normal distribution .2 Mnist digit dataset .3 Meta-SGD algorithms .6 Attention-based weight generator .10 You only look once model .11 Single Shot MultiBox Detector .2 Overall development of our system.3 a) Different kernel sizes of pooling layers applied to feature maps. b) Adapted pooling layer.5 resnet50xYOLOv5 architecture .2 mini-ImageNet sample images .3 Qualitative results of training ResNet-50-YOLOv5 from scratch with abundant annotations.4 Performance on different image sizes .5 Evaluation on different kernel sizes of the last pooling layer .6 Precision of mini-ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set .7 Recall of mini-ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set .5 of mini-ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set 38 5.95 of mini-ImageNet-pretrained ResNet-50-YOLOv5 on Valida- tion Set .10 Precision of ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set .11 Recall of ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set .5 of ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set .95 of ImageNet-pretrained ResNet-50-YOLOv5 on Validation Set 41 iv 7.1 Jetson TX2 Developer Kit components .2 NVIDIA SDK Manager .1 Motivation Drowsiness detection is usually applied in modern vehicles to enhance driving safety.