AlexNet ও ImageNet
এই পাঠে যা শিখবেন
- ImageNet ও ILSVRC competition
- AlexNet-এর architecture ও innovations
- ২০১২-র "ImageNet moment" — যা CV বদলে দিল
- PyTorch-এ AlexNet
১ · ImageNet — Fei-Fei Li-র vision
ImageNetImageNet১৪M+ labeled images, ২০K+ category — Fei-Fei Li (Princeton/Stanford)-এর project, ২০০৯-এ release। CV-র benchmark dataset। Crowdsourcing (Amazon Mechanical Turk) দিয়ে annotated। — Fei-Fei Li ২০০৬-এ শুরু, ২০০৯-এ public।
- ১৪ million+ labeled image।
- ২০,০০০+ category (WordNet hierarchy ভিত্তিক)।
- Crowdsourced labeling (Amazon Mechanical Turk) — million dollar project।
ILSVRC (ImageNet Large Scale Visual Recognition Challenge) — annual competition, ১,০০০ category subset-এ classification। ২০১০-২০১৭।
AlexNet একা ছিল না — সঠিক moment-এ সঠিক tool: GPU mature, ImageNet ready, ReLU/dropout invented। সব meet করল ২০১২-এ Toronto-তে।
২ · ২০১০-২০১১ — pre-AlexNet ImageNet
- ২০১০ winner (NEC): ৭২% accuracy। Hand-crafted SIFT + Fisher vector + SVM।
- ২০১১ winner (Xerox): ৭৪%। ছোট improvement।
- Community consensus: classical method-এর "ceiling" ৭৫%।
৩ · ২০১২ — AlexNet bombshell
Alex Krizhevsky (Hinton-এর PhD student), Ilya Sutskever (Hinton-এর postdoc), Geoffrey Hinton (Toronto)। ${"{}"}$ submission-এ top-5 error 15.3%। Second place 26.2%।
- 10 percentage point gap — competition-এ unprecedented।
- CV community shocked।
- Within months — সব team CNN-এ shift।
৪ · AlexNet architecture
Input: 227×227×3 RGB।
- Conv1: 96 filters, 11×11, stride 4 → 55×55×96।
- MaxPool, LRN: 27×27×96।
- Conv2: 256 filters, 5×5, padding 2 → 27×27×256।
- MaxPool: 13×13×256।
- Conv3: 384 filters, 3×3 → 13×13×384।
- Conv4: 384 filters, 3×3 → 13×13×384।
- Conv5: 256 filters, 3×3 → 13×13×256।
- MaxPool: 6×6×256।
- FC1: 4096।
- FC2: 4096।
- Output: 1000 (ImageNet class)।
Total parameters: ~60 million (62.4M precisely)।
৫ · চার innovation
- ReLU activation: tanh-এর বদলে। 6x faster training।
- Dropout: FC layer-এ 50% dropout — overfitting কমায়।
- GPU training: দু'টি GTX 580 (3 GB)। Network split। ৫-৬ দিন training।
- Data augmentation: random crop, horizontal flip, PCA color jitter।
৬ · LRN (Local Response Normalization)
AlexNet-এ LRN — neighbor channel-এর response normalize। Brain-inspired ("lateral inhibition")। পরে BatchNorm এ replace হয়। আজকের network-এ LRN nonexistent।
৭ · Dual GPU split
২০১২-এ GPU memory ৩ GB — AlexNet ফিট হতো না। তাই network দু'টি GPU-এ split — কিছু channel এক GPU-তে, কিছু অন্য-তে। দু'টি stream কয়েক layer-এ communicate।
এই engineering hack — পরে ResNeXt-এর "group convolution" idea-র forerunner।
৮ · PyTorch-এ AlexNet
import torch
from torchvision.models import alexnet, AlexNet_Weights
# Pretrained AlexNet — ImageNet 2012 winner
model = alexnet(weights=AlexNet_Weights.IMAGENET1K_V1)
model.eval()
x = torch.randn(1, 3, 224, 224) # ImageNet input size
with torch.no_grad():
out = model(x)
print("Output shape:", out.shape) # (1, 1000)
print("Top class:", out.argmax(dim=1).item())
# Parameter count
n = sum(p.numel() for p in model.parameters())
print(f"Parameters: {n:,}") # ~61M
৯ · ২০১২-এর পরে — domino effect
- ২০১৩: ZFNet (Zeiler-Fergus) — visualization + AlexNet refinement।
- ২০১৪: VGG (Simonyan), GoogLeNet (Szegedy)।
- ২০১৫: ResNet — 152 layer, surpassed human।
- Industry: Google, Facebook, Microsoft DL team gear up।
- Hardware: NVIDIA GPU sales explode।
- Hinton-এর lab acquired by Google ($44M)।
- OpenAI founded ২০১৫.
- Krizhevsky → Google → DeepMind, Sutskever → OpenAI co-founder।
ভাবনার প্রশ্ন
প্র ০১ AlexNet-এর ৬০M parameter-এর ৯৪% (~৫৬M) FC layer-এ। Conv layer-এ মাত্র ~৪M। কেন এই imbalance, পরের architecture-এ কীভাবে fix?
এটি classical CNN-এর fundamental insight — যা VGG, ResNet design করেছে।
Parameter distribution:
- 5 conv layer total: ~3.7M params।
- FC1 (9216 → 4096): 37.7M।
- FC2 (4096 → 4096): 16.8M।
- FC3 (4096 → 1000): 4.1M।
- FC ৫৮.৬M out of 62.4M (94%)।
কেন এই imbalance:
- Conv-এ weight sharing — 11×11×96 = 10K-ই sufficient।
- FC dense — every input every output connect।
- 9216 → 4096 = 37.7M parameter — এই dense connectivity-র cost।
সমস্যা:
- Memory-heavy — train ও inference।
- Overfitting prone — dropout এই কারণে essential ছিল।
- Fixed input size — FC layer rigid।
সমাধান (post-AlexNet):
- Network-in-Network (২০১৩): 1×1 conv + global avg pool — FC remove।
- GoogLeNet (২০১৪): GAP, no FC। Parameter ৬M (10x less)।
- ResNet: single FC at end, parameter mostly in conv। 25M total।
- EfficientNet: compound scaling, careful balance।
Global Average Pooling (GAP):
- Last conv → channel-wise avg → vector।
- Spatial dimension fully collapse।
- Parameter: 0।
- Implicit regularization — overfit hard।
Modern parameter distribution (ResNet-50):
- Total: 25.6M।
- Conv: 23.5M (92%)।
- FC: 2.1M (only final classifier)।
- Reverse of AlexNet।
মূল উপলব্ধি: AlexNet showed CNN-এর viability; subsequent architectures showed "how to do it right"। FC overuse → conv dominance — DL design philosophy-র evolution।
প্র ০২ Hinton-এর lab Microsoft, Google, Baidu-র কাছে auction-এ বিক্রি হলো ($44M)। এই গল্প AI industry-র গঠন কীভাবে define করেছে?
DNNresearch auction (December 2012) — DL talent war-এর সূচনা। এর consequence এখনো খুঁজে পাওয়া যায়।
Auction setup:
- DNNresearch — Hinton + Krizhevsky + Sutskever-এর startup (officially company)।
- Bidder: Google, Microsoft, Baidu, DeepMind (then independent)।
- Auction happened on Hinton's hotel room conference call।
- Final: Google won at $44M।
Talent positioning:
- Hinton — Google Brain (Toronto)।
- Krizhevsky — Google → quit ২০১৭।
- Sutskever — Google → OpenAI co-founder ২০১৫।
- Hinton — Google leave ২০২৩, AI safety advocate।
Industry consequence:
- Talent inflation: top DL researcher salary $1M+ in years।
- Lab acquisitions: DeepMind by Google ($500M, 2014), Maluuba by Microsoft, etc।
- University drain: top professors moved to industry — academic CV slow।
- Big tech monopoly: compute, data, talent concentration।
OpenAI emergence:
- ২০১৫ — Musk, Altman, Sutskever co-found।
- Mission: counterbalance corporate AI dominance।
- Sutskever's chief scientist role — direct lineage from AlexNet।
Anthropic (২০২১):
- OpenAI alums (Amodei siblings)।
- Same generational chain — AlexNet → OpenAI → Anthropic।
Geopolitical:
- Baidu-র bid — China-US AI race-এর early signal।
- DeepMind acquisition — UK to US talent migration।
- EU Mistral, Aleph Alpha — recent EU sovereignty push।
Bangladesh implication:
- Top Bangladeshi ML talent — US universities → Big Tech।
- Local AI startup capability bottleneck — talent ও compute।
- Open source models (Llama, Mistral) — democratization যা talent-rich nations-এ available নয়।
মূল উপলব্ধি: Single research moment-এ industry, geopolitics, talent flow সব আকার নিয়েছিল। AI history accidents-এর সংগ্রহ।
প্র ০৩ AlexNet-এ dropout 50% — modern network-এ কম (10-20%)। কেন এই difference? Modern alternative কী?
Dropout (Srivastava et al., 2014) — AlexNet-এর key technique। আজ partly replaced।
Dropout মেকানিজম:
- Training-এ random 50% neuron activate (others zero)।
- Inference-এ — সব neuron, কিন্তু 0.5x scale।
- Effect: stochastic ensemble training।
AlexNet-এ 50% কেন এত aggressive?
- ৬০M parameter, ImageNet ১.৪M images — ratio 43:1। Severe overfit risk।
- FC layer-এ co-adaptation problem (neurons rely on each other)।
- 50% dropout — empirically optimal।
Modern network-এ dropout কম কেন?
- BatchNorm dominant: implicit regularization।
- Less FC layer: ResNet, EfficientNet-এ minimal FC।
- More data: dataset 10-100x larger।
- Better init: He init — already balanced।
Modern regularizer:
- BatchNorm: noise injection effect।
- Weight decay (L2): always essential।
- Data augmentation: heavy — virtual data multiplication।
- Label smoothing: overconfidence prevention।
- Stochastic depth: random skip layer (ResNet)।
- DropPath (Vision Transformer): path-level dropout।
Dropout still useful:
- Final FC layer: small dataset finetune-এ।
- Transformer: attention dropout, hidden dropout 0.1।
- RNN (legacy): recurrent dropout।
- Variational dropout: Bayesian approximation।
মূল উপলব্ধি: Each technique-এর "best practice" architecture-এর সাথে evolve। AlexNet-এর recipe blindly copy করা ভুল হবে।
প্র ০৪ ImageNet ২০১৭-এ ILSVRC বন্ধ হয়। কেন? কোন benchmark replaced — আজকের CV "score" কোথায় measure?
ILSVRC-এর retirement CV community-র maturation signal।
কেন ILSVRC বন্ধ:
- ২০১৫-এ ResNet — top-5 error 3.57%, human-level (5.1%) ছাড়িয়ে যায়।
- ২০১৭-এ — saturate। 2.25%।
- Improvements diminishing।
- Overfitting to ImageNet specifically — generalization concern।
- Test set leaked (Recht et al., ImageNet-V2 paper)।
Modern CV benchmark:
- ImageNet-21K: larger 21K class — pretraining।
- JFT-300M (Google internal): 300M images — foundation model।
- LAION-5B: 5 billion image-text pairs — CLIP, Stable Diffusion।
- COCO (detection/segmentation): 330K images, 80 class।
- ADE20K: 20K scene parsing।
- Cityscapes: 5000 driving image।
- WIT (Wikipedia): 11.5M image-text।
Robustness benchmark:
- ImageNet-C: noise, blur, weather corruption।
- ImageNet-A: adversarial example (real)।
- ImageNet-R: rendition (sketch, paint)।
- ObjectNet: Yale — uncontrolled poses।
Few-shot/Transfer benchmark:
- Meta-Dataset: 10 dataset, few-shot।
- VTAB: Visual Task Adaptation Benchmark।
- BIG-Bench Vision: emerging, multimodal।
Multimodal benchmark:
- VQA, GQA: visual question answering।
- MMVet, MMBench: vision-language model।
- Flickr30K, NoCaps: caption।
Foundation model era:
- "Single benchmark" outdated — comprehensive evaluation।
- HELM-style multi-task scoring।
- Real-world deployment-এর সাথে correlation important।
মূল উপলব্ধি: Benchmark-এর evolution — CV-র goal-এর evolution। ImageNet "classification accuracy" থেকে "general visual reasoning"-এ shift।
অনুশীলন
-
Conv1 param: AlexNet Conv1: 3 → 96 channel, 11×11 kernel। Total parameter (bias সহ)?
$3 \times 96 \times 11 \times 11 + 96 = 34{,}944$।
-
Pretrained: torchvision-এর pretrained AlexNet load করে একটি cat ছবিতে predict — কোডটি লিখুন।
from torchvision.models import alexnet, AlexNet_Weights import torch w = AlexNet_Weights.IMAGENET1K_V1 m = alexnet(weights=w).eval() preprocess = w.transforms() img = Image.open('cat.jpg').convert('RGB') x = preprocess(img).unsqueeze(0) out = m(x).softmax(1) top5 = out.topk(5).indices[0].tolist() print([w.meta['categories'][i] for i in top5]) -
ভাবুন: AlexNet-এ ১১×১১ kernel — পরে VGG-তে সব 3×3। এই switch-এর rationale?
VGG: তিনটি 3×3 conv = একটি 7×7 conv-এর RF, কিন্তু (1) parameter কম (3·9 vs 49), (2) more non-linearity (3 ReLU vs 1)। Smaller kernel + deeper network — accuracy বেশি।
আরও পড়ুন · ABCL TECH-এ আপনার পরবর্তী পদক্ষেপ
- পাঠ ১২ · VGG পরবর্তী পাঠ AlexNet-এর successor — গভীর কিন্তু সরল।
- পাঠ ১০ · LeNet আগের পাঠ CNN-এর জন্ম।
- পাঠ ১৪ · ResNet এগিয়ে যেখানে CNN human-এর চেয়ে accurate হয়।
- সব AI Courses দেখুন ABCL TECH Python, ML, DL, NLP, CV, GenAI, RL, MLOps — সব AI কোর্স একসাথে।