Báo cáo Homework Thị giác máy Đại học Bách Khoa ĐHQG TPHCM

67 0 0
Báo cáo Homework Thị giác máy Đại học Bách Khoa  ĐHQG TPHCM

Đ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

TỔNG HỢP HOMEWORK MÔN THỊ GIÁC MÁY TÍNH, Giảng viên hướng dẫn: Phạm Việt Cường, MỤC LỤC I. TỔNG HỢP HOMEWORK NHÓM 5 2 1. Homework 0: Image Processing 2 2. Homework 1 :Viola Jones: training 16 3. Homework 2 : Partial derivative with chain rule. Check your results with numerical derivative. 20 4. Homework 3 21 5. Homework 4:Write a program implementing gradient descent method. Consider at least two nonconvex twovariable functions f(x,y), multiple initial points and various learning rates. 24 6. Homework 5:Why local connectivity shared weights? 29 7. Homework 6:How many parameters (weights and biases) are there in AlexNet? 31 8. Homework 7:Compute top1 top5 error rates for AlexNet and two other models. Use at least 5 classes with minimum 20 images per class. 33 Thực hiện training mô hình, ta được kết quả như bên dưới (xem file code đính kèm) 33 9. Homework 8:Evaluate the performance of AlexNet using images with various aspect ratios. 34 10. Homework 9:AlexNet transfer learning, at least 5 classes with minimum 20 images per class. 36 11. Homework 10:For classification problems, why we use onehot encoding instead of one output (e.g. encoding 4 classes as 1, 2, 3, 4) or binary encoding (e.g encoding 4 classes as 00, 01, 10, 11)? 43 12. Homework 11:Write a program implementing feature nomalization. 43 13. Homework 12:Cascade object detection: use pretrained model and evaluate error. 46 14. Homework 13:How to obtain Precision Recal curve? 48 15. Homework 14:Evaluate object detector YOLORCNNSSD. 51 16. Homework 15:Train object detection YOLORCNNSSD. 56 17. Homework 16:How to handle multiple detections. 59 18. Homework 17:What are PF, FN for object detection problem? 60 II. TÀI LIỆU THAM KHẢO 64

