โครงข่ายประสาทเทียมแบบ Convolutional สำหรับการจำแนกภาพ
โครงข่ายประสาทเทียมแบบ Convolutional สำหรับการจำแนกประเภทจะประกอบด้วยชั้น Convolutional (สำหรับประมวลผลภาพ) ตามด้วยชั้น Fully Connected (Dense) (สำหรับการอ่านผลลัพธ์) ในแบบฝึกหัดนี้ จะสร้างโครงข่าย Convolutional ขนาดเล็กสำหรับจำแนกประเภทข้อมูลจากชุดข้อมูล Fashion
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การสร้างโมเดลภาพด้วย Keras
คำแนะนำการฝึกหัด
- เพิ่มชั้น
Conv2Dเพื่อสร้าง Input Layer ของโครงข่าย โดยใช้ขนาด Kernel เป็น 3 x 3 และใช้ออบเจกต์img_rowsและimg_colsที่มีอยู่ใน Workspace เพื่อกำหนดinput_shapeของชั้นนี้ - เพิ่มชั้น
Flattenเพื่อเชื่อมต่อระหว่างส่วนประมวลผลภาพและส่วนจำแนกประเภทของโครงข่าย - เพิ่มชั้น
Denseเพื่อจำแนกเสื้อผ้าออกเป็น 3 ประเภทที่มีในชุดข้อมูล
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Import the necessary components from Keras
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Flatten
# Initialize the model object
model = Sequential()
# Add a convolutional layer
model.add(____(10, kernel_size=____, activation='relu',
input_shape=____))
# Flatten the output of the convolutional layer
model.add(____())
# Add an output layer for the 3 categories
model.add(____(____, activation='softmax'))