Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

การตรวจสอบการทำนาย Fashion MNIST ด้วย TensorFlow


บทนำ

TensorFlow เฟรมเวิร์ก ML จาก Google โค้ดเปิด ใช้กับ Python ใช้ในงานวิจัยและการผลิต

การติดตั้ง

pip install tensorflow

ชุดข้อมูล Fashion MNIST

ภาพเสื้อผ้า 70,000+ ภาพ Grayscale 10 หมวดหมู่ 28x28 pixels

ตัวอย่าง: Visualization การทำนาย

i = 0
plt.figure(figsize=(6,3))
plt.subplot(1,2,1)
plot_image(i, predictions[i], test_labels, test_images)
plt.subplot(1,2,2)
plot_value_array(i, predictions[i], test_labels)
plt.show()

i = 12
plt.figure(figsize=(6,3))
plt.subplot(1,2,1)
plot_image(i, predictions[i], test_labels, test_images)
plt.subplot(1,2,2)
plot_value_array(i, predictions[i], test_labels)
plt.show()

num_rows = 5
num_cols = 3
print("พล็อตภาพทดสอบ, ป้ายกำกับที่ทำนาย, และป้ายกำกับจริง")
print("ทำนายถูก = สีเขียว, ทำนายผิด = สีแดง")
num_images = num_rows * num_cols
plt.figure(figsize=(2*2*num_cols, 2*num_rows))
for i in range(num_images):
    plt.subplot(num_rows, 2*num_cols, 2*i+1)
    plot_image(i, predictions[i], test_labels, test_images)
    plt.subplot(num_rows, 2*num_cols, 2*i+2)
    plot_value_array(i, predictions[i], test_labels)
plt.tight_layout()
plt.show()

ที่มาโค้ด: TensorFlow Classification Tutorial

ผลลัพธ์

การตรวจสอบการทำนาย Fashion MNIST ด้วย TensorFlow

การตรวจสอบการทำนาย Fashion MNIST ด้วย TensorFlow

การตรวจสอบการทำนาย Fashion MNIST ด้วย TensorFlow

คำอธิบาย

  • หลังฝึกโมเดลแล้ว ใช้ทำนายภาพอื่น
  • ทำนายบนภาพ แสดงอาเรย์ความน่าจะเป็น
  • ป้ายกำกับที่ถูกต้อง = สีเขียว ผิด = สีแดง
  • ตัวเลขแสดงเปอร์เซ็นต์ความมั่นใจของป้ายกำกับที่ทำนาย
  • บอกว่ามีความแม่นยำเพียงใดที่ป้ายกำกับที่ทำนายเป็นป้ายจริง