April 20, 2024, 9:17 a.m. | Suth

DEV Community dev.to

ในบทความนี้เราจะพูดถึงวิธีการจำแนกภาพโดยใช้ TensorFlow ในการจำแนก โดยเราจะทำการจำแนกภาพตามหมวดหมู่ของคลาสที่เกี่ยวข้องกับ CIFAR-10 Dataset โดยจะมีภาพที่แตกต่างกัน 10 กลุ่ม มีรวมกันทั้งหมด 60,000 ภาพ โดยใน 10 กลุ่มแบ่งออกเป็น Airplane, Automobile, Bird, Cat, Deer, Dog, Frog, Horse, Ship, Truck และทุกภาพมีขนาด 32×32 รวมทั้งมีทั้งหมด 50,000 ภาพสำหรับใช้ในการฝึกและอีก 10,000 ภาพที่ใช้สำหรับการทดสอบ

โดยเราจะใช้ tensorflow's keras API เพื่อสร้างโมเดล และแนะนำว่าให้ใช้ GPU หรือ Google colab notebooks ช่วยในการทำงาน





ขั้นตอนทำ


เริ่มจากการนำไลบรารีและโมดูลที่จำเข้าไปใน Google Colab



import tensorflow as tf 
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.layers import Input, Conv2D, Dense, Flatten, Dropout
from tensorflow.keras.layers import GlobalMaxPooling2D, MaxPooling2D
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import …

airplane api automobile bird cifar-10 colab dataset dog google gpu import keras notebooks numpy python ship tensorflow truck

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Senior Software Engineer, Generative AI (C++)

@ SoundHound Inc. | Toronto, Canada