Meaningful images: Agar aap ek classifier ko ek image dikhao, toh woh confident hona chahiye (jaise "90% dog, 10% other") → p(y∣x) ki low entropy hoti hai
Diverse images: Sabhi images mein milake, aapko sabhi classes dikhni chahiye → p(y) ki high entropy hoti hai
Step 2: KL divergence ise quantify karta hai
DKL(p(y∣x)∣∣p(y))=∑yp(y∣x)logp(y)p(y∣x)
Yeh step kyun? KL divergence tab bada hota hai jab:
Pehla term −H(y∣x) hai (negative conditional entropy), doosra simplify hota hai kyunki Ex[∑yp(y∣x)logp(y)]=∑yp(y)logp(y)=−H(y).
Toh: KLavg=H(y)−H(y∣x)
Zyada H(y) (diverse labels) aur kam H(y∣x) (confident predictions) → zyada IS.
Step 4: Interpretability ke liye exponentiate karo
IS=exp(KLavg)
Exponentiate kyun? Log-space se ek aisi scale par convert karne ke liye jahan higher = better, aur "effective number of classes" wali intuition se match karne ke liye. IS ≈ 1 matlab terrible (sabhi images ek jaisi lagte hain ya noise hain), IS ≈ number of classes matlab perfect.
FID real images aur generated images ke distributions ke beech Inception-v3 ke feature space mein distance measure karta hai. Lower FID = distributions zyada close hain = better generation.
Trace kyun? Yeh sabhi 2048 dimensions mein covariance mismatch ko sum karta hai. −2(ΣrΣg)1/2 term ek geometric mean hai jo covariance structure differences ko penalize karta hai.
| Metric | Kya Measure Karta Hai | Pros | Cons | Best For |
|--------|-------|------|----------|
| IS | Quality & diversity (bina reference ke) | Fast, real data ki zaroorat nahi | Mode collapse detect nahi karta, ImageNet classes ki taraf biased | Quick sanity check, unconditional generation |
| FID | Real data se distribution match | Mode collapse pakad leta hai, human judgment se align hota hai | Real data chahiye, compute karna expensive | Final evaluation, models compare karna |
GAN Training Dynamics: Yeh metrics GAN training guide karte hain—collapse FID drop mein dikha deta hai.
Inception-v3 Architecture: Feature extractor ko samajhna clarify karta hai ki yeh metrics kyun kaam karte hain.
Mode Collapse in GANs: FID is failure mode detect karne ka primary tool hai.
Precision and Recall for Generative Models: Newer metrics jo FID ko quality (precision) aur coverage (recall) mein decompose karte hain.
Perceptual Loss Functions: Similar idea—pre-trained networks use karke perceptual similarity measure karo.
Recall Ek 12-Saal ke Bachche ko Explain Karo
Imagine karo tum ek teacher ho jo art students grade kar rahe ho. Tum chahte ho ki unki drawings:
Achhi hon (real cheezein jaisi lagein)
Diverse hon (sab ek hi tree na banayein)
Lekin tum khud hazaron drawings nahi dekh sakte, toh tum ek robot judge (Inception network) train karte ho jo seekh gaya hai ki "achha art" kaisa hota hai.
Inception Score (IS): Tum robot ko ek drawing dikhao. Agar woh kehta hai "yeh definitely ek dog hai!" (confident), toh drawing clear hai. Agar woh bahut saari drawings mein alag-alag cheezein dekhta hai (dogs, cats, cars), toh woh diverse hai. High IS = confident + diverse.
FID: Tumhare paas real photos aur student drawings hain. Tum robot se dono sets describe karwao (bina "dog" ya "cat" kahe, sirf internal descriptions jaise "pointy," "fluffy"). Phir tum measure karo: dono description clouds kitne similar hain? Chhota distance = drawings real photos jaisi lagti hain.
Dono kyun? IS sirf clarity check karta hai. FID check karta hai ki students sahi cheezein bana rahe hain (ek perfect dragon ki drawing "cats ki photos" se match nahi karti).
#flashcards/ai-ml
Inception Score (IS) kaunsi problem solve karta hai? :: Generative models ka automatic evaluation bina manual inspection ke, generated samples ki quality (sharpness) aur diversity dono measure karna ek pre-trained classifier se.
IS kaunsi do properties check karta hai?
1) Quality: individual samples mein low-entropy p(y|x) honi chahiye (confident predictions), 2) Diversity: marginal p(y) mein high entropy honi chahiye (sabhi classes represented).
Inception Score formula likho :: IS = exp(E_x[D_KL(p(y|x) || p(y))]) jahan p(y|x) classifier ki prediction hai generated image x ke liye, aur p(y) average class distribution hai.
IS mein KL divergence ko exponentiate kyun karte hain?
Log-space se ek interpretable scale par convert karne ke liye jahan higher better hai, aur "effective number of classes" wali intuition se match karne ke liye (perfect generation ke liye IS ≈ number of classes).
Inception Score ki main limitation kya hai?
Yeh mode collapse detect nahi kar sakta—ek model jo sirf ek mode ke perfect samples generate karta hai high IS achieve kar sakta hai kyunki p(y|x) phir bhi confident hai, chahe diversity kam ho.
FID kya measure karta hai?
Real image features aur generated image features ke distributions ke beech Inception-v3 ke feature space mein distance, specifically Fréchet distance yeh assume karke ki dono Gaussian hain.
FID formula likho
FID = ||μ_r - μ_g||² + Tr(Σ_r + Σ_g - 2(Σ_r Σ_g)^(1/2)) jahan μ aur Σ real (r) aur generated (g) features ka mean aur covariance hain.
FID ke do components kya hain?
1) Mean difference ||μ_r - μ_g||² jo distribution shift measure karta hai, 2) Covariance term Tr(Σ_r + Σ_g - 2(Σ_r Σ_g)^(1/2)) jo shape/spread mismatch measure karta hai.
Raw pixels ki jagah Inception-v3 features kyun use karte hain?
Inception features semantic properties (textures, object parts) capture karti hain jo human perception se align hoti hain, unlike pixel-space jahan chhote shifts bade distances cause karte hain chahe perceptually similar ho.
Kya aap alag-alag datasets ke FID scores compare kar sakte hain?
Nahi, FID dataset-dependent hai kyunki intrinsic complexity vary karti hai (MNIST vs CelebA) aur Inception ka feature space kuch data types ke liye doosron se better suited ho sakta hai.
FID = 0 ka matlab kya hai?
Generated aur real distributions feature space mein identical hain—lekin iska matlab yeh ho sakta hai ki model ne training data memorize kar li (overfitting) true generalization nahi.
FID mode collapse detect karne mein IS se better kyun hai?
FID real data distribution se compare karta hai, toh agar generator real data mein maujood modes miss karta hai, toh Σ_g, Σ_r se match nahi karega aur FID high hoga.
FID ke liye Inception-v3 ki kaunsi layer use hoti hai?
Pool3 layer (2048-dimensional feature vectors) final classification layer se pehle, jo high-level semantic features capture karti hai.
FID compute karne ke liye typically kitne samples use hote hain?
Stable covariance estimates paane ke liye real aur generated distributions dono se kam se kam 10,000 samples.
IS specifically KL divergence kyun use karta hai?
KL divergence naturally conditional p(y|x) aur marginal p(y) ke beech relationship capture karta hai—yeh bada hota hai jab individual samples confident hoon (low H(y|x)) lekin overall distribution diverse ho (high H(y)).
FID mein trace operation kya hai?
Tr(A) matrix A ke diagonal elements ko sum karta hai, is context mein sabhi 2048 feature dimensions mein total variance represent karta hai.
FID mein (Σ_r Σ_g)^(1/2) ki zaroorat kyun hai?
Matrix square root covariances ka geometric mean provide karta hai, ek symmetric distance create karta hai jo distributions ke beech correlation structure differences ko properly account karta hai.
High IS ke saath high FID kya indicate karta hai?
Generated images individually sharp hain aur bahut saari classes cover karti hain (high IS) lekin real data distribution se match nahi karti (high FID)—possible hai agar plausible lekin galat samples generate ho raha ho.
Low IS ke saath low FID kya indicate karta hai?
Yeh contradictory aur unlikely hai—low IS matlab blurry ya mode-collapsed samples, jo real data se achhi tarah match nahi hone chahiye. Evaluation error suggest karta hai.
FID ko quality se diversity alag karne ke liye kaunsa metric complement karta hai?
Generative models ke liye Precision aur Recall—precision sample quality measure karta hai (no outliers), recall mode coverage measure karta hai (distribution support).