Đồ án khoa cơ điện, điện tử, đại học lạc hồng (16)

52 10 0
Đồ án khoa cơ điện, điện tử, đại học lạc hồng (16)

Đ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

ĐẠI HỌC LẠC HỒNG KHOA CƠ ĐIỆN ĐIỆN TỬ - BÁO CÁO NGHIÊN CỨU KHOA HỌC Đề tài: NHẬN DIỆN THỦ NGỮ HỖ TRỢ NGƯỜI CÂM PHẠM TÀI NĂNG TRIỆU VẦN PHAM Đồng nai, 6/2022 ĐẠI HỌC LẠC HỒNG KHOA CƠ ĐIỆN ĐIỆN TỬ - BÁO CÁO NGHIÊN CỨU KHOA HỌC Đề tài: NHẬN DIỆN THỦ NGỮ HỖ TRỢ NGƯỜI CÂM Chuyên ngành: Kỹ thuật Điện - Điện tử NGƯỜI HƯỚNG DẪN KHOA HỌC ThS :NGÔ KIM LONG SVTH: PHẠM TÀI NĂNG TRIỆU VẦN PHAM LỜI CẢM ƠN Cảm ơn thầy cô giúp đỡ chúng em trình học tập trình làm đồ án tốt nghiệp, cảm ơn thầy cô khoa Cơ Điện – Điện Tử với động viên tinh thần từ bạn bè gia đình ln phía sau ủng hộ Lời nói em xin cảm ơn đến Ban giám hiệu trường Đại Học Lạc Hồng, quý thầy cô khoa Cơ Điện – Điện Tử tận tình giúp đỡ chúng em suốt thời gian vừa qua em học tập trường Đặc biệt em xin gửi lời cảm ơn chân thành đến với thầy giáo ThS Ngô Kim Long trực tiếp giúp đỡ hướng dẫn em trình làm đồ án Đồng nai, ngày tháng năm 2022 Sinh viên thực Phạm Tài Năng Triệu Vần Pham LỜI CAM ĐOAN Tôi xin cam đoan cơng trình nghiên cứu tơi, số liệu, kết nêu đồ án tốt nghiệp trung thực xác Tơi xin cam đoan giúp đỡ cho việc thực đồ án tốt nghiệp xin phép, tất thông tin trích dẫn luận văn ghi rõ nguồn góc Sinh viên thực Phạm Tài Năng Triệu Vần Pham MỤC LỤC CHƯƠNG TỔNG QUAN 1.1 Đặt vấn đề 1.2 Tổng quan 1.3 Mục đích phạm vi nghiên cứu 1.4 Phương pháp nghiên cứu 1.4.1 Nghiên cứu tổng quan 1.4.2 Nghiên cứu lí thuyết CHƯƠNG 3 4 4 2.1 Giới thiệu phần cứng 2.2 Giới thiệu deep learning ứng dụng 2.3 Mơ hình Convolution Neural Network (CNN) 2.3.1 giới thiệu mạng CNN 2.3.2 Kiến trúc CNN 2.4 Các mô hình họ YOLO 2.4.1 Tổng quan YOLO 2.4.2 Kiến trúc YOLO v1 2.4.3 Kiến trúc YOLOv2 2.4.4 YOLO-v3 2.4.5 YOLOv4 CHƯƠNG THIẾT KẾ 10 10 10 11 11 12 12 13 14 15 3.1 Phát biểu toán 3.2 Thuật toán YOLOV5 3.2.1 Kiến trúc YOLO v5 3.2.2 Các pretrain-model YOLO v5 3.2.3 Hiệu suất kiến trúc YOLO v5 3.3 Các độ đo toán Object detection 3.3.1 Giới thiệu độ đo 3.3.2 Các độ đo toán object detection 3.4 Dữ liệu thực nghiệm 3.4.1 Tổng quan 3.4.2 Bảng tập liệu: 3.5 Quá trình huấn luyện kiểm thử 3.5.1 Cấu hình yêu cầu 3.5.2 Quá trình huấn luyện kiểm thử CHƯƠNG 34 15 16 16 17 17 18 18 19 21 21 21 22 22 23 4.1 Kết huấn luyện 4.2 Bảng thống kế thử nghiệm 25 27 4.2.1 Kết kiểm thử tập validation dataset 4.2.2 Kết kiểm thử tập testing dataset 4.3 Đánh giá kết thực nghiệm 4.4 Nhận xét CHƯƠNG 39 27 27 28 29 5.1 Kết đạt TÀI LIỆU THAM KHẢO 30 PHỤ LỤC DANH MỤC HÌNH ẢNH Hình 1 Găng tay chuyển ngữ 10 Hình Đồng hồ thông minh giúp người câm điếc 10 Hình Phần mềm lập trình visual code 12 Hình 2 Ngơn ngữ lập trình Python 3.7 13 Hình Quy trình cho toán học sâu 15 Hình Mơ hình convolution neural network 17 Hình Sơ đồ phát triển thuật toán YOLO 19 Hình Mơ hình kiến trúc YOLO v1 phiên .19 Hình Mơ hình kiến trúc Yolov2 20 Hình Mơ hình kiến trúc YOLOv3 20 Hình Mơ hình kiến trúc YOLOv4 21 Hình Mơ hình kiến trúc YOLO v5 .25 Hình Confusion matrix 27 Hình 3 Hình ảnh tập huấn luyện 30 Hình Hình ảnh trình huấn luyện model epoch thứ 99 33 Hình Kết đánh giá tập validation dataset .33 Hình Kết đánh giá tập testing dataset 34 Hình Ảnh dự đốn tập test 28 Hình Nhận diện chữ A phát âm 39 Hình Nhận diện chữ B phát âm 39 DANH MỤC BẢNG BI Bảng Tập liệu huấn luyện .30 Bảng Cấu hình tham số model 31 Y Bảng Kết tửu tập validation dataset .36 Bảng Kết kiểm thử tập testing dataset 36 4.2 Bảng thống kế thử nghiệm 4.2.1 Kết kiểm thử tập validation dataset Bảng Kết tửu tập validation dataset Class mAP@.5 Map.5:.95 All 0.995 0.875 A 0.995 0.865 B 0.995 0.885 4.2.2 Kết kiểm thử tập testing dataset Bảng Kết kiểm thử tập testing dataset Class mAP@.5 Map.5:.95 All 0.968 0.662 36 A 0.955 0.614 B 0.98 0.71 Một số kết thu được: Hình Ảnh dự đốn tập test Đánh giá kết thực nghiệm: Từ thực nghiệm ta thấy model YOLOv5 hiệu tốn phân biệt ký hiệu thủ ngữ mơ hình phát cách nhanh chóng xác điều kiện ánh sáng vị trí khác ảnh, không hành động mà mơ hình nhận diện nhiều hành động lúc, thực nghiệm kết mAP đạt tới (%) chứng tỏ mơ hình học tốt với tập liệu - Hạn chế: 37 - Do liệu hành vi thủ ngữ không nhiều nên chưa thể cài đặt với tất kí hiệu thủ ngữ - Ở số trường hợp ảnh bị mờ mơ hình có tình trạng nhận diện sai hành vi, ngồi cịn vài điểm hạn chế ký hiệu xa mô hình chưa hồn tồn nhận diện xác 4.4 Nhận xét -Ưu điểm: Hỗ trợ người câm điếc dễ dàng việc giao tiếp, giúp đỡ y bác sĩ phiên dịch ngôn ngữ giảm tải áp lực công việc -Hạn chế: - Do liệu hành vi thủ ngữ không nhiều nên chưa thể cài đặt với tất kí hiệu thủ ngữ - Ở số trường hợp ảnh bị mờ mơ hình có tình trạng nhận diện sai hành vi, ngồi cịn vài điểm hạn chế ký hiệu xa mơ hình chưa hồn tồn nhận diện xác 38 Chương Kết luận CHƯƠNG KẾT LUẬN 5.1 Kết đạt Hình Nhận diện chữ A phát âm Hình Nhận diện chữ B phát âm 39 Chương Kết luận Trong phạm vi nghiên cứu thực nghiệm nhận diện thủ ngữ với YOLO v5, đồ án tiến hành tìm hiểu thuật tốn có liên quan đến đến mạng neural network, kiến trúc từ YOLOv1 tới YOLOv5 cụ thể đồ án đạt kết sau:  Nghiên cứu ưu nhược điểm mơ hình thuật tốn lựa chọn mơ hình phù hợp tốn nhận diện thủ ngữ  Thử nghiệm thuật toán với tham số khác mơ hình đưa tham số tốt mơ hình  Đạt tính nhân văn đề tài hội giúp người câm điếc có sống gần người bình thường Dựa kết nghiên cứu thực nghiệm đồ án đưa số kiến nghị các hướng phát triển tương lai sau:  Tiếp tục thực nghiệm với ký tự khác bảng chữ latin  Bổ xung thêm nhận diện hành động hay gặp công việc giao tiếp xã hội hàng ngày  Cải tiến tốc độ triển khai thực tế đảm bảo realtime tiết kiệm chi phí  tính tốn mức nhỏ Triển khai mơ hình lên raspberry pi4 đem lại tính ứng dụng thực tế cao việc giúp đỡ người câm xã hội 40 TÀI LIỆU THAM KHẢO Website: 2018 arxiv [Online] 2018 https://arxiv.org/abs/2104.10419 2020 arxiv [Online] 23, 2020 https://arxiv.org/abs/2004.10934 2018 arxiv [Online] 8, 2018 https://arxiv.org/abs/1804.02767 2020 arxiv [Online] 23, 2020 https://arxiv.org/abs/2004.10934 2020 developer.ibm [Online] 11 8, 2020 https://developer.ibm.com/articles/an-introduction-todeep-learning/ 2019 en.wikipedia [Online] 2019 https://en.wikipedia.org/wiki/Convolutional_neural_network 2021 esearchgate [Online] 2021 https://www.researchgate.net/publication/349299852_A_Forest_Fire_Detection_System_Based_on _Ensemble_Learning 2021 github [Online] 10 2021 https://github.com/ultralytics/yolov5/releases 2021 journalofbigdata.springeropen [Online] 31, 2021 https://journalofbigdata.springeropen.com/articles/10.1186/s40537-021-00444-8 pjreddie [Online] https://pjreddie.com/darknet/yolo/ 2022 pyimagesearch [Online] 4, 2022 https://pyimagesearch.com/2022/04/04/introduction-tothe-yolo-family/ 2021 researchgate [Online] 2021 https://www.researchgate.net/figure/YOLO-architecture-YOLOarchitecture-is-inspired-by-GooLeNet-model-for-image_fig2_329038564 2021 section.io [Online] 15, 2021 https://www.section.io/engineering-education/introductionto-yolo-algorithm-for-object-detection/#:~:text=YOLO%20is%20an%20abbreviation %20for,probabilities%20of%20the%20detected%20images 2022 viblo.asia [Online] 29, 2022 https://viblo.asia/p/tong-hop-kien-thuc-tu-yolov1-den-yolov5phan-1-naQZRRj0Zvx Phụ lục CODE nhận diện hành vi def parse_opt(): parser = argparse.ArgumentParser() parser.add_argument(' weights', type=str, default=ROOT / 'runs/train/exp/weights/best.pt', help='model path(s)') parser.add_argument(' source', type=str, default=ROOT / 'data/images', help='file/dir/URL/glob, for webcam') parser.add_argument(' data', type=str, default=ROOT / 'data/sign.yaml', help='(optional) dataset.yaml path') parser.add_argument(' imgsz', ' img', '-img-size', nargs='+', type=int, default=[640], help='inference size h,w') parser.add_argument(' conf-thres', type=float, default=0.25, help='confidence threshold') parser.add_argument(' iou-thres', type=float, default=0.45, help='NMS IoU threshold') parser.add_argument(' max-det', type=int, default=1000, help='maximum detections per image') parser.add_argument(' device', default='', help='cuda device, i.e or 0,1,2,3 or cpu') parser.add_argument(' view-img', action='store_true', help='show results') parser.add_argument(' save-txt', action='store_true', help='save results to *.txt') parser.add_argument(' save-conf', action='store_true', help='save confidences in save-txt labels') parser.add_argument(' save-crop', action='store_true', help='save cropped prediction boxes') parser.add_argument(' nosave', action='store_true', help='do not save images/videos') parser.add_argument(' classes', nargs='+', type=int, help='filter by class: classes 0, or classes 3') parser.add_argument(' agnostic-nms', action='store_true', help='class-agnostic NMS') parser.add_argument(' augment', Giải thích rõ Hàm def parse_opt(): định nghĩa tham số truyền vào, mục đích cháy cấu hình bên hàm nhận diện Trong đó: tham số tham số cấu hình model, type kiểu liệu truyền vào, default khơng truyền vào tham số model tự động sử dụng default, help giống document dòng lệnh  parser.add_argument('-weights',type=str, default=ROOT / 'runs/train/exp/weights/best.pt', help='model path(s)') weights model sau huấn luyện, 'runs/train/exp/weights/best.pt' file weights lưu sau huấn luyện  parser.add_argument(' source', type=str, default=ROOT / 'data/images', help = 'file/dir/URL/glob, for webcam') source file ảnh video webcam ta cấu hình  parser.add_argument(' data', type=str, default=ROOT / 'data/sign.yaml', help='(optional) dataset.yaml path') data file cấu hình liệu tập huấn luyện đánh giá, kiểm thử  parser.add_argument(' imgsz', ' img', ' img-size', , type=int, default=[640], help='inference size h,w') imgsz cấu hình file ảnh, mặc định (640x640) action='store_true', help='augmented inference') parser.add_argument(' visualize', action='store_true', help='visualize features') parser.add_argument(' update', action='store_true', help='update all models') parser.add_argument(' project', default=ROOT / 'runs/detect', help='save results to project/name') parser.add_argument(' name', default='exp', help='save results to project/name') parser.add_argument(' exist-ok', action='store_true', help='existing project/name ok, not increment') parser.add_argument(' line-thickness', default=3, type=int, help='bounding box thickness (pixels)') parser.add_argument(' hide-labels', default=False, action='store_true', help='hide labels') parser.add_argument(' hide-conf', default=False, action='store_true', help='hide confidences') parser.add_argument(' half', action='store_true', help='use FP16 halfprecision inference') parser.add_argument(' dnn', action='store_true', help='use OpenCV DNN for ONNX inference') opt = parser.parse_args() opt.imgsz *= if len(opt.imgsz) == else # expand print_args(FILE.stem, opt) return opt  parser.add_argument(' conf-thres', type=float, default=0.25, help='confidence threshold') conf-thres xác suất dự đốn, lớn 25> xác định kí hiệu, ngược lại khơng  parser.add_argument(' iou-thres', type=float, default=0.45, help='NMS IoU threshold') iou-thres giữ lại bouding box với xác suất > 45%  parser.add_argument(' device', default='', help='cuda device, i.e or 0,1,2,3 or cpu') -device lựa chọn 0,1,2,3,4 với cpu, 1,2,3,4 số lượng GPU có máy tính  parser.add_argument(' view-img', action='store_true', help='show results') view-img hiển thị hình ảnh lên hình  parser.add_argument(' save-txt', action='store_true', help='save results to *.txt') save-txt lưu lại kết dạng txt  parser.add_argument(' visualize', action='store_true', help='visualize features') visualize hiển thị biểu đồ sau dự đoán  parser.add_argument(' name', default='exp', help='save results to project/name') name chọn đường dẫn để lưu kết mơ hình chạy Ngồi số cài đặt tác giả để mặc định, line-thickness', hiden-cof, half Code load liệu để dự đoán if webcam: view_img = check_imshow() cudnn.benchmark = True # set True to speed up constant image size inference dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt) bs = len(dataset) # batch_size else: dataset = LoadImages(source,img_size=imgsz, stride=stride, auto=pt) bs = # batch_size Đoạn code có mục đích kiểm tra lệnh truyền vào webcam tiền hành mở webcam để đọc ảnh ngược lại đọc ảnh từ tập ảnh video mà ta cấu hình trên: If webcam: Nếu sử dụng webcam  view_img = check_imshow() kiểm tra xem có lỗi q trình mở cam hay khơng  cudnn.benchmark = True đặt cho ảnh đầu vào size với ảnh train model  dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt) load ảnh từ webcam resize  bs = len(dataset) batch_size mục đích cắt video thành frame với số lượng frame bs else: ngược lại  LoadImages(source,img_size=imgsz, stride=stride, auto=pt) Load ảnh từ folder  Bs = Cắt video thành frame # Load model device = select_device(device) model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data) stride, names, pt, jit, onnx, engine = model.stride, model.names, model.pt, model.jit, model.onnx, model.engine imgsz = check_img_size(imgsz, s=stride) # check image size Đọc file trọng số đặt cấu hình giống với cấu hình truyền vào từ đầu  device = select_device(device) chọn phần cứng tính tốn  model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data) load file trọng số  stride, names, pt, jit, onnx, engine = model.stride, model.names, model.pt, model.jit, model.onnx, model.engine imgsz = check_img_size(imgsz, s=stride) càu đặt cấu hình tham số network pred = model(im, augment=augment, visualize=visualize) pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det) Dự đoán bouding box loại bỏ bouding box thừa trả kết frame  pred = model(im, augment=augment, visualize=visualize) hàm dự đoán truyền vào frame  pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det) dự đoán ảnh trả list thơng số bên thông số bao gồm tọa độ bàn tay, xác suất dự đoán hành vi bàn tay  annotator = Annotator(im0, line_width=line_thickness, example=str(names)) annotator = Annotator(im0, line_width=line_thickness, example=str(names)) im0 = annotator.result() hàm có chức vẽ lên hình chữ nhật bao quanh hành vi nhãn hành vi dự đoán if view_img: cv2.imshow(str(p), im0) cv2.waitKey(1) # millisecond  if view_img: cv2.imshow(str(p), im0) cv2.waitKey(1) # millisecond hiển thị ảnh lên hình class_name = int(det[0].numpy()[-1]) if frame_num % 10 == 0: if class_name == 0: import os import time os.system("A.wav") time.sleep(2) else: import os import time os.system("B.wav") time.sleep(2) Đoạn code phát âm  class_name = int(det[0].numpy()[-1]) lấy thông tin hành vi ảnh trả từ model  if frame_num % 10 == sau 10 frame thực kiện kiểm tra lần, làm frame khơng đảm bảo thời gian  if class_name == 0: import os import time os.system("A.wav") time.sleep(2) đoạn code kiểm tra trả ký hiệu ‘A’ phát file ‘A.wav’ ngược lại phát file ‘B.wav’ CODE file huấn luyện Code file cấu hình def parse_opt(known=False): parser = argparse.ArgumentParser() parser.add_argument(' weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path') parser.add_argument(' cfg', type=str, default='', help='model.yaml path') parser.add_argument(' data', type=str, default=ROOT / 'data/data.yaml', help='dataset.yaml path') parser.add_argument(' hyp', type=str, default=ROOT / 'data/hyps/hyp.scratchlow.yaml', help='hyperparameters path') parser.add_argument(' epochs', type=int, default=300) parser.add_argument(' batch-size', type=int, default=12, help='total batch size for all GPUs, -1 for autobatch') parser.add_argument(' imgsz', ' img', ' imgsize', type=int, default=640, help='train, val image size (pixels)') parser.add_argument(' rect', action='store_true', help='rectangular training') parser.add_argument(' resume', nargs='?', const=True, default=False, help='resume most recent training') parser.add_argument(' nosave', action='store_true', help='only save final checkpoint') parser.add_argument(' noval', action='store_true', help='only validate final epoch') parser.add_argument(' noautoanchor', action='store_true', help='disable AutoAnchor') parser.add_argument(' evolve', type=int, nargs='?', const=300, help='evolve hyperparameters for x generations') parser.add_argument(' bucket', type=str, default='', help='gsutil bucket') parser.add_argument(' cache', type=str, nargs='?', const='ram', help=' cache images in "ram" (default) or "disk"') parser.add_argument(' image-weights', action='store_true', help='use weighted image selection for training') Hàm def parse_opt(): định nghĩa tham số truyền vào, mục đích cháy cấu hình bên hàm huấn luyện Trong đó: tham số tham số cấu hình model, type kiểu liệu truyền vào, default không truyền vào tham số model tự động sử dụng default, help giống document dòng lệnh  parser.add_argument(' weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path') weights file pretrain model, mặc định yolov5s.pt ngồi sử dụng model size khác yolov5x.pt, yolov5m.pt…  parser.add_argument(' cfg', type=str, default='', help='model.yaml path') cfg file cấu hình trình training, 'data/data.yaml' đường dẫn mặc định cài đặt  parser.add_argument(' hyp', type=str, default=ROOT / 'data/hyps/hyp.scratchlow.yaml' hyp file chứa tham số mặc định tác giả cung cấp  parser.add_argument(' epochs', type=int, default=300) Số lần lặp trình training, mặc định 300  parser.add_argument(' batch-size', type=int, default=12, help='total batch size for all GPUs, -1 for autobatch') batch-size số ảnh truyền vào trình đào tạo theo batch, chọn lớn tốt, Vram nhỏ nên chọn tối đa 12  parser.add_argument(' imgsz', ' img', ' imgsize', type=int, default=640, help='train, val image size (pixels)') parser.add_argument(' device', default='', help='cuda device, i.e or 0,1,2,3 or cpu') parser.add_argument(' freeze', nargs='+', type=int, default=[0], help='Freeze layers: backbone=10, first3=0 2') parser.add_argument(' save-period', type=int, default=-1, help='Save checkpoint every x epochs (disabled if < 1)') parser.add_argument(' local_rank', type=int, default=-1, help='DDP parameter, not modify') # Weights & Biases arguments parser.add_argument(' entity', default=None, help='W&B: Entity') parser.add_argument(' upload_dataset', nargs='?', const=True, default=False, help='W&B: Upload data, "val" option') parser.add_argument(' bbox_interval', type=int, default=-1, help='W&B: Set boundingbox image logging interval') parser.add_argument(' artifact_alias', type=str, default='latest', help='W&B: Version of dataset artifact to use') opt = parser.parse_known_args()[0] if known else parser.parse_args() return opt imgsz size ảnh đầu vào huyến luyện, mặc định (640x640x3)  parser.add_argument(' device', default='', help='cuda device, i.e or 0,1,2,3 or cpu') device chọn phần cứng để tính tốn, cpu, 1,2,3 số lượng GPU máy huấn luyện  parser.add_argument(' optimizer', type=str, choices=['SGD', 'Adam', 'AdamW'], default='SGD', help='optimizer') optimizer chọn thuật toán tối ưu, thuật toán thường dùng ‘SGD’, ‘Adam’, mặc định ‘SGD’ Ngoài số tham số khác tác giả đề xuất cài mặc định code Code tạo kiến trúc huấn luyện check_suffix(weights, '.pt') # check weights pretrained = weights.endswith('.pt') if pretrained: with torch_distributed_zero_first(LOCAL_RANK): weights = attempt_download(weights) # download if not found locally ckpt = torch.load(weights, map_location='cpu') # load checkpoint to CPU to Đoạn code mục đích kiểm tra xem file cấu hình truyền vào sử dụng pretrain model huấn luyện để huẩn luyện,hay huấn luyện lại model từ đầu  check_suffix(weights, '.pt') Kiểm tra xem có truyền vào file pretrain model hay không  if pretrained: with torch_distributed_zero_first(LOCAL_RANK) : weights = attempt_download(weights) torch.load(weights, map_location='cpu') avoid CUDA memory leak model = Model(cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create exclude = ['anchor'] if (cfg or hyp.get('anchors')) and not resume else [] # exclude keys csd = ckpt['model'].float().state_dict() # checkpoint state_dict as FP32 csd = intersect_dicts(csd, model.state_dict(), exclude=exclude) # intersect model.load_state_dict(csd, strict=False) # load LOGGER.info(f'Transferred {len(csd)}/ {len(model.state_dict())} items from {weights}') # report else: model = Model(cfg, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create Nếu dung pretrain model truyền vào để tiếp tục huấn luyện tiến hành download pretrain model từ trang chủ  model = Model(cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) mục đích truyền vào tham số trình huấn luyện, bao gồm số class, cấu hình anchors else:  model = Model(cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) Ngược lại Model gọi kiến trúc Yolov5 tạo train_loader, dataset = create_dataloader(train_path, imgsz, batch_size // WORLD_SIZE, gs, single_cls, hyp=hyp, augment=True, cache=None if opt.cache == 'val' else opt.cache, rect=opt.rect, rank=LOCAL_RANK, workers=workers, image_weights=opt.image_weights, quad=opt.quad, prefix=colorstr('train: '), shuffle=True) Load liệu gán nhãn tạo thành batch trình huấn luyện train_path file chứa liệu huấn luyện img, batch_size, single_clas, hyp, augment, cache… tham số lấy từ file cấu hình Load liệu kiểm chứng tương tự load liệu huấn luyện định nghĩa bên val_loader = create_dataloader(val_path, imgsz, batch_size // WORLD_SIZE, gs, single_cls, hyp=hyp, augment=True, cache=None if opt.cache == 'val' else opt.cache, rect=opt.rect, rank=LOCAL_RANK, workers=workers, image_weights=opt.image_weights, quad=opt.quad, prefix=colorstr('val: '), shuffle=True) for epoch in range(start_epoch, epochs): # epoch model.train() optimizer.zero_grad() scaler.scale(loss).backward() Thực huấn luyện mơ hình với liệu huấn luyện liệu kiểm thử xử lý phía  for epoch in range(start_epoch, epochs): Duyệt từ epoch thứ đến epoch thứ 300 định nghĩa file cấu hình if ni - last_opt_step >= accumulate: scaler.step(optimizer) # optimizer.step scaler.update() optimizer.zero_grad() if ema: ema.update(model) last_opt_step = ni  optimizer.zero_grad() scaler.scale(loss).backward() thực tính toán đạo hàm ngược  if ni - last_opt_step >= accumulate: scaler.step(optimizer) # optimizer.step scaler.update() optimizer.zero_grad() if ema: ema.update(model) last_opt_step = ni Thực tính tốn cập nhật tham số tối ưu cho model ...Đồng nai, 6/2022 ĐẠI HỌC LẠC HỒNG KHOA CƠ ĐIỆN ĐIỆN TỬ - BÁO CÁO NGHIÊN CỨU KHOA HỌC Đề tài: NHẬN DIỆN THỦ NGỮ HỖ TRỢ NGƯỜI CÂM Chuyên ngành: Kỹ thuật Điện - Điện tử NGƯỜI HƯỚNG DẪN KHOA HỌC... trình học tập trình làm đồ án tốt nghiệp, cảm ơn thầy cô khoa Cơ Điện – Điện Tử với động viên tinh thần từ bạn bè gia đình ln phía sau ủng hộ Lời nói em xin cảm ơn đến Ban giám hiệu trường Đại Học. .. em xin cảm ơn đến Ban giám hiệu trường Đại Học Lạc Hồng, quý thầy cô khoa Cơ Điện – Điện Tử tận tình giúp đỡ chúng em suốt thời gian vừa qua em học tập trường Đặc biệt em xin gửi lời cảm ơn chân

Ngày đăng: 15/06/2022, 15:59

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan