สัปดาห์ที่ 15
การนำเสนอโครงงาน Deep Learning
1. ข้อกำหนดโครงงาน
2. การนำเสนอที่ดี
3. การลงลึกทางเทคนิค
4. Demo ด้วย Django Dashboard
5. การประเมินผล
- หัวข้อ: เลือกหัวข้อที่สนใจจาก domain ใดก็ได้
- Dataset: ใช้ dataset ที่เหมาะสมกับปัญหา
- Model: สร้าง model ที่ train ได้จริง
- Web App: สร้าง Django dashboard สำหรับ demo
[ตัวอย่าง] Sentiment analysis, Image classification, Text generation, Recommendation system
# Project structure wk_project/ ├── model/ │ ├── train.py # Training script │ ├── model.py # Model architecture │ └── weights.pth # Saved weights ├── dashboard/ │ ├── views.py # Django views │ ├── urls.py # URL routing │ └── templates/ │ └── index.html # Frontend ├── data/ │ └── dataset/ # Dataset files ├── requirements.txt # Dependencies └── README.md # Documentation # Minimum requirements: # 1. Train a model (any architecture) # 2. Save/load model (state_dict) # 3. Django dashboard with SSE # 4. Real-time training visualization # 5. 15-minute presentation
- สัปดาห์ที่ 1-2: เลือกหัวข้อ, หา dataset
- สัปดาห์ที่ 3-4: สร้าง baseline model
- สัปดาห์ที่ 5-6: Fine-tune, experiment
- สัปดาห์ที่ 7: สร้าง Django dashboard
- สัปดาห์ที่ 8: Prepare presentation
[สำคัญ] เริ่มเร็ว = มีเวลาแก้ไขปัญหา
# Milestones: Week 1-2: Proposal - Problem statement - Dataset selection - Expected results Week 3-4: Baseline - Simple model - Initial results - Identify challenges Week 5-6: Experiments - Try different architectures - Hyperparameter tuning - Compare results Week 7: Dashboard - Django setup - SSE training stream - Frontend visualization Week 8: Presentation - Slide deck - Demo preparation - Practice run
- Slide 1: ชื่อเรื่อง + สมาชิกในทีม
- Slide 2-3: ปัญหาที่ต้องแก้ + ทำไมถึงสำคัญ
- Slide 4-5: Dataset + การเตรียมข้อมูล
- Slide 6-8: สถาปัตยกรรมโมเดล + การฝึกสอน
- Slide 9-10: ผลลัพธ์ + การประเมินผล
- Slide 11: การสาธิต (สดหรือวิดีโอ)
- Slide 12: ปัญหาที่เจอ + บทเรียนที่ได้
- Slide 13: แผนพัฒนาต่อ + ถาม-ตอบ
[เคล็ดลับ] 15 slides, 15 นาที = 1 slide ต่อ 1 นาที
# Presentation structure (15 min) 1. Title (30 sec) - Project name, team, date 2. Problem (1 min) - What problem are you solving? - Why is it important? 3. Dataset (1 min) - What data did you use? - How did you preprocess it? 4. Method (3 min) - Model architecture - Why this architecture? - Training process 5. Results (3 min) - Metrics (accuracy, loss, etc.) - Comparisons with baselines - Visualizations 6. Demo (3 min) - Live demo or video - Show the dashboard 7. Challenges (2 min) - What went wrong? - How did you fix it? 8. Conclusion (1 min) - Summary, future work
- Hook: เริ่มด้วยคำถามหรือสถิติที่น่าสนใจ
- Journey: เล่ากระบวนการเป็นเรื่องราว
- Conflict: ปัญหาที่เจอและวิธีแก้
- Resolution: ผลลัพธ์และบทเรียน
[ตัวอย่าง] "Every day, 3.5 billion searches are made on Google. What if we could understand sentiment from search queries?"
# Good storytelling:
# Bad:
# "We used LSTM with 128 hidden units
# and trained for 50 epochs with Adam
# optimizer and learning rate 0.001..."
# Good:
# "We wanted to predict stock prices...
# First, we tried a simple LSTM, but it
# overfit badly. So we added dropout and
# batch normalization, which improved
# accuracy from 62% to 78%..."
# Tips:
# - Start with WHY, not HOW
# - Use analogies (neural network = brain)
# - Show before/after comparisons
# - Include failure stories (authentic)
# - End with impact ("this could help...")
- Less is more: ไม่เกิน 6 bullet points ต่อ slide
- Visuals: ใช้รูป, graph, diagram แทน text
- Font size: ไม่เล็กกว่า 24pt
- Consistency: สี, font, layout เดียวกัน
[Rule of thumb] ถ้าอ่าน slide ออก = มี text เยอะเกินไป
# Slide design rules: # DO: # - Use visuals (charts, diagrams) # - One idea per slide # - Use code snippets (short) # - Show results with tables/graphs # - Leave white space # DON'T: # - Walls of text # - Tiny fonts (< 24pt) # - Too many animations # - Read from slides # - Apologize for your work # Tools: # - Google Slides (free, easy) # - Reveal.js (code-friendly) # - PowerPoint (professional) # - Canva (design templates)
- Prepare backup: มี video ถ้า live demo ไม่ work
- Test beforehand: ลอง demo ล่วงหน้า
- Keep it simple: แสดง feature หลักเท่านั้น
- Explain what they see: อย่าปล่อยให้เดา
[สำคัญ] Demo คือ highlight = ซ้อมให้พร้อม
# Demo checklist: # Before: # - Test on projector/screen # - Check internet connection # - Have backup video ready # - Prepare sample inputs # During: # - Start with training demo # - Show real-time updates # - Explain what's happening # - Show final results # Common issues: # - Slow training: use small dataset # - Server crash: have restart script # - No internet: use local server # - Model load error: check paths # Demo script: # 1. "This is our model training..." # 2. "Notice the loss decreasing..." # 3. "Here are generated samples..." # 4. "Let's try with new input..."
# model.py - Document your model
class MyModel(nn.Module):
"""
Text Classifier using Bidirectional LSTM
Architecture:
- Embedding layer (vocab_size, embed_dim)
- BiLSTM (embed_dim, hidden_dim, num_layers)
- Dropout (p=0.5)
- FC layer (hidden_dim * 2, num_classes)
Input: (batch_size, seq_len) - word indices
Output: (batch_size, num_classes) - logits
Training:
- Optimizer: Adam (lr=1e-3)
- Loss: CrossEntropyLoss
- Epochs: 20
- Batch size: 64
Results:
- Accuracy: 89.5% on test set
- F1-score: 0.89 (macro)
"""
def __init__(self, vocab_size, embed_dim,
hidden_dim, num_classes):
super().__init__()
self.embedding = nn.Embedding(vocab_size, embed_dim)
self.lstm = nn.LSTM(embed_dim, hidden_dim,
num_layers=2, bidirectional=True,
batch_first=True, dropout=0.5)
self.fc = nn.Linear(hidden_dim * 2, num_classes)
def forward(self, x):
embeds = self.embedding(x)
out, _ = self.lstm(embeds)
return self.fc(out[:, -1, :])
- Docstring: อธิบาย architecture, input, output
- Comments: บอก hyperparameters ที่ใช้
- Results: บันทึก metrics ไว้ใน docstring
- Version: บอก version ของ model
[สำคัญ] Documentation ช่วยให้คนอื่นเข้าใจ code ของคุณ
import matplotlib.pyplot as plt
from sklearn.metrics import (classification_report,
confusion_matrix,
ConfusionMatrixDisplay)
# 1. Training curves
fig, axes = plt.subplots(1, 3, figsize=(15, 4))
axes[0].plot(train_losses, label='Train')
axes[0].plot(val_losses, label='Val')
axes[0].set_title('Loss')
axes[0].legend()
axes[1].plot(train_accs, label='Train')
axes[1].plot(val_accs, label='Val')
axes[1].set_title('Accuracy')
axes[1].legend()
# 2. Confusion matrix
cm = confusion_matrix(y_true, y_pred)
disp = ConfusionMatrixDisplay(cm, display_labels=classes)
disp.plot(ax=axes[2])
# 3. Classification report
print(classification_report(y_true, y_pred,
target_names=classes))
# 4. Sample predictions
for i in range(5):
print(f"Text: {texts[i]}")
print(f"True: {labels[i]}, Pred: {preds[i]}")
print("---")
- Training curves: loss, accuracy ตาม epochs
- Confusion matrix: ดู misclassifications
- Classification report: precision, recall, f1
- Sample predictions: ตัวอย่างผลลัพธ์จริง
[เคล็ดลับ] ใช้ matplotlib/seaborn สำหรับ visualization ที่สวยงาม
- Overfitting: train acc สูง, test acc ต่ำ
- Data quality: ข้อมูลไม่ดี, missing values
- Training time: ช้า, resource ไม่พอ
- Model selection: ไม่รู้เลือก model ไหน
[สำคัญ] ปัญหา = โอกาสเรียนรู้ = คะแนน bonus
# Common challenges & solutions: # 1. Overfitting # Solution: Dropout, data augmentation, # early stopping, regularization # 2. Data quality # Solution: Cleaning, preprocessing, # handle missing values # 3. Training time # Solution: Smaller model, batch size, # mixed precision, GPU # 4. Model selection # Solution: Start simple, compare models, # use grid search # 5. Imbalanced classes # Solution: Oversampling, undersampling, # class weights, SMOTE # Remember: # - Document all experiments # - Explain why you chose X over Y # - Show failed attempts too
# Create project
uv add django torch
uv run django-admin startproject myproject .
uv run manage.py startapp dashboard
# myproject/urls.py
from django.urls import path, include
urlpatterns = [
path('', include('dashboard.urls')),
]
# dashboard/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('train/', views.train, name='train'),
]
# dashboard/views.py
from django.shortcuts import render
from django.http import StreamingHttpResponse
def index(request):
return render(request, 'dashboard/index.html')
def train(request):
def event_stream():
# Your training loop here
for epoch in range(num_epochs):
# ... train model ...
yield f"data: {json.dumps({'epoch': epoch, 'loss': loss.item(), 'accuracy': acc})}\n\n"
return StreamingHttpResponse(event_stream(), content_type='text/event-stream')
- Django: web framework สำหรับ backend
- SSE: real-time training updates
- StreamingHttpResponse: ส่ง data ทีละ epoch
- render(): ส่ง template กลับ
[โครงสร้าง] manage.py -> settings.py -> urls.py -> views.py -> templates/
<!-- dashboard/templates/index.html -->
<!DOCTYPE html>
<html>
<head>
<title>My Project Dashboard</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body x-data="{ training: false, epoch: 0, loss: 0, acc: 0 }">
<h1>My Deep Learning Project</h1>
<button @click="startTraining()">
Start Training
</button>
<div>
<p>Epoch: <span x-text="epoch"></span></p>
<p>Loss: <span x-text="loss"></span></p>
<p>Accuracy: <span x-text="acc"></span></p>
</div>
<canvas id="chart" width="400" height="200"></canvas>
<script>
function startTraining() {
training = true;
const es = new EventSource('/train/');
es.onmessage = function(e) {
const m = JSON.parse(e.data);
epoch = m.epoch;
loss = m.loss.toFixed(4);
acc = m.accuracy.toFixed(4);
drawChart(m.epoch, m.loss, m.accuracy);
};
}
</script>
</body>
</html>
- ใช้ Alpine.js สำหรับ reactive UI
- ใช้ Tailwind CSS สำหรับ styling
- ใช้ Canvas สำหรับ charts
- ใช้ EventSource สำหรับ SSE
[เคล็ดลับ] อย่าลืม responsive design สำหรับ mobile
- Project (20%): หัวข้อ, dataset, model, ผลลัพธ์
- Presentation (15%): โครงสร้าง, storytelling, demo
- Technical (10%): code quality, documentation
- Innovation (5%): ความคิดสร้างสรรค์, ความยาก
[คะแนนรวม] Project 20% + Presentation 15% + Technical 10% + Innovation 5% = 50%
# Evaluation criteria: # Project (20 pts) # - Problem relevance (5) # - Dataset quality (5) # - Model performance (5) # - Results analysis (5) # Presentation (15 pts) # - Structure & flow (5) # - Storytelling (5) # - Demo quality (5) # Technical (10 pts) # - Code quality (3) # - Documentation (3) # - Django dashboard (4) # Bonus (5 pts) # - Innovation & creativity # - Extra features # - Publication potential
- Why this model?: ทำไมเลือก model นี้
- How did you tune?: ปรับ hyperparameters อย่างไร
- What failed?: อะไรไม่ work และทำไม
- What's next?: แผนพัฒนาต่อ
[สำคัญ] ตอบตรงคำถาม อย่าอ้อมค้อม ถ้าไม่รู้บอกว่าไม่รู้
# Common Q&A questions: # 1. Why did you choose this architecture? # "We tried CNN and RNN, but LSTM gave # best results for our sequence data..." # 2. How did you handle overfitting? # "We used dropout (0.5) and early # stopping with patience=5..." # 3. What would you do differently? # "We'd try pre-trained models like # BERT, and use more data augmentation..." # 4. How long did training take? # "About 2 hours on Google Colab with # GPU, 50 epochs..." # 5. What's the main limitation? # "Our model struggles with short text # because it needs context..." # Tips: # - Practice with a friend # - Time your answers (1-2 min) # - Use slides as backup # - Be honest about limitations
- Practice: ซ้อมนำเสนออย่างน้อย 3 ครั้ง
- Time management: ตั้ง timer, อย่าเกิน 15 นาที
- Backup plan: มี video ถ้า demo ไม่ work
- Be confident: คุณรู้จัก project ดีที่สุด
[สำคัญ] ความมั่นใจ = ครึ่งหนึ่งของคะแนน
# Final checklist: # Day before: # - Practice presentation 2x # - Test demo on projector # - Prepare backup video # - Check all files are saved # Day of presentation: # - Arrive early # - Test equipment # - Water bottle ready # - Deep breaths # During presentation: # - Speak clearly and slowly # - Make eye contact # - Point at slides # - Pause for questions # After presentation: # - Thank audience # - Be ready for follow-up # - Celebrate!
ลิงก์ที่เป็นประโยชน์: