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

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US