Tensorflow คือเฟรมเวิร์กแมชชีนเลิร์นนิงที่ให้บริการโดย Google เป็นเฟรมเวิร์กโอเพนซอร์ซที่ใช้ร่วมกับ Python เพื่อใช้อัลกอริทึม แอปพลิเคชันการเรียนรู้เชิงลึก และอื่นๆ อีกมากมาย ใช้ในการวิจัยและเพื่อการผลิต
แพ็คเกจ 'tensorflow' สามารถติดตั้งบน Windows ได้โดยใช้บรรทัดโค้ดด้านล่าง -
pip install tensorflow
ชุดข้อมูล 'Fashion MNIST' มีรูปภาพของเสื้อผ้าประเภทต่างๆ มันมีภาพสีเทาของเสื้อผ้ามากกว่า 70,000 ที่อยู่ใน 10 หมวดหมู่ที่แตกต่างกัน รูปภาพเหล่านี้มีความละเอียดต่ำ (28 x 28 พิกเซล)
เรากำลังใช้ Google Colaboratory เพื่อเรียกใช้โค้ดด้านล่าง Google Colab หรือ Colaboratory ช่วยเรียกใช้โค้ด Python บนเบราว์เซอร์และไม่ต้องมีการกำหนดค่าใดๆ และเข้าถึง GPU ได้ฟรี (หน่วยประมวลผลกราฟิก) Colaboratory สร้างขึ้นบน Jupyter Notebook
ต่อไปนี้เป็นข้อมูลโค้ดเพื่อตรวจสอบการคาดการณ์สำหรับ Fashion MNIST ใน Python -
ตัวอย่าง
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("The test images, predicted labels and the true labels are plotted")
print("The correct predictions are in green and the incorrect predictions are in red")
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() เครดิตโค้ด − https://www.tensorflow.org/tutorials/keras/classification
ผลลัพธ์



คำอธิบาย
-
เมื่อโมเดลได้รับการฝึกอบรมแล้ว ก็สามารถใช้ทำนายภาพอื่นๆ ได้
-
การคาดคะเนเกิดขึ้นบนรูปภาพ และอาร์เรย์การคาดคะเนจะปรากฏขึ้น
-
ฉลากที่คาดการณ์ไว้อย่างถูกต้องจะเป็นสีเขียว และฉลากที่คาดเดาไม่ถูกต้องจะเป็นสีแดง
-
ตัวเลขระบุค่าเปอร์เซ็นต์สำหรับป้ายกำกับที่คาดการณ์ไว้
-
มันบอกว่าตัวแบบบอกว่าฉลากที่คาดการณ์ไว้นั้นเป็นป้ายจริงของรูปภาพได้อย่างแม่นยำเพียงใด