Đường cong học tập của javascript
Xem các phiên từ Hội nghị chuyên đề WiML về các mô hình khuếch tán với KerasCV, ML trên thiết bị, v.v. Xem theo yêu cầu Show
Trong hướng dẫn này, bạn sẽ học cách phân loại hình ảnh chó và mèo bằng cách sử dụng phương pháp học chuyển đổi từ mạng được đào tạo trước Mô hình được đào tạo trước là một mạng đã lưu trước đó đã được đào tạo trên một tập dữ liệu lớn, thường là trên một tác vụ phân loại hình ảnh quy mô lớn. Bạn có thể sử dụng nguyên trạng mô hình được đào tạo trước hoặc sử dụng học chuyển đổi để tùy chỉnh mô hình này cho một nhiệm vụ nhất định Trực giác đằng sau việc học chuyển đổi để phân loại hình ảnh là nếu một mô hình được đào tạo trên một tập dữ liệu đủ lớn và tổng quát, thì mô hình này sẽ đóng vai trò là mô hình chung của thế giới trực quan một cách hiệu quả. Sau đó, bạn có thể tận dụng các bản đồ tính năng đã học này mà không cần phải bắt đầu lại từ đầu bằng cách đào tạo một mô hình lớn trên một tập dữ liệu lớn Trong sổ ghi chép này, bạn sẽ thử hai cách để tùy chỉnh mô hình được đào tạo trước
Bạn sẽ tuân theo quy trình học máy nói chung
2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. tiền xử lý dữ liệuTải xuống dữ liệuTrong hướng dẫn này, bạn sẽ sử dụng tập dữ liệu chứa vài nghìn hình ảnh về mèo và chó. Tải xuống và giải nén tệp zip chứa hình ảnh, sau đó tạo Found 1000 files belonging to 2 classes.8 để đào tạo và xác thực bằng tiện ích Found 1000 files belonging to 2 classes.9. Bạn có thể tìm hiểu thêm về tải hình ảnh trong hướng dẫn này ______5
Found 1000 files belonging to 2 classes. Hiển thị chín hình ảnh và nhãn đầu tiên từ tập huấn luyện ________số 8Vì tập dữ liệu ban đầu không chứa tập kiểm tra, bạn sẽ tạo một. Để làm như vậy, hãy xác định có bao nhiêu lô dữ liệu có sẵn trong bộ xác thực bằng cách sử dụng 0, sau đó chuyển 20% trong số đó sang bộ kiểm tra2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.0 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.1 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.2 Định cấu hình tập dữ liệu cho hiệu suấtSử dụng tìm nạp trước vào bộ đệm để tải hình ảnh từ đĩa mà không bị chặn I/O. Để tìm hiểu thêm về phương pháp này, hãy xem hướng dẫn hiệu suất dữ liệu 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.0 Sử dụng tăng cường dữ liệuKhi bạn không có tập dữ liệu hình ảnh lớn, bạn nên giới thiệu tính đa dạng mẫu một cách giả tạo bằng cách áp dụng các phép biến đổi ngẫu nhiên nhưng thực tế cho các hình ảnh đào tạo, chẳng hạn như xoay và lật ngang. Điều này giúp hiển thị mô hình với các khía cạnh khác nhau của dữ liệu huấn luyện và giảm tình trạng thừa. Bạn có thể tìm hiểu thêm về tăng cường dữ liệu trong hướng dẫn này 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.1Lưu ý. Các lớp này chỉ hoạt động trong quá trình đào tạo, khi bạn gọi 1. Chúng không hoạt động khi mô hình được sử dụng ở chế độ suy luận trong 2 hoặc 1. Hãy liên tục áp dụng các lớp này cho cùng một hình ảnh và xem kết quả 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.2____13 Thay đổi tỷ lệ giá trị pixelTrong giây lát, bạn sẽ tải xuống 4 để sử dụng làm mô hình cơ sở của mình. Mô hình này mong đợi các giá trị pixel trong 5, nhưng tại thời điểm này, các giá trị pixel trong hình ảnh của bạn là trong 6. Để thay đổi tỷ lệ chúng, hãy sử dụng phương pháp tiền xử lý đi kèm với mô hình2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.4Lưu ý. Ngoài ra, bạn có thể thay đổi tỷ lệ các giá trị pixel từ 6 thành 5 bằng cách sử dụng 9. ______15Lưu ý. Nếu sử dụng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.00 khác, hãy đảm bảo kiểm tra tài liệu API để xác định xem họ mong đợi pixel ở 5 hay 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.02 hay sử dụng hàm 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.03 đi kèm. Tạo mô hình cơ sở từ các kết nối được đào tạo trướcBạn sẽ tạo mô hình cơ sở từ mô hình MobileNet V2 được phát triển tại Google. Điều này được đào tạo trước trên bộ dữ liệu ImageNet, một bộ dữ liệu lớn bao gồm 1. Hình ảnh 4M và 1000 lớp. ImageNet là một bộ dữ liệu đào tạo nghiên cứu với nhiều loại như 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.04 và 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.05. Cơ sở kiến thức này sẽ giúp chúng tôi phân loại chó và mèo từ tập dữ liệu cụ thể của chúng tôi Trước tiên, bạn cần chọn lớp MobileNet V2 mà bạn sẽ sử dụng để trích xuất tính năng. Lớp phân loại cuối cùng (trên "trên cùng", vì hầu hết các sơ đồ của mô hình học máy đi từ dưới lên trên) không hữu ích lắm. Thay vào đó, bạn sẽ làm theo thông lệ chung để phụ thuộc vào lớp cuối cùng trước khi thao tác làm phẳng. Lớp này được gọi là "lớp cổ chai". Các tính năng của lớp cổ chai giữ lại tính tổng quát hơn so với lớp cuối cùng/lớp trên cùng Đầu tiên, khởi tạo mô hình MobileNet V2 được tải sẵn với các trọng số được đào tạo trên ImageNet. Bằng cách chỉ định đối số include_top=False, bạn tải một mạng không bao gồm các lớp phân loại ở trên cùng, lý tưởng cho việc trích xuất tính năng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.6 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.7 Trình trích xuất tính năng này chuyển đổi từng ảnh 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.06 thành một khối tính năng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.07. Hãy xem những gì nó làm với một loạt hình ảnh ví dụ 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.8 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.9 Khai thác tính năngTrong bước này, bạn sẽ đóng băng cơ sở tích chập được tạo từ bước trước và để sử dụng làm công cụ trích xuất tính năng. Ngoài ra, bạn thêm một trình phân loại lên trên nó và đào tạo trình phân loại cấp cao nhất Đóng băng cơ sở tích chậpĐiều quan trọng là đóng băng cơ sở tích chập trước khi bạn biên dịch và huấn luyện mô hình. Đóng băng (bằng cách đặt lớp. có thể đào tạo = Sai) ngăn các trọng số trong một lớp nhất định được cập nhật trong quá trình đào tạo. MobileNet V2 có nhiều lớp, do đó, đặt cờ 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.08 của toàn bộ mô hình thành Sai sẽ đóng băng tất cả chúng 0Lưu ý quan trọng về các lớp BatchNormalizationNhiều mô hình chứa 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.09 lớp. Lớp này là một trường hợp đặc biệt và cần thực hiện các biện pháp phòng ngừa trong bối cảnh tinh chỉnh, như được trình bày sau trong hướng dẫn này Khi bạn đặt 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.10, lớp 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.11 sẽ chạy ở chế độ suy luận và sẽ không cập nhật số liệu thống kê trung bình và phương sai của nó Khi bạn giải phóng một mô hình có chứa các lớp BatchNormalization để tinh chỉnh, bạn nên giữ các lớp BatchNormalization ở chế độ suy luận bằng cách chuyển 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.12 khi gọi mô hình cơ sở. Mặt khác, các bản cập nhật được áp dụng cho các trọng số không thể đào tạo sẽ phá hủy những gì mô hình đã học được Để biết thêm chi tiết, xem hướng dẫn học Chuyển tiếp 1 2Thêm đầu phân loạiĐể tạo dự đoán từ khối tính năng, hãy tính trung bình trên các vị trí không gian 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.13 không gian, sử dụng lớp 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.14 để chuyển đổi các tính năng thành một vectơ 1280 phần tử trên mỗi hình ảnh 3 4Áp dụng lớp 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.15 để chuyển đổi các tính năng này thành một dự đoán duy nhất cho mỗi hình ảnh. Bạn không cần chức năng kích hoạt ở đây vì dự đoán này sẽ được coi là 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.16 hoặc giá trị dự đoán thô. Số dương dự đoán lớp 1, số âm dự đoán lớp 0 5 6Xây dựng một mô hình bằng cách kết hợp các lớp tăng cường dữ liệu, thay đổi kích thước, 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.17 và trích xuất tính năng bằng API chức năng Keras. Như đã đề cập trước đây, hãy sử dụng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.18 vì mô hình của chúng tôi chứa lớp 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.11 7 8Biên dịch mô hìnhBiên dịch mô hình trước khi đào tạo nó. Vì có hai lớp, hãy sử dụng tổn thất 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.20 với 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.21 vì mô hình cung cấp đầu ra tuyến tính 9Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.0 Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.1 2. 5 triệu tham số trong MobileNet bị đóng băng, nhưng có 1. 2 nghìn tham số có thể huấn luyện trong lớp Dense. Chúng được phân chia giữa hai đối tượng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.22, trọng số và độ lệch Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.2____53 Đào tạo người mẫuSau khi đào tạo trong 10 kỷ nguyên, bạn sẽ thấy độ chính xác ~94% trên bộ xác thực Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.4____55____56____57 Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.8 Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.9 đường cong học tậpChúng ta hãy xem các đường cong học tập về độ chính xác/mất xác thực và đào tạo khi sử dụng mô hình cơ sở MobileNetV2 làm công cụ trích xuất tính năng cố định 0Ghi chú. Nếu bạn đang thắc mắc tại sao chỉ số xác thực lại rõ ràng tốt hơn chỉ số đào tạo, thì nguyên nhân chính là do các lớp như 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.09 và 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.24 ảnh hưởng đến độ chính xác trong quá trình đào tạo. Chúng bị tắt khi tính toán mất xác thực. Ở mức độ thấp hơn, đó cũng là do các chỉ số đào tạo báo cáo mức trung bình cho một kỷ nguyên, trong khi các chỉ số xác thực được đánh giá sau kỷ nguyên, vì vậy, các chỉ số xác thực thấy một mô hình đã được đào tạo lâu hơn một chút tinh chỉnhTrong thử nghiệm trích xuất tính năng, bạn chỉ đào tạo một vài lớp trên mô hình cơ sở MobileNetV2. Trọng số của mạng được đào tạo trước không được cập nhật trong quá trình đào tạo Một cách để tăng hiệu suất hơn nữa là đào tạo (hoặc "tinh chỉnh") trọng số của các lớp trên cùng của mô hình được đào tạo trước cùng với việc đào tạo bộ phân loại mà bạn đã thêm. Quá trình đào tạo sẽ buộc các trọng số được điều chỉnh từ bản đồ tính năng chung sang các tính năng được liên kết cụ thể với tập dữ liệu Ghi chú. Điều này chỉ nên được thực hiện sau khi bạn đã đào tạo trình phân loại cấp cao nhất với mô hình được đào tạo trước được đặt thành không thể đào tạo. Nếu bạn thêm một trình phân loại được khởi tạo ngẫu nhiên lên trên một mô hình được đào tạo trước và cố gắng huấn luyện tất cả các lớp cùng nhau, cường độ của các bản cập nhật độ dốc sẽ quá lớn (do các trọng số ngẫu nhiên từ trình phân loại) và mô hình được đào tạo trước của bạn sẽ .Ngoài ra, bạn nên cố gắng tinh chỉnh một số lượng nhỏ các lớp trên cùng thay vì toàn bộ mô hình MobileNet. Trong hầu hết các mạng tích chập, lớp càng cao thì càng chuyên biệt. Một vài lớp đầu tiên tìm hiểu các tính năng rất đơn giản và chung chung, khái quát cho hầu hết các loại hình ảnh. Khi bạn lên cao hơn, các tính năng ngày càng cụ thể hơn đối với tập dữ liệu mà mô hình được đào tạo. Mục tiêu của việc tinh chỉnh là điều chỉnh các tính năng chuyên biệt này để hoạt động với tập dữ liệu mới, thay vì ghi đè lên quá trình học tập chung Hủy đóng băng các lớp trên cùng của mô hìnhTất cả những gì bạn cần làm là giải phóng 2022-12-14 02:23:03.432706: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432824: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory 2022-12-14 02:23:03.432835: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.17 và đặt các lớp dưới cùng thành không thể huấn luyện. Sau đó, bạn nên biên dịch lại mô hình (cần thiết để những thay đổi này có hiệu lực) và tiếp tục đào tạo 1 2 3Biên dịch mô hìnhVì bạn đang đào tạo một mô hình lớn hơn nhiều và muốn đọc lại các trọng số đã được đào tạo trước, điều quan trọng là sử dụng tỷ lệ học tập thấp hơn ở giai đoạn này. Nếu không, mô hình của bạn có thể quá khớp rất nhanh 4Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.0 6Downloading data from https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip 68606236/68606236 [==============================] - 0s 0us/step Found 2000 files belonging to 2 classes.2 8Tiếp tục huấn luyện người mẫuNếu bạn được đào tạo để hội tụ sớm hơn, bước này sẽ cải thiện độ chính xác của bạn thêm một vài điểm phần trăm 9Found 1000 files belonging to 2 classes.0 Chúng ta hãy xem các đường cong học tập về độ chính xác/mất xác thực và đào tạo khi tinh chỉnh một vài lớp cuối cùng của mô hình cơ sở MobileNetV2 và đào tạo bộ phân loại trên đầu trang của nó. Mất xác nhận cao hơn nhiều so với mất đào tạo, vì vậy bạn có thể bị quá khớp Bạn cũng có thể bị thừa trang vì tập huấn luyện mới tương đối nhỏ và giống với tập dữ liệu MobileNetV2 ban đầu Sau khi tinh chỉnh, mô hình gần đạt độ chính xác 98% trên bộ xác thực Found 1000 files belonging to 2 classes.1 Found 1000 files belonging to 2 classes.2 Đánh giá và dự đoánCuối cùng, bạn có thể xác minh hiệu suất của mô hình trên dữ liệu mới bằng bộ kiểm tra Found 1000 files belonging to 2 classes.3____24 Và bây giờ bạn đã sẵn sàng sử dụng mô hình này để dự đoán xem thú cưng của bạn là mèo hay chó Found 1000 files belonging to 2 classes.5 Found 1000 files belonging to 2 classes.6 Tóm lược
|