Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. การใช้ Boosted Trees ใน TensorFlow ด้วย Python

    แนวคิด Boosted Trees ปรับปรุงประสิทธิภาพการทำนายโดยใช้หลายโมเดลร่วมกัน ผลลัพธ์รวมจากทุกโมเดล ใช้ Keras Sequential API สร้างโมเดล sequential ที่เลเยอร์แต่ละอันมี 1 input tensor และ 1 output tensor CNN มีเลเยอร์ convolutional อย่างน้อย 1 เลเยอร์ ใช้สร้างโมเดลเรียนรู้ รันบน Google Colab มี GPU ฟรี จะด

  2. การแสดงผลข้อมูล (Visualize Data) ด้วย TensorFlow และ Pre-trained Model

    แนวคิด ใช้ matplotlib และ plot วาดกราฟ Training/Validation Accuracy และ Loss แนวคิด Transfer Learning สำหรับแมว-สุนัข Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Visualizing the data) plt.figure(figsize=(8, 8)) plt.subplot(2, 1, 1) plt.plot(acc, label=Training Accuracy) plt.plot(val_acc, label=Vali

  3. การประเมินและทำนายข้อมูลด้วย TensorFlow และโมเดล Pre-trained

    แนวคิด ใช้ evaluate และ predict ประเมินและทำนายข้อมูล Flatten batch ภาพ ใช้ sigmoid ได้ logits เรียนรู้การจำแนกแมว-สุนัขด้วย Transfer Learning จาก pre-trained network แนวคิดเดียวกัน: โมเดลที่เทรนบนข้อมูลใหญ่ ใช้เป็น generic feature extractor ได้ รันบน Google Colab ตัวอย่างโค้ด print(Evaluation and

  4. การดาวน์โหลดภาพเดี่ยวทดสอบโมเดลด้วย TensorFlow และ Python

    แนวคิด ใช้ get_file ดาวน์โหลดภาพเดี่ยวจาก Google API มาทดสอบโมเดล แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Run it on a single image) grace_hopper = tf.keras.utils.get_file(image.jpg, https://storage.googleapis.com/download.tensorflow.org/example_imag

  5. การเพิ่ม Batch Dimension และส่งภาพเข้โมเดลด้วย TensorFlow

    แนวคิด แปลงภาพเป็น NumPy array เพิ่ม batch dimension แล้วส่งเข้โมเดลทำนาย แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด grace_hopper = np.array(grace_hopper)/255.0 print(The dimensions of the image are) print(grace_hopper.shape) result = classifier.predict(grace_ho

  6. การถอดรหัสการทำนาย (Decode Predictions) ด้วย TensorFlow และ Python

    แนวคิด แปลงภาพเป็น NumPy array แล้วใช้ ImageNet labels ถอดรหัสการทำนาย แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Decoding the predictions) labels_path = tf.keras.utils.get_file(ImageNetLabels.txt, https://storage.googleapis.com/download.tensorflow.org

  7. การโหลด Flower Dataset และโมเดลจากดิสก์ด้วย TensorFlow

    แนวคิด ใช้ image_dataset_from_directory โหลดข้อมูลภาพจากโฟลเดอร์ แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(The flower dataset) data_root = tf.keras.utils.get_file( flower_photos, https://storage.googleapis.com/download.tensorflow.org/example_image

  8. การสร้าง Normalization Layer ด้วย TensorFlow และ Python

    แนวคิด แปลงชื่อคลาสเป็น NumPy array แล้วสร้าง Normalization Layer ด้วย Rescaling จาก tf.keras.layers.experimental.preprocessing แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(It contains 5 classes) class_names = np.array(train_ds.class_names) print(class_names

  9. การสร้าง Feature Extractor ด้วย Buffered Prefetching ใน TensorFlow

    แนวคิด สร้าง Feature Extractor โดยใช้ buffered prefetching ตั้งค่า trainable=False เพื่อแช่แข็งน้ำหนัก แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด AUTOTUNE = tf.data.AUTOTUNE train_ds = train_ds.cache().prefetch(buffer_size=AUTOTUNE) print(The dimensions of data)

  10. การตรวจสอบการทำนายด้วย matplotlib ใน TensorFlow

    แนวคิด ใช้ matplotlib และ imshow แสดงภาพพร้อมคำทำนายจาก ImageNet แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Predictions are checked) plt.figure(figsize=(10,9)) plt.subplots_adjust(hspace=0.5) for n in range(30): plt.subplot(6,5,n+1) plt.imshow(imag

  11. การดึงฟีเจอร์ (Feature Extraction) ด้วยโมเดล Pre-trained ใน TensorFlow

    แนวคิด ใช้ Feature Extractor model ที่กำหนดไว้ผ่าน hub.KerasLayer เพื่อดึงฟีเจอร์จากภาพ แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Extracting features) feature_extractor_model = https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4 feature_ext

  12. การเพิ่ม Classification Head ด้วย TensorFlow และ Python

    แนวคิด ใช้ tf.keras.Sequential ที่มีเลเยอร์ Dense ร่วมกับ feature extractor model ที่กำหนดไว้ก่อนหน้า แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Attaching a classification head) num_classes = len(class_names) model = tf.keras.Sequential([ feature_extra

  13. การเทรนโมเดล (Fit Data) ด้วย TensorFlow และ Python

    แนวคิด ใช้เมธอด fit เพื่อเทรนโมเดลกับข้อมูล แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Training for 2 epochs only) class CollectBatchStats(tf.keras.callbacks.Callback): def __init__(self): self.batch_losses = [] self.batch_acc = []

  14. การแสดง Loss เทียบ Training Steps ด้วย TensorFlow และ Python

    แนวคิด ใช้ matplotlib และเมธอด plot เพื่อวาดกราฟ Loss ต่อ Training Steps แนวคิด Transfer Learning, TensorFlow Hub, Google Colab เหมือนเดิม ตัวอย่างโค้ด print(Visualizing the data - loss versus training steps) plt.figure() plt.ylabel(Loss) plt.xlabel(Training Steps) plt.ylim([0,2]) plt.plot(batch_s

  15. การตรวจสอบการทำนาย (Checking Predictions) ด้วย TensorFlow และ Python

    แนวคิด ใช้เมธอด predict ของโมเดล และ argmax จาก NumPy เพื่อหาคลาสที่มีความน่าจะเป็นสูงสุด แนวคิด Transfer Learning และ TensorFlow Hub เหมือนบทก่อน รันบน Google Colab ตัวอย่างโค้ด print(The predictions are checked) predicted_batch = model.predict(image_batch) predicted_id = np.argmax(predicted_batc

  16. การพลอทผลลัพธ์ (Plotting Results) ด้วย TensorFlow และ Python

    แนวคิด ใช้ไลบรารี matplotlib และเมธอด imshow เพื่อแสดงภาพผลลัพธ์จากโมเดล แนวคิด Transfer Learning สำหรับ Image Classification: โมเดลที่เทรนบนข้อมูลใหญ่และทั่วไป จะทำหน้าที่เป็นโมเดลทั่วไปสำหรับโลกภาพได้เรียนรู้ feature maps แล้ว ไม่ต้องเริ่มเทรนโมเดลใหญ่จากศูนย์ TensorFlow Hub มีโมเดล pre-trained ใ

  17. การประกอบเลเยอร์ (Composing Layers) ใน TensorFlow ด้วย Python

    แนวคิด TensorFlow สามารถประกอบเลเยอร์ได้โดยการสร้างคลาสที่สืบทอดมาจาก ResnetIdentityBlock ใช้สำหรับกำหนดบล็อกที่นำไปประกอบเลเยอร์ต่างๆ ได้ Neural Network ที่มีเลเยอร์ Convolutional อย่างน้อย 1 เลเยอร์ เรียกว่า Convolutional Neural Network (CNN) ใช้สร้างโมเดลเรียนรู้ได้ TensorFlow Hub เป็นที่เก็บโมเ

  18. Python Pandas: อ่าน CSV และกรองคอลัมน์ product ที่เป็น 'Car' ใน 10 แถวแรก

    โจทย์ สมมติมีไฟล์ products.csv ข้อมูล 100 แถว 8 คอลัมน์ ต้องการอ่านข้อมูล แล้วกรองเฉพาะ 10 แถวแรกที่คอลัมน์ product มีค่าเป็น Car ข้อมูลตัวอย่าง: Rows: 100 Columns: 8 id product engine avgmileage price height_mm width_mm productionYear 1 2 Car Diesel 21 16500 1530

  19. TensorFlow คืออะไร และ Keras ทำงานร่วมกับ TensorFlow เพื่อสร้าง Neural Networks อย่างไร

    TensorFlow คืออะไร TensorFlow เป็นเฟรมเวิร์ก Machine Learning ที่พัฒนาโดย Google เป็นโค้ดเปิด (open-source) ใช้ร่วมกับ Python เพื่อนำอัลกอริทึม Deep Learning และแอปพลิเคชันอื่นๆ ไปใช้งานจริง TensorFlow ใช้ทั้งในงานวิจัยและการผลิตจริง มีเทคนิคการเพิ่มประสิทธิภาพช่วยคำนวณทางคณิตศาสตร์ที่ซับซ้อนได้รวด

  20. ต้นไม้แบบทวิภาคที่สมดุล (Balanced Binary Tree) ใน Python

    บทนำ ในต้นไม้แบบทวิภาค (Binary Tree) แต่ละโหนดจะมีลูกได้สูงสุดสองโหนด คือ ลูกซ้าย (left child) และลูกขวา (right child) เราต้องการตรวจสอบว่าต้นไม้แบบทวิภาคที่กำหนดเป็นต้นไม้ที่ สมดุล (Balanced) หรือไม่ ต้นไม้แบบทวิภาคถือว่าสมดุลหากความแตกต่างของความสูงระหว่างต้นไม้รองซ้ายและต้นไม้รองขวาของทุกโหนดมีค

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:235/451  20-คอมพิวเตอร์/Page Goto:1 229 230 231 232 233 234 235 236 237 238 239 240 241