ĐẠI HỌC QUỐC GIA TP HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA THỊ GIÁC MÁY TÍNH TỔNG HỢP HOMEWORK MÔN THỊ GIÁC MÁY TÍNH NHÓM 5_L01 Giảng viên hướng dẫn: Phạm Việt Cường Sinh viên thực hiện Mã số sinh viên Điểm số Lê Hữu Hoàn 1910190 1912733 Nguyễn Vĩnh Bình 1910271 Nguyễn Đức Khoa 1914940 1633685 Bùi Xuân Sơn Hồ Hoàng Thuận Thành phố Hồ Chí Minh – 2023 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG MỤC LỤC I TỔNG HỢP HOMEWORK NHÓM 5 2 1 Homework 0: Image Processing 2 2 Homework 1 :Viola Jones: training 16 3 Homework 2 : Partial derivative with chain rule Check your results with numerical derivative 20 4 Homework 3 21 5 Homework 4:Write a program implementing gradient descent method Consider at least two non-convex two-variable functions f(x,y), multiple initial points and various learning rates .24 6 Homework 5:Why local connectivity & shared weights? 29 7 Homework 6:How many parameters (weights and biases) are there in AlexNet? .31 8 Homework 7:Compute top-1 & top-5 error rates for AlexNet and two other models Use at least 5 classes with minimum 20 images per class 33 Thực hiện training mô hình, ta được kết quả như bên dưới (xem file code đính kèm) 33 9 Homework 8:Evaluate the performance of AlexNet using images with various aspect ratios.34 10 Homework 9:AlexNet transfer learning, at least 5 classes with minimum 20 images per class 36 11 Homework 10:For classification problems, why we use one-hot encoding instead of one output (e.g encoding 4 classes as 1, 2, 3, 4) or binary encoding (e.g encoding 4 classes as 00, 01, 10, 11)? 43 12 Homework 11:Write a program implementing feature nomalization 43 13 Homework 12:Cascade object detection: use pretrained model and evaluate error 46 14 Homework 13:How to obtain Precision - Recal curve? 48 15 Homework 14:Evaluate object detector YOLO/R-CNN/SSD .51 16 Homework 15:Train object detection YOLO/R-CNN/SSD 56 17 Homework 16:How to handle multiple detections 59 18 Homework 17:What are PF, FN for object detection problem? 60 II TÀI LIỆU THAM KHẢO 64 1 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG I TỔNG HỢP HOMEWORK NHÓM 5 1 Homework 0: Image Processing 1 Image Enhancement Histogram Equalization p(rk): có thể hiểu đây là phân trăm số pixels có giá trị màu là rkf nk: số pixels có giá trị màu là rk n : tổng số pixels trong bức ảnh Các hàm sử dụng : a HÀM IMHIST: imhist(I) % tạo histogram Hiển thị một biểu đồ của hình ảnh thang độ xám, theo mặc định, biểu đồ sẽ có 256 mức sáng (trắng đen) CODE: %% SỬ DỤNG HÀM IMHIST I=imread('pout.tif');% đọc anh về' figure Name 1 subplot(2,2,1) imshow(I) % show anh 2 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG subplot(2,2,2) imhist(I) % tạo histogram load mristack; subplot(2,2,3) imhist(mristack) b HÀM histeq: J=histeq(K); % tạo ảnh đã cân bằng tăng độ tương phản Tăng cường độ tương phản của hình ảnh cường độ bằng cách sử dụng cân bằng biểu đồ Có nghĩa ta hàm này sẽ dải đều histogram của tấm ảnh ra đều trên dải màu 3 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG CODE: %% SỬ DỤNG HÀM histeq K=imread('tire.tif'); figure Name 2 subplot(2,2,1) imshow(K) subplot(2,2,2) tương phan J=histeq(K);% tạo anh đã cân bằng tăng độ chuân %J = histeq(I,hgram)% dựng theo histogram imshowpair(K,J,'montage') axis off % bo trục %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% enhanced = histeq(mristack); figure name 3 subplot(1,2,1) imshow(mristack(:,:,1)) title('Slice of Original Image') subplot(1,2,2) imshow(enhanced(:,:,1)) title('Slice of Enhanced Image') c HÀM imhistmatch: imhistmatch(A,Ref); 4 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG Hàm imhistmatch sẽ điều chỉnh phân bố dải histogram theo một hệ quy chiếu, theo câu lệnh này thì hình A sẽ được phân bố mức ảnh theo hình Ref CODE: %% SỬ DỤNG HÀM imhistmatch A = imread('concordaerial.png'); Ref = imread('concordorthophoto.png'); B = imhistmatch(A,Ref); figure name 4 subplot(2,3,1) imshow(A) title('RGB Image with Color Cast') subplot(2,3,2) imshow(Ref) title('Reference Grayscale Image') subplot(2,3,3) imshow(B) title('Histogram Matched RGB Image') L = imread('office_4.jpg'); ref = imread('office_2.jpg'); subplot(2,3,4) montage({L,ref}) title('Input Image (Left) vs Reference Image (Right)'); J = imhistmatch(L,ref,'method','polynomial'); K = imhistmatch(L,ref,'method','uniform'); subplot(2,3,6) montage({J,K}) title('Histogram-Matched Image Using Polynomial Method (Left) vs Uniform Method (Right)'); 2 Sử dụng hàm cơ bản để điều chỉnh gray level Ta sử dụng các hàm cơ bản để thay đổi gray level Có 3 loại thường được sử dụng là : 5 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG  Linear o Negative/Identity  Logarithmic o Log/Inverse log  Power law o n th power/nth root các hàm sử dụng:  log(r);  s=r.^; a Hàm log: Khi sử dụng hàm log để điều chỉnh dải histogram của ảnh thì phần tối của ảnh sẽ tăng mức sáng lớn hơn so với phân sáng của ảnh CODE: %% SỬ DỤNG HÀM cơ ban log M=imread('tire.tif'); 6 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG r=imhist(M); s=log(r); N=histeq(M,s); figure name 5 montage({M,N}) title('Input Image (Left) vs Reference Image (Right)'); b Hàm mũ: hàm mũ sẽ ngược lại với hàm log CODE: %% SỬ DỤNG HÀM cơ ban mũ O=imread('tire.tif'); r=imhist(O); s=r.^1.5; P=histeq(O,s); figure name 6 montage({O,P}) title('Input Image (Left) vs Reference Image (Right)'); 3 Spatial Domain Filtering Có nhiều dạng filter và nó có những chức năng khác nhau Chức năng chính của filter giúp làm mờ hoặc làm sắc nét ảnh, lọc nhiễu Các hàm sử dụng a Filter trung bình (ô trung tâm trong Kenel sẽ được tính trung bình bởi tất cả các ô xung quanh) 7 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG CODE: %% filter trung bình A=imread('cameraman.tif'); B=imboxfilt(A); C=imboxfilt(A,11); figure name filter_trung_binh subplot(2,1,1) imshowpair(A,B,'montage') title('mặc định') subplot(2,1,2) imshowpair(A,C,'montage') title('matrix mask 11x11') b (TRUNG BÌNH CÓ TRỌNG SỐ) gaussian filte (trọng số nhân thêm vào giá trị các ô được chỉ định) 8 THỊ GIÁC MÁY TÍNH GVHD: PHẠM VIỆT CƯỜNG CODE: filter bằng 0.5 %% (TRUNG BÌNH CÓ TRỌNG SỐ\) gaussian D=imread('cameraman.tif'); E=imgaussfilt(D); % mặc định sigma F=imgaussfilt(D,2); figure name gaussian_filter subplot(2,1,1) imshowpair(D,E,'montage') title('mặc định') subplot(2,1,2) imshowpair(D,F,'montage') title('sigma = 2') c medium filter (trung vị) Hình này filter trung vị đang giúp loại bỏ đi nhiễu Ta thấy tra trận lớn hơn sẽ làm mờ ảnh đi nhiều hơn 9

Ngày đăng: 20/03/2024, 12:37

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

Tài liệu liên quan