{"id":99984,"date":"2026-09-03T17:03:52","date_gmt":"2026-09-03T09:03:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/99984.html"},"modified":"2026-09-03T17:03:52","modified_gmt":"2026-09-03T09:03:52","slug":"%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e6%8d%9f%e5%a4%b1%e5%87%bd%e6%95%b0%e8%af%a6%e8%a7%a3%ef%bc%9a%e4%bb%8e-mse%e3%80%81cross-entropy-%e5%88%b0-dice%e3%80%81focal%e3%80%81iou%e3%80%81contrastive-loss","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/99984.html","title":{"rendered":"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss"},"content":{"rendered":"<h2><\/h2>\n<p>\u672c\u6587\u7cfb\u7edf\u603b\u7ed3\u6df1\u5ea6\u5b66\u4e60\u4e2d\u5e38\u89c1\u7684\u635f\u5931\u51fd\u6570&#xff0c;<\/p>\n<ul>\n<li>\u4ece\u6700\u57fa\u7840\u7684 MSE\u3001MAE\u3001\u4ea4\u53c9\u71b5&#xff0c;<\/li>\n<li>\u5230\u5206\u7c7b\u4e2d\u7684 BCE\u3001Focal Loss&#xff0c;<\/li>\n<li>\u76ee\u6807\u68c0\u6d4b\u4e2d\u7684 IoU \/\u00a0GIoU \/ DIoU \/ CIoU&#xff0c;<\/li>\n<li>\u8bed\u4e49\u5206\u5272\u4e2d\u7684 Dice Loss\u3001Tversky Loss&#xff0c;<\/li>\n<li>\u518d\u5230\u5bf9\u6bd4\u5b66\u4e60\u4e2d\u7684 Contrastive Loss\u3001Triplet Loss&#xff0c;<\/li>\n<li>\u4ee5\u53ca KL Divergence\u3001CTC\u3001GAN\u3001\u6269\u6563\u6a21\u578b\u4e2d\u7684\u635f\u5931\u51fd\u6570\u3002<\/li>\n<\/ul>\n<p>\u672c\u6587\u91cd\u70b9\u4e0d\u662f\u7b80\u5355\u7f57\u5217\u516c\u5f0f&#xff0c;\u800c\u662f\u56de\u7b54\u4e09\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<li>\n<p><span style=\"color:#0d0016\">\u8fd9\u4e2a Loss \u5230\u5e95\u5728\u4f18\u5316\u4ec0\u4e48&#xff1f;<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#0d0016\">\u4e3a\u4ec0\u4e48\u8981\u8fd9\u6837\u8bbe\u8ba1&#xff1f;<\/span><\/p>\n<\/li>\n<li>\n<p><span style=\"color:#0d0016\">\u4ec0\u4e48\u65f6\u5019\u5e94\u8be5\u4f7f\u7528\u5b83&#xff1f;<\/span><\/p>\n<\/li>\n<hr \/>\n<h2>1. \u4ec0\u4e48\u662f\u635f\u5931\u51fd\u6570&#xff1f;<\/h2>\n<p>\u5728\u673a\u5668\u5b66\u4e60\u4e2d&#xff0c;\u6211\u4eec\u5e0c\u671b\u6a21\u578b\u00a0\u9884\u6d4b\u7ed3\u679c\u00a0<img decoding=\"async\" alt=\"$\\\\hat{y}$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f68c845.png\" \/>\u00a0\u5c3d\u53ef\u80fd\u63a5\u8fd1\u00a0\u771f\u5b9e\u6807\u7b7e\u00a0<img decoding=\"async\" alt=\"$y$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6a3afa.png\" \/>\u3002<\/p>\n<p>\u56e0\u6b64\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\mathcal{L}(y,\\\\hat{y})\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6a8d0d.png\" \/><\/p>\n<p>\u7528\u6765\u8861\u91cf&#xff1a;\u6a21\u578b\u9884\u6d4b\u5f97\u6709\u591a\u5dee\u3002\u4e5f\u5c31\u662f\u00a0Loss\u00a0\u8d8a\u5c0f \u21d2 \u9884\u6d4b\u7ed3\u679c\u8d8a\u63a5\u8fd1\u76ee\u6807\u3002<\/p>\n<p>\u8bad\u7ec3\u8fc7\u7a0b\u5c31\u662f\u4e0d\u65ad\u8c03\u6574\u6a21\u578b\u53c2\u6570 <img decoding=\"async\" alt=\"$\\\\theta$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6adf1f.png\" \/>&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ \\\\theta^* = \\\\arg\\\\min_{\\\\theta} \\\\mathcal{L}(f_\\\\theta(x),y) }\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6b31a3.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" alt=\"$x$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6b97ca.png\" \/>&#xff1a;\u8f93\u5165<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$y$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6a3afa.png\" \/>&#xff1a;\u771f\u5b9e\u6807\u7b7e<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$f_\\\\theta(x)$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6be9e9.png\" \/>&#xff1a;\u6a21\u578b\u9884\u6d4b&#xff0c;\u5373\u00a0<img decoding=\"async\" alt=\"\\\\hat{y}\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6c3ba8.png\" \/><\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$\\\\theta$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6adf1f.png\" \/>&#xff1a;\u6a21\u578b\u53c2\u6570<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$\\\\mathcal{L}$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6c8e9e.png\" \/>&#xff1a;\u635f\u5931\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>2. Loss\u3001Metric \u548c Objective \u6709\u4ec0\u4e48\u533a\u522b&#xff1f;<\/h2>\n<p>\u8fd9\u662f\u5b66\u4e60\u635f\u5931\u51fd\u6570\u65f6\u975e\u5e38\u5bb9\u6613\u6df7\u6dc6\u7684\u5730\u65b9\u3002<\/p>\n<h3>2.1 Loss<\/h3>\n<p>Loss \u7528\u4e8e&#xff1a;\u8bad\u7ec3\u6a21\u578b\u3002\u4f8b\u5982 pytorch \u4e2d\u7684\u5b9e\u73b0&#xff1a;<\/p>\n<p>loss &#061; nn.CrossEntropyLoss()<\/p>\n<p>\u7136\u540e\u53cd\u5411\u4f20\u64ad\u66f4\u65b0\u6a21\u578b\u53c2\u6570&#xff1a;<\/p>\n<p>loss.backward()<br \/>\noptimizer.step()<\/p>\n<hr \/>\n<h3>2.2 Metric<\/h3>\n<p>Metric \u7528\u4e8e&#xff1a;\u8bc4\u4ef7\u6a21\u578b\u6548\u679c\u3002\u4f8b\u5982\u5206\u7c7b\u8bc4\u4ef7\u6307\u6807&#xff1a;<\/p>\n<ul>\n<li>\n<p>Accuracy<\/p>\n<\/li>\n<li>\n<p>Precision<\/p>\n<\/li>\n<li>\n<p>Recall<\/p>\n<\/li>\n<li>\n<p>F1<\/p>\n<\/li>\n<li>\n<p>AUC<\/p>\n<\/li>\n<\/ul>\n<p>\u533b\u5b66\u56fe\u50cf\u5206\u5272\u8bc4\u4ef7\u6307\u6807&#xff1a;<\/p>\n<ul>\n<li>\n<p>Dice<\/p>\n<\/li>\n<li>\n<p>IoU<\/p>\n<\/li>\n<li>\n<p>HD95<\/p>\n<\/li>\n<\/ul>\n<p>\u5177\u4f53\u516c\u5f0f\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Dice= \\\\frac{2TP}{2TP+FP+FN}\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6ce37b.png\" \/><\/p>\n<hr \/>\n<h3>2.3 Objective<\/h3>\n<p>Objective \u53ef\u4ee5\u7406\u89e3\u4e3a\u6700\u7ec8\u4f18\u5316\u76ee\u6807\u3002<\/p>\n<p>\u4f8b\u5982\u591a\u4efb\u52a1\u5b66\u4e60&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\mathcal{L} = \\\\lambda_1\\\\mathcal{L}_{cls} + \\\\lambda_2\\\\mathcal{L}_{seg} + \\\\lambda_3\\\\mathcal{L}_{contrast}\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6d486e.png\" \/><\/p>\n<p>\u8fd9\u91cc\u6574\u4e2a <img decoding=\"async\" alt=\"$\\\\mathcal{L}$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6c8e9e.png\" \/>\u5c31\u662f\u6700\u7ec8 Objective\u3002<\/p>\n<hr \/>\n<h2>3. Loss \u51fd\u6570\u7684\u603b\u4f53\u5206\u7c7b<\/h2>\n<p>\u53ef\u4ee5\u628a\u6df1\u5ea6\u5b66\u4e60 Loss \u5927\u81f4\u5206\u6210\u4e0b\u9762\u51e0\u5927\u7c7b&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u522b\u5178\u578b Loss\u5178\u578b\u4efb\u52a1<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u56de\u5f52 Loss<\/td>\n<td style=\"text-align:center\">MSE\u3001MAE\u3001Huber<\/td>\n<td style=\"text-align:center\">\u56de\u5f52<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6982\u7387\u5206\u5e03 Loss<\/td>\n<td style=\"text-align:center\">KL Divergence<\/td>\n<td style=\"text-align:center\">\u84b8\u998f\u3001\u5206\u5e03\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b Loss<\/td>\n<td style=\"text-align:center\">BCE\u3001BCEWithLogits<\/td>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b\u3001\u591a\u6807\u7b7e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u5206\u7c7b Loss<\/td>\n<td style=\"text-align:center\">CE\u3001NLL<\/td>\n<td style=\"text-align:center\">\u591a\u5206\u7c7b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Margin Loss<\/td>\n<td style=\"text-align:center\">Hinge\u3001Margin Ranking<\/td>\n<td style=\"text-align:center\">SVM\u3001\u6392\u5e8f<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u4e0d\u5e73\u8861 Loss<\/td>\n<td style=\"text-align:center\">Focal\u3001Class-Balanced<\/td>\n<td style=\"text-align:center\">\u957f\u5c3e\u5206\u7c7b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5206\u5272 Loss<\/td>\n<td style=\"text-align:center\">Dice\u3001IoU\u3001Tversky<\/td>\n<td style=\"text-align:center\">\u533b\u5b66\u56fe\u50cf\u5206\u5272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u68c0\u6d4b Loss<\/td>\n<td style=\"text-align:center\">IoU\u3001GIoU\u3001DIoU\u3001CIoU<\/td>\n<td style=\"text-align:center\">\u76ee\u6807\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5ea6\u91cf\u5b66\u4e60<\/td>\n<td style=\"text-align:center\">Contrastive\u3001Triplet<\/td>\n<td style=\"text-align:center\">\u8868\u5f81\u5b66\u4e60<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5e8f\u5217 Loss<\/td>\n<td style=\"text-align:center\">CTC<\/td>\n<td style=\"text-align:center\">OCR\u3001\u8bed\u97f3<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u751f\u6210\u6a21\u578b<\/td>\n<td style=\"text-align:center\">GAN Loss\u3001VAE Loss\u3001Diffusion Loss<\/td>\n<td style=\"text-align:center\">\u751f\u6210\u6a21\u578b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6b63\u5219\u5316<\/td>\n<td style=\"text-align:center\">L1\u3001L2\u3001Elastic Net<\/td>\n<td style=\"text-align:center\">\u9632\u6b62\u8fc7\u62df\u5408<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u4efb\u52a1<\/td>\n<td style=\"text-align:center\">Weighted Sum<\/td>\n<td style=\"text-align:center\">\u591a\u4efb\u52a1\u5b66\u4e60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u9762\u9010\u4e2a\u5c55\u5f00\u3002<\/p>\n<hr \/>\n<h2>4. \u56de\u5f52\u635f\u5931\u51fd\u6570<\/h2>\n<p>\u56de\u5f52\u4efb\u52a1\u7684\u76ee\u6807\u901a\u5e38\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\hat{y}\\\\approx y\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6dc040.png\" \/><\/p>\n<p>\u6700\u7ecf\u5178\u7684\u51e0\u79cd Loss \u662f&#xff1a;<\/p>\n<ul>\n<li>\n<p>MSE<\/p>\n<\/li>\n<li>\n<p>MAE<\/p>\n<\/li>\n<li>\n<p>Smooth L1<\/p>\n<\/li>\n<li>\n<p>Huber<\/p>\n<\/li>\n<li>\n<p>Log-Cosh<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>5. MSE Loss<\/h2>\n<p>MSE&#xff08;Mean Squared Error&#xff0c;\u5747\u65b9\u8bef\u5dee&#xff09;<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{MSE} = \\\\frac{1}{N} \\\\sum_{i=1}^{N} (y_i-\\\\hat{y}_i)^2 }\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6e128a.png\" \/><\/p>\n<p>\u4e5f\u53ef\u4ee5\u5199\u6210&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{MSE} = \\\\mathbb{E} [(y-\\\\hat{y})^2]\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6e78b0.png\" \/><\/p>\n<hr \/>\n<h3>5.1 \u4e3a\u4ec0\u4e48\u53eb\u5e73\u65b9\u8bef\u5dee&#xff1f;<\/h3>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=10\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6edcdf.png\" \/><\/p>\n<p>\u6a21\u578b\u9884\u6d4b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\hat{y}=8\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6f2d47.png\" \/><\/p>\n<p>\u90a3\u4e48MSE&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=(y-\\\\hat{y})^2=4\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090351-6a9937f703b59.png\" \/><\/p>\n<p>\u5982\u679c\u9884\u6d4b\u9519\u5f97\u66f4\u591a&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\hat{y}=5\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090351-6a9937f708b3e.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=(10-5)^2=25\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090351-6a9937f70db52.png\" \/><\/p>\n<p>\u6240\u4ee5 MSE \u4f1a&#xff1a;\u5f3a\u70c8\u60e9\u7f5a\u5927\u8bef\u5dee\u3002<\/p>\n<hr \/>\n<h3>5.2 MSE \u7684\u68af\u5ea6<\/h3>\n<p>\u5bf9\u4e8e&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=(y-\\\\hat{y})^2\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090351-6a9937f713d93.png\" \/><\/p>\n<p>\u5bf9 <img decoding=\"async\" alt=\"$\\\\hat{y}$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f68c845.png\" \/>\u6c42\u5bfc&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\frac{\\\\partial L}{\\\\partial\\\\hat{y}} = 2(\\\\hat{y}-y)\" class=\"mathcode\" src=\"2026-09-034dcftgbsyun.png\" \/><\/p>\n<p>\u8bef\u5dee\u8d8a\u5927&#xff0c;\u68af\u5ea6\u8d8a\u5927\u3002<\/p>\n<p>\u56e0\u6b64&#xff1a;MSE \u5bf9\u5f02\u5e38\u503c\u975e\u5e38\u654f\u611f\u3002<\/p>\n<hr \/>\n<h3>5.3 MSE \u7684\u4f18\u70b9<\/h3>\n<ul>\n<li>\n<p>\u7b80\u5355<\/p>\n<\/li>\n<li>\n<p>\u5149\u6ed1<\/p>\n<\/li>\n<li>\n<p>\u53ef\u5bfc<\/p>\n<\/li>\n<li>\n<p>\u4f18\u5316\u7a33\u5b9a<\/p>\n<\/li>\n<li>\n<p>\u5927\u8bef\u5dee\u60e9\u7f5a\u5f3a<\/p>\n<\/li>\n<\/ul>\n<p>PyTorch \u5b9e\u73b0&#xff1a;<\/p>\n<p>import torch.nn as nn<\/p>\n<p>criterion &#061; nn.MSELoss()<\/p>\n<p>loss &#061; criterion(pred, target)<\/p>\n<hr \/>\n<h2>6. MAE \/ L1 Loss<\/h2>\n<p>MAE&#xff1a;Mean Absolute Error<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{MAE} = \\\\frac{1}{N} \\\\sum_{i=1}^{N} |y_i-\\\\hat{y}_i| }\" class=\"mathcode\" src=\"2026-09-03mpxggiuaal5.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=10,\\\\quad \\\\hat{y}=8\" class=\"mathcode\" src=\"2026-09-03g0mim4u5ksc.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=|10-8|=2\" class=\"mathcode\" src=\"2026-09-03bzu2bqhkldc.png\" \/><\/p>\n<hr \/>\n<h3>6.1 MAE \u548c MSE \u7684\u533a\u522b<\/h3>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"e=10\" class=\"mathcode\" src=\"2026-09-03cqdsdhy3nj0.png\" \/><\/p>\n<p>MSE&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=10^2=100\" class=\"mathcode\" src=\"2026-09-03cjrzt5k5c12.png\" \/><\/p>\n<p>MAE&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=|10|=10\" class=\"mathcode\" src=\"2026-09-03legbz31nd23.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>MSE \u4f1a\u653e\u5927\u5927\u8bef\u5dee&#xff0c;\u800c MAE \u5bf9\u5f02\u5e38\u503c\u66f4\u52a0\u9c81\u68d2\u3002<\/p>\n<hr \/>\n<h3>6.2 MAE \u7684\u95ee\u9898<\/h3>\n<p>\u7edd\u5bf9\u503c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"|x|\" class=\"mathcode\" src=\"2026-09-03ln4fzyl5ia5.png\" \/><\/p>\n<p>\u5728&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x=0\" class=\"mathcode\" src=\"2026-09-03jgvahn33qwm.png\" \/><\/p>\n<p>\u5904<span style=\"background-color:#ffd7b9\">\u4e0d\u53ef\u5bfc<\/span>\u3002\u867d\u7136\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u80fd\u591f\u5904\u7406\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u4f46\u76f8\u6bd4 MSE&#xff0c;\u5b83\u7684\u4f18\u5316\u901a\u5e38\u4e0d\u5982 MSE \u5e73\u6ed1\u3002<\/p>\n<p>PyTorch \u5b9e\u73b0&#xff1a;<\/p>\n<p>criterion &#061; nn.L1Loss()<\/p>\n<hr \/>\n<h2>7. MSE vs MAE<\/h2>\n<table>\n<tr>\u7279\u6027MSEMAE<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u8bef\u5dee\u5f62\u5f0f<\/td>\n<td style=\"text-align:center\"><img decoding=\"async\" alt=\"$e^2$\" class=\"mathcode\" src=\"2026-09-035yu2yjujlb1.png\" \/><\/td>\n<td style=\"text-align:center\"><img decoding=\"async\" alt=\"|e|\" class=\"mathcode\" src=\"2026-09-03aqafl4o4wzg.png\" \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5927\u8bef\u5dee\u60e9\u7f5a<\/td>\n<td style=\"text-align:center\">\u5f3a<\/td>\n<td style=\"text-align:center\">\u5f31<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5f02\u5e38\u503c\u654f\u611f\u5ea6<\/td>\n<td style=\"text-align:center\">\u9ad8<\/td>\n<td style=\"text-align:center\">\u4f4e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u68af\u5ea6<\/td>\n<td style=\"text-align:center\">\u8fde\u7eed<\/td>\n<td style=\"text-align:center\">0 \u70b9\u4e0d\u53ef\u5bfc<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u4f18\u5316<\/td>\n<td style=\"text-align:center\">\u5bb9\u6613<\/td>\n<td style=\"text-align:center\">\u76f8\u5bf9\u56f0\u96be<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u9c81\u68d2\u6027<\/td>\n<td style=\"text-align:center\">\u8f83\u5dee<\/td>\n<td style=\"text-align:center\">\u8f83\u597d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7b80\u5355\u7406\u89e3&#xff1a;<\/p>\n<p>MSE&#xff1a;\u6211\u975e\u5e38\u8ba8\u538c\u5927\u9519\u8bef\u3002<\/p>\n<p>MAE&#xff1a;\u5927\u9519\u8bef\u548c\u5c0f\u9519\u8bef\u6309\u7167\u7ebf\u6027\u6bd4\u4f8b\u5904\u7406\u3002<\/p>\n<hr \/>\n<h2>8. Smooth L1 Loss<\/h2>\n<p>Smooth L1 \u662f\u4e00\u79cd\u00a0MSE \u548c MAE \u7684\u6298\u4e2d\u3002<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L(x)= \\\\begin{cases} \\\\frac{1}{2}x^2, &amp; |x|&lt;\\\\beta\\\\\\\\ |x|-\\\\frac{1}{2}\\\\beta, &amp; |x|\\\\geq\\\\beta \\\\end{cases}\" class=\"mathcode\" src=\"2026-09-03mhjufylovsv.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x=y-\\\\hat{y}\" class=\"mathcode\" src=\"2026-09-03n5umxvszvlx.png\" \/><\/p>\n<p>\u6838\u5fc3\u601d\u60f3&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5c0f\u8bef\u5dee&#xff1a;\u4f7f\u7528\u5e73\u65b9\u51fd\u6570<\/p>\n<\/li>\n<li>\n<p>\u5927\u8bef\u5dee&#xff1a;\u4f7f\u7528\u7edd\u5bf9\u503c\u51fd\u6570<\/p>\n<\/li>\n<\/ul>\n<p>\u56e0\u6b64&#xff1a;\u5c0f\u8bef\u5dee\u533a\u57df\u5e73\u6ed1&#xff0c;\u5927\u8bef\u5dee\u533a\u57df\u9c81\u68d2\u3002<\/p>\n<hr \/>\n<h2>9. Huber Loss<\/h2>\n<p>Huber Loss \u4e0e Smooth L1 \u975e\u5e38\u63a5\u8fd1\u3002<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_\\\\delta(r) = \\\\begin{cases} \\\\frac{1}{2}r^2, &amp; |r|\\\\leq\\\\delta\\\\\\\\ \\\\delta(|r|-\\\\frac{1}{2}\\\\delta), &amp; |r|&gt;\\\\delta \\\\end{cases}\" class=\"mathcode\" src=\"2026-09-03vi5vqtpiypm.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"r=y-\\\\hat{y}\" class=\"mathcode\" src=\"2026-09-03b5ksilcjrcs.png\" \/><\/p>\n<p>\u5f53\u8bef\u5dee\u8f83\u5c0f\u65f6&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L\\\\sim MSE\" class=\"mathcode\" src=\"2026-09-031d2ecjdi1vd.png\" \/><\/p>\n<p>\u5f53\u8bef\u5dee\u8f83\u5927\u65f6&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L\\\\sim MAE\" class=\"mathcode\" src=\"2026-09-03nalotwwhzjx.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;Huber Loss \u662f\u7ecf\u5178\u7684\u9c81\u68d2\u56de\u5f52 Loss\u3002<\/p>\n<p>PyTorch \u5b9e\u73b0&#xff1a;<\/p>\n<p>criterion &#061; nn.HuberLoss(delta&#061;1.0)<\/p>\n<p>PyTorch \u4e5f\u5c06 SmoothL1Loss \u548c HuberLoss \u4f5c\u4e3a\u6807\u51c6 Loss \u63d0\u4f9b\u3002<\/p>\n<hr \/>\n<h2>10. Log-Cosh Loss<\/h2>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L(x)=\\\\log(\\\\cosh(x)) }\" class=\"mathcode\" src=\"2026-09-03mwod3ta2laq.png\" \/><\/p>\n<p>\u5f53 <img decoding=\"async\" alt=\"$x$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6b97ca.png\" \/> \u5f88\u5c0f\u65f6&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\log\\\\cosh(x)\\\\approx\\\\frac{x^2}{2}\" class=\"mathcode\" src=\"2026-09-03exiw12utkn3.png\" \/><\/p>\n<p>\u6240\u4ee5\u7c7b\u4f3c MSE\u3002<\/p>\n<p>\u5f53\u00a0<img decoding=\"async\" alt=\"$x$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6b97ca.png\" \/> \u5f88\u5927\u65f6&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\log\\\\cosh(x)\\\\approx |x|-\\\\log2\" class=\"mathcode\" src=\"2026-09-03kxm2x0msact.png\" \/><\/p>\n<p>\u6240\u4ee5\u7c7b\u4f3c MAE\u3002<\/p>\n<p>\u56e0\u6b64&#xff1a;Log-Cosh \u4e5f\u662f\u4e00\u79cd\u5e73\u6ed1\u7684\u9c81\u68d2\u56de\u5f52 Loss\u3002<\/p>\n<hr \/>\n<h2>11. \u56de\u5f52 Loss \u603b\u7ed3<\/h2>\n<table>\n<tr>Loss\u6838\u5fc3\u601d\u60f3\u5f02\u5e38\u503c<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">MSE<\/td>\n<td style=\"text-align:center\">\u5e73\u65b9\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u654f\u611f<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">MAE<\/td>\n<td style=\"text-align:center\">\u7edd\u5bf9\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u9c81\u68d2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Smooth L1<\/td>\n<td style=\"text-align:center\">MSE &#043; MAE<\/td>\n<td style=\"text-align:center\">\u9c81\u68d2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Huber<\/td>\n<td style=\"text-align:center\">MSE &#043; MAE<\/td>\n<td style=\"text-align:center\">\u9c81\u68d2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Log-Cosh<\/td>\n<td style=\"text-align:center\">\u5e73\u6ed1 MAE<\/td>\n<td style=\"text-align:center\">\u8f83\u9c81\u68d2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>12. \u4e8c\u5206\u7c7b\u635f\u5931&#xff1a;Binary Cross Entropy<\/h2>\n<p>\u5bf9\u4e8e\u4e8c\u5206\u7c7b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y\\\\in\\\\{0,1\\\\}\" class=\"mathcode\" src=\"2026-09-03qw5f4m4unny.png\" \/><\/p>\n<p>\u6a21\u578b\u8f93\u51fa&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p=P(y=1|x)\" class=\"mathcode\" src=\"2026-09-03c0aleoy2izp.png\" \/><\/p>\n<p>BCE&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{BCE} = - [ y\\\\log p+ (1-y)\\\\log(1-p) ] }\" class=\"mathcode\" src=\"2026-09-03by0ahmjm0cx.png\" \/><\/p>\n<hr \/>\n<h3>\u4e3a\u4ec0\u4e48\u53ef\u4ee5\u5f53\u4f5c\u4e8c\u5206\u7c7b\u7684\u635f\u5931&#xff1f;<\/h3>\n<h4>12.1 \u5f53\u771f\u5b9e\u6807\u7b7e\u662f 1<\/h4>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=1\" class=\"mathcode\" src=\"2026-09-03cnebl5zal04.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=-\\\\log p\" class=\"mathcode\" src=\"2026-09-031emwfwa0zll.png\" \/><\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" alt=\"$p=0.99$\" class=\"mathcode\" src=\"2026-09-030vxgqdy5pnl.png\" \/>\u00a0\u2192 Loss \u5f88\u5c0f<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$p=0.9$\" class=\"mathcode\" src=\"2026-09-03xe4yxchv5g4.png\" \/>\u00a0 \u2192 Loss \u8f83\u5c0f<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$p=0.1$\" class=\"mathcode\" src=\"2026-09-032ajy0km4b2n.png\" \/>\u00a0\u2192 Loss \u5f88\u5927<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h4>12.2 \u5f53\u771f\u5b9e\u6807\u7b7e\u662f 0<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=0\" class=\"mathcode\" src=\"2026-09-03wcaikw2h3xd.png\" \/><\/p>\n<p>\u5f97\u5230&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=-\\\\log(1-p)\" class=\"mathcode\" src=\"2026-09-032dpgvxcjivi.png\" \/><\/p>\n<p>\u5982\u679c\u6a21\u578b\u9519\u8bef\u5730\u9884\u6d4b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p=0.99\" class=\"mathcode\" src=\"2026-09-03wjv11zubm5d.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=-\\\\log(0.01)\" class=\"mathcode\" src=\"2026-09-03k1efu2kgiyf.png\" \/><\/p>\n<p>Loss \u4f1a\u975e\u5e38\u5927\u3002<\/p>\n<hr \/>\n<h2>13. BCEWithLogitsLoss<\/h2>\n<p>\u5b9e\u9645\u6df1\u5ea6\u5b66\u4e60\u4e2d\u66f4\u63a8\u8350&#xff1a;<\/p>\n<p>nn.BCEWithLogitsLoss()<\/p>\n<p>\u800c\u4e0d\u662f&#xff1a;<\/p>\n<p>sigmoid()<br \/>\n&#043;<br \/>\nBCELoss()<\/p>\n<p>\u56e0\u4e3a BCEWithLogitsLoss \u5c06 Sigmoid \u4e0e BCE \u5408\u5e76\u8ba1\u7b97&#xff0c;\u5e76\u4f7f\u7528\u6570\u503c\u7a33\u5b9a\u6280\u5de7&#xff0c;\u907f\u514d\u6982\u7387\u975e\u5e38\u63a5\u8fd1 0 \u6216 1 \u65f6\u51fa\u73b0\u6570\u503c\u95ee\u9898\u3002<\/p>\n<p>\u6b63\u786e\u5199\u6cd5&#xff1a;<\/p>\n<p>criterion &#061; nn.BCEWithLogitsLoss()<\/p>\n<p>logits &#061; model(x)<\/p>\n<p>loss &#061; criterion(logits, target)<\/p>\n<p>\u6a21\u578b\u6700\u540e&#xff1a;<\/p>\n<p>nn.Linear(&#8230;)<\/p>\n<p>\u4e0d\u8981\u518d\u624b\u52a8 Sigmoid\u3002<\/p>\n<hr \/>\n<h2>14. BCE \u6700\u9002\u5408\u4ec0\u4e48\u4efb\u52a1&#xff1f;<\/h2>\n<p>BCE \u975e\u5e38\u9002\u5408&#xff1a;<span style=\"color:#0d0016\">\u4e8c\u5206\u7c7b<\/span><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u6b63\u5e38 \/ \u60a3\u75c5<br \/>\n\u732b \/ \u72d7<br \/>\n\u6709\u76ee\u6807 \/ \u65e0\u76ee\u6807<\/p>\n<h4>\u591a\u6807\u7b7e\u5206\u7c7b<\/h4>\n<p>\u4f8b\u5982\u4e00\u4e2a\u6837\u672c\u540c\u65f6\u5b58\u5728&#xff1a;<\/p>\n<p>\u80ba\u708e<br \/>\n\u80f8\u8154\u79ef\u6db2<br \/>\n\u80ba\u4e0d\u5f20<br \/>\n\u6c14\u80f8<\/p>\n<p>\u6bcf\u4e2a\u6807\u7b7e\u90fd\u662f\u72ec\u7acb\u7684&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y_i\\\\in\\\\{0,1\\\\}\" class=\"mathcode\" src=\"2026-09-033ylhus0uz2v.png\" \/><\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4f7f\u7528&#xff1a;<\/p>\n<p>nn.BCEWithLogitsLoss()<\/p>\n<p>\u800c\u4e0d\u662f CrossEntropyLoss\u3002<\/p>\n<hr \/>\n<h2>15. Cross Entropy Loss<\/h2>\n<p>Cross Entropy \u662f\u6df1\u5ea6\u5b66\u4e60\u5206\u7c7b\u4efb\u52a1\u4e2d\u6700\u91cd\u8981\u7684 Loss \u4e4b\u4e00\u3002<\/p>\n<p>\u5bf9\u4e8e\u00a0<img decoding=\"async\" alt=\"$C$\" class=\"mathcode\" src=\"2026-09-030yqdehbw50c.png\" \/> \u4e2a\u7c7b\u522b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{CE} = -\\\\sum_{c=1}^{C} y_c\\\\log p_c }\" class=\"mathcode\" src=\"2026-09-03s0qxwlrvdm3.png\" \/><\/p>\n<p>\u5982\u679c\u6807\u7b7e\u662f one-hot&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=[0,0,1,0]\" class=\"mathcode\" src=\"2026-09-03ln4arr2rscr.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=-\\\\log p_3\" class=\"mathcode\" src=\"2026-09-03mccxjmxamju.png\" \/><\/p>\n<hr \/>\n<h2>16. \u4e3a\u4ec0\u4e48 Cross Entropy \u4e0e Softmax \u914d\u5408&#xff1f;<\/h2>\n<p>Softmax&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p_i= \\\\frac{e^{z_i}} {\\\\sum_j e^{z_j}}\" class=\"mathcode\" src=\"2026-09-03c2vgkhpwuja.png\" \/><\/p>\n<p>\u5176\u4e2d\u00a0<img decoding=\"async\" alt=\"$z_i$\" class=\"mathcode\" src=\"2026-09-0350o5qx54lzr.png\" \/>\u00a0\u662f\u6a21\u578b\u8f93\u51fa\u7684 logits\u3002<\/p>\n<p>Cross Entropy&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=-\\\\log p_y\" class=\"mathcode\" src=\"2026-09-03ubnacpr1ikt.png\" \/><\/p>\n<p>\u4ee3\u5165 Softmax&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L = -\\\\log \\\\frac{e^{z_y}} {\\\\sum_j e^{z_j}}\" class=\"mathcode\" src=\"2026-09-03beknau40qr4.png\" \/><\/p>\n<p>\u5f97\u5230&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L = -z_y + \\\\log\\\\sum_j e^{z_j} }\" class=\"mathcode\" src=\"2026-09-033eq2t1kugkx.png\" \/><\/p>\n<p>\u8fd9\u5c31\u662f\u5206\u7c7b\u6a21\u578b\u5e38\u89c1\u7684 LogSumExp \u7ed3\u6784\u3002<\/p>\n<p>PyTorch \u7684<span style=\"color:#956fe7\"> CrossEntropyLoss <\/span>\u63a5\u6536\u7684\u662f \u672a\u5f52\u4e00\u5316 logits&#xff0c;\u800c\u4e0d\u662f\u5148 Softmax \u540e\u7684\u6982\u7387&#xff0c;\u5b83\u5185\u90e8<span style=\"color:#956fe7\">\u7b49\u4ef7\u4e8e LogSoftmax &#043; NLLLoss<\/span>\u3002<\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p>criterion &#061; nn.CrossEntropyLoss()<\/p>\n<p>logits &#061; model(x)<\/p>\n<p>loss &#061; criterion(logits, target)<\/p>\n<p>\u4e0d\u8981&#xff1a;<\/p>\n<p>logits &#061; model(x)<\/p>\n<p>prob &#061; torch.softmax(logits, dim&#061;1)<\/p>\n<p>loss &#061; criterion(prob, target)<\/p>\n<hr \/>\n<h2>17. NLL Loss<\/h2>\n<p>NLL&#xff1a;Negative Log Likelihood<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{NLL} = -\\\\log P(y|x) }\" class=\"mathcode\" src=\"2026-09-03kn2zrp2wgeg.png\" \/><\/p>\n<p>PyTorch&#xff1a;<\/p>\n<p>criterion &#061; nn.NLLLoss()<\/p>\n<p>log_prob &#061; F.log_softmax(logits, dim&#061;1)<\/p>\n<p>loss &#061; criterion(log_prob, target)<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ CrossEntropy = LogSoftmax + NLLLoss }\" class=\"mathcode\" src=\"2026-09-03yuzwysq03lm.png\" \/><\/p>\n<hr \/>\n<h2>18. Cross Entropy \u4e3a\u4ec0\u4e48\u6709\u6548&#xff1f;<\/h2>\n<p>\u5047\u8bbe\u771f\u5b9e\u7c7b\u522b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=2\" class=\"mathcode\" src=\"2026-09-03lrzxjn2qsgh.png\" \/><\/p>\n<p>\u6a21\u578b\u9884\u6d4b&#xff1a;<\/p>\n<p>class 0: 0.1<br \/>\nclass 1: 0.1<br \/>\nclass 2: 0.8<\/p>\n<p>Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"-\\\\log0.8 \\\\approx0.223\" class=\"mathcode\" src=\"2026-09-035u4aydo1jxt.png\" \/><\/p>\n<p>\u5982\u679c\u6a21\u578b\u9884\u6d4b&#xff1a;<\/p>\n<p>class 0: 0.4<br \/>\nclass 1: 0.5<br \/>\nclass 2: 0.1<\/p>\n<p>Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"-\\\\log0.1 \\\\approx2.303\" class=\"mathcode\" src=\"2026-09-03dsdcjj1fkir.png\" \/><\/p>\n<p>\u6240\u4ee5&#xff1a;Cross Entropy \u672c\u8d28\u4e0a\u662f\u5728\u60e9\u7f5a\u6a21\u578b\u7ed9\u771f\u5b9e\u7c7b\u522b\u5206\u914d\u8fc7\u4f4e\u6982\u7387\u3002<\/p>\n<hr \/>\n<h2>19. Label Smoothing<\/h2>\n<p>\u666e\u901a One-Hot&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=[1,0,0]\" class=\"mathcode\" src=\"2026-09-03oxqhxplanjt.png\" \/><\/p>\n<p>Label Smoothing \u540e&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=[1-\\\\epsilon,\\\\frac{\\\\epsilon}{C-1},\\\\frac{\\\\epsilon}{C-1}]\" class=\"mathcode\" src=\"2026-09-033mfzcqr5ls1.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\epsilon=0.1\" class=\"mathcode\" src=\"2026-09-03yyyt0zqy2yp.png\" \/><\/p>\n<p>\u53d8\u6210&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"[0.9,0.05,0.05]\" class=\"mathcode\" src=\"2026-09-03idws5sa2oew.png\" \/><\/p>\n<p>\u76ee\u7684&#xff1a;\u4e0d\u8ba9\u6a21\u578b\u8fc7\u5ea6\u81ea\u4fe1\u3002<\/p>\n<p>PyTorch \u5b9e\u73b0&#xff1a;<\/p>\n<p>criterion &#061; nn.CrossEntropyLoss(<br \/>\n    label_smoothing&#061;0.1<br \/>\n)<\/p>\n<hr \/>\n<h2>20. BCE \u4e0e Cross Entropy \u7684\u533a\u522b<\/h2>\n<p>\u8fd9\u662f\u975e\u5e38\u91cd\u8981\u7684\u77e5\u8bc6\u70b9\u3002<\/p>\n<table>\n<tr>\u95ee\u9898BCECross Entropy<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b<\/td>\n<td style=\"text-align:center\">\u221a<\/td>\n<td style=\"text-align:center\">\u221a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u5206\u7c7b<\/td>\n<td style=\"text-align:center\">\u00d7<\/td>\n<td style=\"text-align:center\">\u221a<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u6807\u7b7e<\/td>\n<td style=\"text-align:center\">\u221a<\/td>\n<td style=\"text-align:center\">\u00d7<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u8f93\u51fa\u6fc0\u6d3b<\/td>\n<td style=\"text-align:center\">Sigmoid<\/td>\n<td style=\"text-align:center\">Softmax<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u7c7b\u522b\u4e4b\u95f4\u662f\u5426\u4e92\u65a5<\/td>\n<td style=\"text-align:center\">\u5426<\/td>\n<td style=\"text-align:center\">\u662f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<h4>\u591a\u5206\u7c7b<\/h4>\n<p>\u4e00\u5f20\u56fe\u7247\u53ea\u80fd\u662f&#xff1a;<\/p>\n<p>\u732b<br \/>\n\u72d7<br \/>\n\u9a6c<\/p>\n<p>\u4f7f\u7528&#xff1a;<\/p>\n<p>CrossEntropyLoss<\/p>\n<h4>\u591a\u6807\u7b7e<\/h4>\n<p>\u4e00\u5f20\u533b\u5b66\u5f71\u50cf\u53ef\u4ee5\u540c\u65f6&#xff1a;<\/p>\n<p>\u80ba\u708e &#061; 1<br \/>\n\u80f8\u8154\u79ef\u6db2 &#061; 1<br \/>\n\u6c14\u80f8 &#061; 0<\/p>\n<p>\u4f7f\u7528&#xff1a;<\/p>\n<p>BCEWithLogitsLoss<\/p>\n<hr \/>\n<h2>21. KL Divergence<\/h2>\n<p>KL&#xff1a;Kullback-Leibler Divergence<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ D_{KL}(P\\\\|Q) = \\\\sum_x P(x) \\\\log \\\\frac{P(x)}{Q(x)} }\" class=\"mathcode\" src=\"2026-09-03so4y3uhipzb.png\" \/><\/p>\n<p>\u5b83\u8861\u91cf&#xff1a;<\/p>\n<p>\u4e24\u4e2a\u6982\u7387\u5206\u5e03\u4e4b\u95f4\u6709\u591a\u4e0d\u4e00\u6837\u3002<\/p>\n<hr \/>\n<h3>21.1 KL \u7684\u76f4\u89c9<\/h3>\n<p>\u5047\u8bbe\u6559\u5e08\u6a21\u578b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"P=[0.7,0.2,0.1]\" class=\"mathcode\" src=\"2026-09-03prjugg3eran.png\" \/><\/p>\n<p>\u5b66\u751f\u6a21\u578b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Q=[0.6,0.3,0.1]\" class=\"mathcode\" src=\"2026-09-03glz245inw1b.png\" \/><\/p>\n<p>KL \u7528\u4e8e\u7ea6\u675f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Q\\\\approx P\" class=\"mathcode\" src=\"2026-09-03tgd3hjseeh0.png\" \/><\/p>\n<p>\u56e0\u6b64\u7ecf\u5e38\u7528\u4e8e&#xff1a;<\/p>\n<ul>\n<li>\n<p>Knowledge Distillation<\/p>\n<\/li>\n<li>\n<p>VAE<\/p>\n<\/li>\n<li>\n<p>\u5206\u5e03\u5bf9\u9f50<\/p>\n<\/li>\n<li>\n<p>\u6982\u7387\u6a21\u578b<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>22. KL \u4e0e Cross Entropy \u7684\u5173\u7cfb<\/h2>\n<p>\u4ea4\u53c9\u71b5&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"H(P,Q) = -\\\\sum_xP(x)\\\\log Q(x)\" class=\"mathcode\" src=\"2026-09-03imyudbw4jpg.png\" \/><\/p>\n<p>KL&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"D_{KL}(P\\\\|Q) = \\\\sum_xP(x)\\\\log\\\\frac{P(x)}{Q(x)}\" class=\"mathcode\" src=\"2026-09-030tuanndmc51.png\" \/><\/p>\n<p>\u5c55\u5f00&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"D_{KL}(P\\\\|Q) = H(P,Q)-H(P)\" class=\"mathcode\" src=\"2026-09-03jmarakguinx.png\" \/><\/p>\n<p>\u56e0\u4e3a <img decoding=\"async\" alt=\"$H(P)$\" class=\"mathcode\" src=\"2026-09-03yzjzte54zk3.png\" \/>\u00a0 \u4e0e\u6a21\u578b\u53c2\u6570\u65e0\u5173&#xff0c;\u6240\u4ee5\u5728\u4f18\u5316\u00a0<img decoding=\"async\" alt=\"$Q$\" class=\"mathcode\" src=\"2026-09-03la002k3ii3h.png\" \/>\u00a0\u65f6&#xff1a;\u6700\u5c0f\u5316 KL \u4e0e\u6700\u5c0f\u5316 Cross Entropy \u6709\u5bc6\u5207\u5173\u7cfb\u3002<\/p>\n<hr \/>\n<h2>23. Hinge Loss<\/h2>\n<p>Hinge Loss \u662f SVM \u7684\u7ecf\u5178\u635f\u5931\u3002<\/p>\n<p>\u6807\u7b7e&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y\\\\in\\\\{-1,+1\\\\}\" class=\"mathcode\" src=\"2026-09-03kz4rhm4md3t.png\" \/><\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L= \\\\max(0,1-yf(x)) }\" class=\"mathcode\" src=\"2026-09-03frhk4t1qofi.png\" \/><\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"yf(x)\\\\geq1\" class=\"mathcode\" src=\"2026-09-03t3cdefigsvz.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=0\" class=\"mathcode\" src=\"2026-09-03aw5e1h5bfbh.png\" \/><\/p>\n<p>\u5426\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L&gt;0\" class=\"mathcode\" src=\"2026-09-03nnodtz4f4yl.png\" \/><\/p>\n<p>\u5b83\u4e0d\u4ec5\u8981\u6c42\u5206\u7c7b\u6b63\u786e&#xff0c;\u8fd8\u8981\u6c42&#xff1a;\u9884\u6d4b\u7ed3\u679c\u62e5\u6709\u8db3\u591f\u5927\u7684 margin\u3002Hinge Loss \u662f\u6700\u5927\u95f4\u9694\u5206\u7c7b\u5668\u4e2d\u7684\u7ecf\u5178\u5f62\u5f0f\u3002<\/p>\n<hr \/>\n<h2>24. Focal Loss<\/h2>\n<p>\u5728\u76ee\u6807\u68c0\u6d4b\u3001\u533b\u5b66\u5f71\u50cf\u7b49\u4efb\u52a1\u4e2d\u7ecf\u5e38\u5b58\u5728&#xff1a;\u6b63\u8d1f\u6837\u672c\u6781\u5ea6\u4e0d\u5e73\u8861<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u80cc\u666f&#xff1a;99.9%<br \/>\n\u76ee\u6807&#xff1a;0.1%<\/p>\n<p>\u666e\u901a BCE \u5f88\u5bb9\u6613\u88ab\u5927\u91cf\u7b80\u5355\u8d1f\u6837\u672c\u652f\u914d\u3002<\/p>\n<p>Focal Loss \u7684\u601d\u60f3\u662f&#xff1a;<\/p>\n<p>\u964d\u4f4e\u7b80\u5355\u6837\u672c\u7684\u6743\u91cd&#xff0c;\u628a\u6ce8\u610f\u529b\u96c6\u4e2d\u5230\u56f0\u96be\u6837\u672c\u3002<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{Focal} = -\\\\alpha_t(1-p_t)^\\\\gamma\\\\log(p_t) }\" class=\"mathcode\" src=\"2026-09-035obsprenav0.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p_t= \\\\begin{cases} p,&amp;y=1\\\\\\\\ 1-p,&amp;y=0 \\\\end{cases}\" class=\"mathcode\" src=\"2026-09-03biqljbhzlgg.png\" \/><\/p>\n<hr \/>\n<h2>25. \u4e3a\u4ec0\u4e48 Focal Loss \u6709\u6548&#xff1f;<\/h2>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p_t=0.99\" class=\"mathcode\" src=\"2026-09-03sqnsrxuzptf.png\" \/><\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5bb9\u6613\u7684\u6837\u672c\u3002<\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\gamma=2\" class=\"mathcode\" src=\"2026-09-03fhmvg5qtd0l.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"(1-p_t)^2 = 0.01^2 = 0.0001\" class=\"mathcode\" src=\"2026-09-03woepnqyvkjt.png\" \/><\/p>\n<p>\u8fd9\u4e2a\u6837\u672c\u7684\u8d21\u732e\u88ab\u6781\u5927\u964d\u4f4e\u3002<\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p_t=0.2\" class=\"mathcode\" src=\"2026-09-03atk2oehc5cb.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"(1-p_t)^2=0.64\" class=\"mathcode\" src=\"2026-09-03lqyusb3flvx.png\" \/><\/p>\n<p>\u56f0\u96be\u6837\u672c\u4ecd\u7136\u5177\u6709\u8f83\u5927\u7684 Loss\u3002<\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p style=\"text-align:center\">FocalLoss &#061; CrossEntropy &#043; \u56f0\u96be\u6837\u672c\u52a0\u6743<\/p>\n<hr \/>\n<h2>26. Focal Loss PyTorch \u5b9e\u73b0<\/h2>\n<p>import torch<br \/>\nimport torch.nn.functional as F<\/p>\n<p>def focal_loss(logits, targets, alpha&#061;0.25, gamma&#061;2.0):<br \/>\n    bce &#061; F.binary_cross_entropy_with_logits(<br \/>\n        logits,<br \/>\n        targets.float(),<br \/>\n        reduction&#061;&#034;none&#034;<br \/>\n    )<\/p>\n<p>    probs &#061; torch.sigmoid(logits)<\/p>\n<p>    pt &#061; torch.where(<br \/>\n        targets &#061;&#061; 1,<br \/>\n        probs,<br \/>\n        1 &#8211; probs<br \/>\n    )<\/p>\n<p>    alpha_t &#061; torch.where(<br \/>\n        targets &#061;&#061; 1,<br \/>\n        alpha,<br \/>\n        1 &#8211; alpha<br \/>\n    )<\/p>\n<p>    loss &#061; alpha_t * (1 &#8211; pt).pow(gamma) * bce<\/p>\n<p>    return loss.mean()<\/p>\n<hr \/>\n<h2>27. Class-Balanced Loss<\/h2>\n<p>Focal Loss \u5173\u6ce8&#xff1a;<\/p>\n<p>\u6837\u672c\u96be\u5ea6\u3002<\/p>\n<p>Class-Balanced Loss \u5173\u6ce8&#xff1a;<\/p>\n<p>\u7c7b\u522b\u6570\u91cf\u4e0d\u5e73\u8861\u3002<\/p>\n<p>\u4e00\u4e2a\u7ecf\u5178\u601d\u8def\u662f\u6839\u636e\u7c7b\u522b\u7684\u6709\u6548\u6837\u672c\u6570\u91cf&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"E_n= \\\\frac{1-\\\\beta^n}{1-\\\\beta}\" class=\"mathcode\" src=\"2026-09-0304fgott5scc.png\" \/><\/p>\n<p>\u5b9a\u4e49\u7c7b\u522b\u6743\u91cd&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"w_n= \\\\frac{1-\\\\beta}{1-\\\\beta^n}\" class=\"mathcode\" src=\"2026-09-03crxg4sgyice.png\" \/><\/p>\n<p>\u5176\u4e2d <img decoding=\"async\" alt=\"$n$\" class=\"mathcode\" src=\"2026-09-03xuplkyxixqf.png\" \/> \u662f\u8be5\u7c7b\u522b\u6837\u672c\u6570\u3002<\/p>\n<p>\u6837\u672c\u8d8a\u5c11&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"n\\\\downarrow \\\\Rightarrow w_n\\\\uparrow\" class=\"mathcode\" src=\"2026-09-03dlj22bjktnf.png\" \/><\/p>\n<p>\u56e0\u6b64\u5c11\u6570\u7c7b\u4f1a\u5f97\u5230\u66f4\u5927\u7684\u6743\u91cd\u3002<\/p>\n<hr \/>\n<h2>28. Dice Loss<\/h2>\n<p>Dice Loss \u662f\u533b\u5b66\u56fe\u50cf\u5206\u5272\u4e2d\u6781\u5176\u91cd\u8981\u7684 Loss\u3002<\/p>\n<p>Dice&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ Dice= \\\\frac{2\\\\sum_i p_i g_i} {\\\\sum_i p_i+\\\\sum_i g_i} }\" class=\"mathcode\" src=\"2026-09-03kjinl2vkrcs.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" alt=\"$p_i$\" class=\"mathcode\" src=\"2026-09-03ldl3xqvoypj.png\" \/>&#xff1a;\u9884\u6d4b\u6982\u7387<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$g_i$\" class=\"mathcode\" src=\"2026-09-03pplukia0lku.png\" \/>&#xff1a;Ground Truth<\/p>\n<\/li>\n<\/ul>\n<p>Dice Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{Dice}=1-Dice }\" class=\"mathcode\" src=\"2026-09-03bdswz2wzxpj.png\" \/><\/p>\n<p>\u901a\u5e38\u6dfb\u52a0\u5e73\u6ed1\u9879&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Dice= \\\\frac{ 2\\\\sum_i p_ig_i+\\\\epsilon }{ \\\\sum_i p_i+\\\\sum_i g_i+\\\\epsilon }\" class=\"mathcode\" src=\"2026-09-03stpr5gawdpm.png\" \/><\/p>\n<hr \/>\n<h2>29. Dice \u4e3a\u4ec0\u4e48\u7279\u522b\u9002\u5408\u5206\u5272&#xff1f;<\/h2>\n<p>\u533b\u5b66\u56fe\u50cf\u901a\u5e38\u5b58\u5728&#xff1a;\u524d\u666f\u533a\u57df\u8fdc\u5c0f\u4e8e\u80cc\u666f\u533a\u57df\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u80ba\u90e8&#xff1a;90%<br \/>\n\u75c5\u7076&#xff1a;10%<\/p>\n<p>\u751a\u81f3&#xff1a;<\/p>\n<p>\u80cc\u666f&#xff1a;99%<br \/>\n\u75c5\u7076&#xff1a;1%<\/p>\n<p>Pixel-wise BCE \u5f88\u5bb9\u6613\u88ab\u80cc\u666f\u4e3b\u5bfc\u3002<\/p>\n<p>Dice \u76f4\u63a5\u8861\u91cf&#xff1a;\u9884\u6d4b\u533a\u57df\u548c\u771f\u5b9e\u533a\u57df\u7684\u91cd\u53e0\u7a0b\u5ea6&#xff0c;\u56e0\u6b64\u5bf9\u7c7b\u522b\u4e0d\u5e73\u8861\u66f4\u52a0\u53cb\u597d\u3002<\/p>\n<hr \/>\n<h2>30. Dice Loss \u7684\u4ee3\u7801<\/h2>\n<p>def dice_loss(pred, target, smooth&#061;1e-6):<br \/>\n    pred &#061; pred.contiguous()<br \/>\n    target &#061; target.contiguous()<\/p>\n<p>    intersection &#061; (pred * target).sum()<\/p>\n<p>    dice &#061; (<br \/>\n        2 * intersection &#043; smooth<br \/>\n    ) \/ (<br \/>\n        pred.sum() &#043; target.sum() &#043; smooth<br \/>\n    )<\/p>\n<p>    return 1 &#8211; dice<\/p>\n<hr \/>\n<h2>31. BCE &#043; Dice Loss<\/h2>\n<p>\u533b\u5b66\u56fe\u50cf\u5206\u5272\u975e\u5e38\u5e38\u89c1&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L= \\\\lambda_1L_{BCE} + \\\\lambda_2L_{Dice} }\" class=\"mathcode\" src=\"2026-09-032pn141vjb2j.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>loss &#061; bce_loss &#043; dice_loss<\/p>\n<p>\u4e3a\u4ec0\u4e48\u7ec4\u5408&#xff1f;<\/p>\n<p>BCE&#xff1a;<\/p>\n<p>\u5173\u6ce8\u6bcf\u4e00\u4e2a\u50cf\u7d20\u3002<\/p>\n<p>Dice&#xff1a;<\/p>\n<p>\u5173\u6ce8\u6574\u4f53\u533a\u57df\u91cd\u53e0\u3002<\/p>\n<p>\u6240\u4ee5\u4e8c\u8005\u5177\u6709\u4e92\u8865\u6027\u3002<\/p>\n<hr \/>\n<h2>32. IoU Loss<\/h2>\n<p>IoU\u00a0&#xff1a;\u4e5f\u53eb\u00a0Jaccard Index<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU= \\\\frac{|P\\\\cap G|} {|P\\\\cup G|}\" class=\"mathcode\" src=\"2026-09-03vwynoffe10c.png\" \/><\/p>\n<p>IoU Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{IoU}=1-IoU }\" class=\"mathcode\" src=\"2026-09-035areduzoz03.png\" \/><\/p>\n<p>\u5199\u6210\u9884\u6d4b\u6982\u7387\u5f62\u5f0f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU= \\\\frac{ \\\\sum_i p_ig_i }{ \\\\sum_i p_i+\\\\sum_i g_i-\\\\sum_i p_ig_i }\" class=\"mathcode\" src=\"2026-09-03vgsv5vrcihj.png\" \/><\/p>\n<hr \/>\n<h2>33. Dice \u4e0e IoU \u7684\u5173\u7cfb<\/h2>\n<p>\u4e8c\u8005\u5173\u7cfb&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ Dice= \\\\frac{2IoU}{1+IoU} }\" class=\"mathcode\" src=\"2026-09-0310yp1kzfyci.png\" \/><\/p>\n<p>\u53cd\u8fc7\u6765&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ IoU= \\\\frac{Dice}{2-Dice} }\" class=\"mathcode\" src=\"2026-09-03m5scmfrsb3p.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU=0.8\" class=\"mathcode\" src=\"2026-09-03xkutfmke0px.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Dice= \\\\frac{1.6}{1.8} \\\\approx0.889\" class=\"mathcode\" src=\"2026-09-032si42sf3u3c.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;Dice \u548c IoU \u672c\u8d28\u4e0a\u90fd\u5728\u8861\u91cf\u533a\u57df\u91cd\u53e0&#xff0c;\u4f46\u6570\u503c\u5e76\u4e0d\u76f8\u540c\u3002<\/p>\n<hr \/>\n<h2>34. Tversky Loss<\/h2>\n<p>Dice \u5bf9 FP \u548c FN \u7684\u60e9\u7f5a\u76f8\u5bf9\u5bf9\u79f0\u3002\u4f46\u533b\u5b66\u5206\u5272\u4e2d\u6709\u65f6&#xff1a;\u6f0f\u8bca\u6bd4\u8bef\u68c0\u66f4\u52a0\u4e25\u91cd\u3002<\/p>\n<p>\u4e8e\u662f\u53ef\u4ee5\u4f7f\u7528 Tversky Index&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ TI= \\\\frac{TP} {TP+\\\\alpha FP+\\\\beta FN} }\" class=\"mathcode\" src=\"2026-09-033dqnamtlpu1.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\alpha+\\\\beta=1\" class=\"mathcode\" src=\"2026-09-03nhbxhnchbmz.png\" \/><\/p>\n<p>Tversky Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{Tversky}=1-TI }\" class=\"mathcode\" src=\"2026-09-03dt3hiapcrde.png\" \/><\/p>\n<hr \/>\n<h3>34.1 \u5982\u4f55\u63a7\u5236 FP\/FN&#xff1f;<\/h3>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\beta&gt;\\\\alpha\" class=\"mathcode\" src=\"2026-09-03aqnk0d3sper.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"FN\" class=\"mathcode\" src=\"2026-09-032l510x1rb4c.png\" \/><\/p>\n<p>\u53d7\u5230\u66f4\u5927\u7684\u60e9\u7f5a\u3002<\/p>\n<p>\u4e5f\u5c31\u662f&#xff1a;\u66f4\u5173\u6ce8 Recall&#xff0c;\u51cf\u5c11\u6f0f\u68c0\u3002<\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\alpha&gt;\\\\beta\" class=\"mathcode\" src=\"2026-09-03izrxxhr2y2n.png\" \/><\/p>\n<p>\u5219\u66f4\u52a0\u60e9\u7f5a&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"FP\" class=\"mathcode\" src=\"2026-09-03k0atukhb3hi.png\" \/><\/p>\n<p>\u5373&#xff1a;\u66f4\u5173\u6ce8 Precision&#xff0c;\u51cf\u5c11\u8bef\u68c0\u3002<\/p>\n<hr \/>\n<h2>35. Focal Tversky Loss<\/h2>\n<p>Tversky \u8fd8\u53ef\u4ee5\u4e0e Focal \u601d\u60f3\u7ed3\u5408&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{FT} = (1-TI)^\\\\gamma }\" class=\"mathcode\" src=\"2026-09-03c0upfex2bsl.png\" \/><\/p>\n<p>\u8fd9\u6837&#xff1a;\u5bf9\u56f0\u96be\u533a\u57df\u8fdb\u884c\u8fdb\u4e00\u6b65\u5f3a\u8c03\u3002\u533b\u5b66\u56fe\u50cf\u4e2d\u5c0f\u76ee\u6807\u75c5\u7076\u5206\u5272\u7ecf\u5e38\u53ef\u4ee5\u8003\u8651\u8fd9\u79cd\u8bbe\u8ba1\u3002<\/p>\n<hr \/>\n<h2>36. Boundary Loss<\/h2>\n<p>Dice\/IoU \u4e3b\u8981\u5173\u6ce8&#xff1a;\u533a\u57df\u91cd\u53e0\u3002\u4f46\u662f\u5bf9\u4e8e\u4e00\u4e9b\u533b\u5b66\u56fe\u50cf&#xff1a;\u8fb9\u754c\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u80bf\u7624\u8fb9\u754c<br \/>\n\u5668\u5b98\u8fb9\u754c<br \/>\n\u8840\u7ba1\u8fb9\u754c<\/p>\n<p>\u6b64\u65f6\u53ef\u4ee5\u5f15\u5165 Boundary Loss\u3002\u5176\u6838\u5fc3\u601d\u60f3\u662f&#xff1a;\u76f4\u63a5\u4f18\u5316\u9884\u6d4b\u8fb9\u754c\u4e0e\u771f\u5b9e\u8fb9\u754c\u4e4b\u95f4\u7684\u8ddd\u79bb\u3002<\/p>\n<p>\u4f8b\u5982\u53ef\u4ee5\u4f7f\u7528\u8ddd\u79bb\u53d8\u6362&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{boundary} = \\\\sum_x p(x)d_G(x)\" class=\"mathcode\" src=\"2026-09-03a20snk4ajhq.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"d_G(x)\" class=\"mathcode\" src=\"2026-09-032pgxlrabm3c.png\" \/><\/p>\n<p>\u8868\u793a\u50cf\u7d20 <img decoding=\"async\" alt=\"$x$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6b97ca.png\" \/>\u00a0\u5230 Ground Truth \u8fb9\u754c\u7684\u8ddd\u79bb\u3002<\/p>\n<hr \/>\n<h2>37. Hausdorff Distance Loss<\/h2>\n<p>\u533b\u5b66\u56fe\u50cf\u5206\u5272\u7ecf\u5e38\u5173\u6ce8&#xff1a;Hausdorff Distance\u3002<\/p>\n<p>Hausdorff Distance&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"HD(A,B) = \\\\max \\\\left\\\\{ \\\\sup_{a\\\\in A}\\\\inf_{b\\\\in B}d(a,b), \\\\sup_{b\\\\in B}\\\\inf_{a\\\\in A}d(a,b) \\\\right\\\\}\" class=\"mathcode\" src=\"2026-09-03qjh5lr4210i.png\" \/><\/p>\n<p>\u5b83\u5173\u6ce8&#xff1a;\u6700\u574f\u60c5\u51b5\u4e0b\u7684\u8fb9\u754c\u8ddd\u79bb\u3002<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<ul>\n<li>\n<p>Dice \u9ad8<\/p>\n<\/li>\n<li>\n<p>\u4f46\u67d0\u4e2a\u8fb9\u754c\u4f4d\u7f6e\u504f\u5dee\u5f88\u5927<\/p>\n<\/li>\n<\/ul>\n<p>\u4ecd\u7136\u53ef\u80fd\u5f97\u5230\u8f83\u5927\u7684 HD&#xff0c;\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u533b\u5b66\u5206\u5272\u4e0d\u80fd\u53ea\u770b Dice\u3002<\/p>\n<hr \/>\n<h2>38. \u76ee\u6807\u68c0\u6d4b\u4e2d\u7684 Bounding Box Loss<\/h2>\n<p>\u76ee\u6807\u68c0\u6d4b\u901a\u5e38\u540c\u65f6\u9700\u8981\u4f18\u5316&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= L_{cls} + L_{obj} + L_{box}\" class=\"mathcode\" src=\"2026-09-03cih2sgntpkl.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5206\u7c7b Loss<\/p>\n<\/li>\n<li>\n<p>Objectness Loss<\/p>\n<\/li>\n<li>\n<p>Bounding Box Regression Loss<\/p>\n<\/li>\n<\/ul>\n<p>Bounding Box Loss \u7684\u7ecf\u5178\u65b9\u6cd5\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\n<p>L1<\/p>\n<\/li>\n<li>\n<p>Smooth L1<\/p>\n<\/li>\n<li>\n<p>IoU Loss<\/p>\n<\/li>\n<li>\n<p>GIoU Loss<\/p>\n<\/li>\n<li>\n<p>DIoU Loss<\/p>\n<\/li>\n<li>\n<p>CIoU Loss<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>39. IoU Bounding Box Loss<\/h2>\n<p>\u4e24\u4e2a\u6846&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"A,\\\\ B\" class=\"mathcode\" src=\"2026-09-030xrt0esorrb.png\" \/><\/p>\n<p>IoU&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU= \\\\frac{|A\\\\cap B|} {|A\\\\cup B|}\" class=\"mathcode\" src=\"2026-09-032p1hitfw43k.png\" \/><\/p>\n<p>Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{IoU}=1-IoU }\" class=\"mathcode\" src=\"2026-09-035areduzoz03.png\" \/><\/p>\n<p>\u95ee\u9898\u662f&#xff1a;\u5f53\u4e24\u4e2a\u6846\u6ca1\u6709\u91cd\u53e0\u65f6&#xff0c;IoU &#061; 0\u3002\u6b64\u65f6\u4e0d\u540c\u4f4d\u7f6e\u7684\u6846&#xff1a;<\/p>\n<p>IoU &#061; 0<br \/>\nIoU &#061; 0<br \/>\nIoU &#061; 0<\/p>\n<p>\u65e0\u6cd5\u544a\u8bc9\u6a21\u578b&#xff1a;\u5230\u5e95\u5e94\u8be5\u5f80\u54ea\u4e2a\u65b9\u5411\u79fb\u52a8\u3002<\/p>\n<hr \/>\n<h2>40. GIoU Loss<\/h2>\n<p>GIoU&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ GIoU = IoU - \\\\frac{|C-(A\\\\cup B)|}{|C|} }\" class=\"mathcode\" src=\"2026-09-03ou1cqg5a2pq.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<img decoding=\"async\" alt=\"C\" class=\"mathcode\" src=\"2026-09-035bfcpqyp5gc.png\" \/>\u00a0\u662f\u540c\u65f6\u5305\u4f4f\u4e24\u4e2a Bounding Box \u7684\u6700\u5c0f\u5916\u63a5\u6846\u3002<\/p>\n<p>Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{GIoU}=1-GIoU }\" class=\"mathcode\" src=\"2026-09-03owh5mz2s0o5.png\" \/><\/p>\n<p>\u56e0\u6b64\u5373\u4f7f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU=0\" class=\"mathcode\" src=\"2026-09-03lmw3prpu3vq.png\" \/><\/p>\n<p>GIoU \u4ecd\u7136\u80fd\u591f\u63d0\u4f9b\u4e00\u5b9a\u68af\u5ea6\u4fe1\u606f\u3002<\/p>\n<hr \/>\n<h2>41. DIoU Loss<\/h2>\n<p>DIoU \u4e0d\u4ec5\u8003\u8651\u91cd\u53e0\u9762\u79ef&#xff0c;\u8fd8\u8003\u8651&#xff1a;\u4e24\u4e2a\u6846\u4e2d\u5fc3\u70b9\u4e4b\u95f4\u7684\u8ddd\u79bb\u3002<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{DIoU} = 1-IoU + \\\\frac{\\\\rho^2(b,b^{gt})}{c^2} }\" class=\"mathcode\" src=\"2026-09-032dpbyzfnj25.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" alt=\"$\\\\rho$\" class=\"mathcode\" src=\"2026-09-03n5xij3t5k40.png\" \/>&#xff1a;\u4e24\u4e2a\u4e2d\u5fc3\u70b9\u7684\u6b27\u6c0f\u8ddd\u79bb<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$c$\" class=\"mathcode\" src=\"2026-09-03hhi21xz1vus.png\" \/>&#xff1a;\u5916\u63a5\u6846\u5bf9\u89d2\u7ebf\u957f\u5ea6<\/p>\n<\/li>\n<\/ul>\n<p>\u6240\u4ee5&#xff1a;DIoU \u4f1a\u76f4\u63a5\u63a8\u52a8\u9884\u6d4b\u6846\u4e2d\u5fc3\u5411\u771f\u5b9e\u6846\u4e2d\u5fc3\u79fb\u52a8\u3002<\/p>\n<hr \/>\n<h2>42. CIoU Loss<\/h2>\n<p>CIoU \u5728 DIoU \u57fa\u7840\u4e0a\u8fdb\u4e00\u6b65\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\n<p>Overlap<\/p>\n<\/li>\n<li>\n<p>Center distance<\/p>\n<\/li>\n<li>\n<p>Aspect ratio<\/p>\n<\/li>\n<\/ul>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{CIoU} = 1-IoU + \\\\frac{\\\\rho^2(b,b^{gt})}{c^2} + \\\\alpha v\" class=\"mathcode\" src=\"2026-09-03tj1j4ars4aq.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"v= \\\\frac{4}{\\\\pi^2} \\\\left( \\\\arctan\\\\frac{w^{gt}}{h^{gt}} - \\\\arctan\\\\frac{w}{h} \\\\right)^2\" class=\"mathcode\" src=\"2026-09-03tvjmq0t5hqy.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;CIoU \u540c\u65f6\u4f18\u5316\u4f4d\u7f6e\u3001\u91cd\u53e0\u548c\u5bbd\u9ad8\u6bd4\u3002<\/p>\n<hr \/>\n<h2>43. IoU \u7cfb\u5217\u600e\u4e48\u7406\u89e3&#xff1f;<\/h2>\n<p>\u53ef\u4ee5\u8bb0\u6210&#xff1a;<\/p>\n<p>IoU<br \/>\n \u2502<br \/>\n \u251c\u2500\u2500 GIoU&#xff1a;\u89e3\u51b3\u65e0\u91cd\u53e0\u95ee\u9898<br \/>\n \u2502<br \/>\n \u251c\u2500\u2500 DIoU&#xff1a;\u52a0\u5165\u4e2d\u5fc3\u8ddd\u79bb<br \/>\n \u2502<br \/>\n \u2514\u2500\u2500 CIoU&#xff1a;\u52a0\u5165\u5bbd\u9ad8\u6bd4<\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ CIoU = IoU + Center + AspectRatio }\" class=\"mathcode\" src=\"2026-09-03nonfto4mc1u.png\" \/><\/p>\n<hr \/>\n<h2>44. Contrastive Loss<\/h2>\n<p>\u5bf9\u6bd4\u5b66\u4e60\u7684\u76ee\u6807\u4e0d\u662f\u76f4\u63a5\u9884\u6d4b\u7c7b\u522b&#xff0c;\u800c\u662f\u5b66\u4e60&#xff1a;\u4ec0\u4e48\u6837\u7684\u6837\u672c\u5e94\u8be5\u63a5\u8fd1&#xff0c;\u4ec0\u4e48\u6837\u7684\u6837\u672c\u5e94\u8be5\u8fdc\u79bb\u3002<\/p>\n<p>\u7ed9\u5b9a\u4e24\u4e2a\u6837\u672c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"z_i,z_j\" class=\"mathcode\" src=\"2026-09-03f152mdlsvog.png\" \/><\/p>\n<p>\u6807\u7b7e&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y= \\\\begin{cases} 1,&amp;\\\\text{similar}\\\\\\\\ 0,&amp;\\\\text{different} \\\\end{cases}\" class=\"mathcode\" src=\"2026-09-03mxmw4lxetcw.png\" \/><\/p>\n<p>Contrastive Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L = yD^2 + (1-y) \\\\max(0,m-D)^2 }\" class=\"mathcode\" src=\"2026-09-03jkqhcwppwyt.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"D=\\\\|z_i-z_j\\\\|\" class=\"mathcode\" src=\"2026-09-0301xpb1y0zc1.png\" \/><\/p>\n<hr \/>\n<h2>45. Contrastive Loss \u7684\u76f4\u89c9<\/h2>\n<p>\u5982\u679c\u4e24\u4e2a\u6837\u672c\u662f\u6b63\u6837\u672c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=1\" class=\"mathcode\" src=\"2026-09-03cnebl5zal04.png\" \/><\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=D^2\" class=\"mathcode\" src=\"2026-09-03mbxv0wax20a.png\" \/><\/p>\n<p>\u8bad\u7ec3\u4f1a\u8ba9&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"D\\\\rightarrow0\" class=\"mathcode\" src=\"2026-09-03flyntwpdt20.png\" \/><\/p>\n<p>\u5373&#xff1a;\u6b63\u6837\u672c\u8d8a\u6765\u8d8a\u63a5\u8fd1\u3002<\/p>\n<p>\u5982\u679c\u662f\u8d1f\u6837\u672c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=0\" class=\"mathcode\" src=\"2026-09-03wcaikw2h3xd.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=\\\\max(0,m-D)^2\" class=\"mathcode\" src=\"2026-09-033icni03wmra.png\" \/><\/p>\n<p>\u53ea\u6709&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"D&lt;m\" class=\"mathcode\" src=\"2026-09-03ftyn0izfkfb.png\" \/><\/p>\n<p>\u624d\u6709 Loss\u3002<\/p>\n<p>\u56e0\u6b64&#xff1a;\u8d1f\u6837\u672c\u53ea\u9700\u8981\u8ddd\u79bb\u8d85\u8fc7 margin \u5373\u53ef\u3002<\/p>\n<hr \/>\n<h2>46. Triplet Loss<\/h2>\n<p>Triplet Loss \u4f7f\u7528\u4e09\u4e2a\u6837\u672c&#xff1a;<\/p>\n<p>Anchor<br \/>\nPositive<br \/>\nNegative<\/p>\n<p>\u5206\u522b\u8bb0\u4e3a&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"a,p,n\" class=\"mathcode\" src=\"2026-09-03dt4xvkgn1yq.png\" \/><\/p>\n<p>\u76ee\u6807&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"d(a,p)&lt;d(a,n)\" class=\"mathcode\" src=\"2026-09-03okwra5dm2fd.png\" \/><\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L= \\\\max [ d(a,p)-d(a,n)+m, 0 ] }\" class=\"mathcode\" src=\"2026-09-03m44iyu4j13w.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<img decoding=\"async\" alt=\"m\" class=\"mathcode\" src=\"2026-09-03yoiblkslsdv.png\" \/>\u00a0\u662f margin\u3002<\/p>\n<p>PyTorch \u7684 TripletMarginLoss \u5c31\u91c7\u7528\u8fd9\u4e00\u57fa\u672c\u5f62\u5f0f&#xff0c;\u7528 Anchor\u3001Positive\u3001Negative \u4e09\u5143\u7ec4\u4f18\u5316\u76f8\u5bf9\u8ddd\u79bb\u3002<\/p>\n<hr \/>\n<h2>47. Triplet Loss \u7684\u76f4\u89c9<\/h2>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"d(a,p)=0.3\" class=\"mathcode\" src=\"2026-09-03ho2e0vil15d.png\" \/>&#xff0c;<img decoding=\"async\" alt=\"d(a,n)=0.5\" class=\"mathcode\" src=\"2026-09-03wfm3okbd0za.png\" \/><\/p>\n<p>margin&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"m=0.2\" class=\"mathcode\" src=\"2026-09-03el0kqki5exr.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= \\\\max(0,0.3-0.5+0.2)=0\" class=\"mathcode\" src=\"2026-09-03ndduplrgar5.png\" \/><\/p>\n<p>\u8bf4\u660e\u5df2\u7ecf\u6ee1\u8db3\u8981\u6c42\u3002<\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"d(a,n)=0.4\" class=\"mathcode\" src=\"2026-09-03ed0yik3g5be.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= 0.3-0.4+0.2 = 0.1\" class=\"mathcode\" src=\"2026-09-03gqsoldf1mfx.png\" \/><\/p>\n<p>\u9700\u8981\u7ee7\u7eed\u4f18\u5316\u3002<\/p>\n<hr \/>\n<h2>48. Cosine Embedding Loss<\/h2>\n<p>\u5bf9\u4e8e\u4e24\u4e2a\u5411\u91cf&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x_1,x_2\" class=\"mathcode\" src=\"2026-09-03zwry2mzkhh4.png\" \/><\/p>\n<p>Cosine Similarity&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"cos(x_1,x_2) = \\\\frac{x_1^Tx_2} {\\\\|x_1\\\\|\\\\|x_2\\\\|}\" class=\"mathcode\" src=\"2026-09-03pusdrj2wbnr.png\" \/><\/p>\n<p>Cosine Embedding Loss \u7684\u76ee\u6807\u662f&#xff1a;\u6b63\u6837\u672c cosine similarity \u9ad8&#xff0c;\u8d1f\u6837\u672c cosine similarity \u4f4e\u3002<\/p>\n<p>\u975e\u5e38\u9002\u5408&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u6587\u672c\u5339\u914d<\/p>\n<\/li>\n<li>\n<p>\u56fe\u6587\u5bf9\u9f50<\/p>\n<\/li>\n<li>\n<p>Sentence Embedding<\/p>\n<\/li>\n<li>\n<p>\u591a\u6a21\u6001\u5b66\u4e60<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>49. Ranking Loss<\/h2>\n<p>Ranking Loss \u7528\u4e8e&#xff1a;<\/p>\n<p>\u6392\u5e8f\u4efb\u52a1\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u5546\u54c1 A \u5e94\u8be5\u6392\u5728\u5546\u54c1 B \u524d\u9762<\/p>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= \\\\max(0,-y(x_1-x_2)+m)\" class=\"mathcode\" src=\"2026-09-032rlru5h25ks.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y\\\\in\\\\{-1,+1\\\\}\" class=\"mathcode\" src=\"2026-09-03kz4rhm4md3t.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y=1\" class=\"mathcode\" src=\"2026-09-03cnebl5zal04.png\" \/><\/p>\n<p>\u8868\u793a&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x_1&gt;x_2\" class=\"mathcode\" src=\"2026-09-03nvehq2oio4a.png\" \/><\/p>\n<hr \/>\n<h2>50. CTC Loss<\/h2>\n<p>CTC&#xff1a;Connectionist Temporal Classification<\/p>\n<p>\u4e3b\u8981\u7528\u4e8e&#xff1a;<\/p>\n<ul>\n<li>\n<p>OCR<\/p>\n<\/li>\n<li>\n<p>ASR<\/p>\n<\/li>\n<li>\n<p>\u624b\u5199\u8bc6\u522b<\/p>\n<\/li>\n<li>\n<p>\u65e0\u660e\u786e\u5bf9\u9f50\u5173\u7cfb\u7684\u5e8f\u5217\u9884\u6d4b<\/p>\n<\/li>\n<\/ul>\n<p>\u4f8b\u5982\u8f93\u5165&#xff1a;<\/p>\n<p>\u56fe\u50cf\u7279\u5f81&#xff1a;<br \/>\nt1 t2 t3 t4 t5 t6<\/p>\n<p>\u76ee\u6807&#xff1a;<\/p>\n<p>HELLO<\/p>\n<p>\u4f46\u662f\u6211\u4eec\u5e76\u4e0d\u77e5\u9053&#xff1a;<\/p>\n<p>H \u5bf9\u5e94 t1\/t2&#xff1f;<br \/>\nE \u5bf9\u5e94 t3&#xff1f;<br \/>\nL \u5bf9\u5e94 t4\/t5&#xff1f;<\/p>\n<p>CTC \u901a\u8fc7&#xff1a;\u5bf9\u6240\u6709\u53ef\u80fd\u7684\u5bf9\u9f50\u8def\u5f84\u6c42\u548c\u00a0\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<hr \/>\n<h2>51. CTC \u7684\u6838\u5fc3\u601d\u60f3<\/h2>\n<p>\u5b9a\u4e49&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"P(y|x) = \\\\sum_{\\\\pi\\\\in B^{-1}(y)} P(\\\\pi|x)\" class=\"mathcode\" src=\"2026-09-03j2x5onhpvsy.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p><img decoding=\"async\" alt=\"$\\\\pi$\" class=\"mathcode\" src=\"2026-09-03et21zlauxm3.png\" \/>&#xff1a;\u4e00\u79cd\u53ef\u80fd\u7684\u5bf9\u9f50\u8def\u5f84<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$B$\" class=\"mathcode\" src=\"2026-09-03cn2kelhdxni.png\" \/>&#xff1a;CTC collapse \u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p><img decoding=\"async\" alt=\"$y$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f6a3afa.png\" \/>&#xff1a;\u6700\u7ec8\u6807\u7b7e\u5e8f\u5217<\/p>\n<\/li>\n<\/ul>\n<p>Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{CTC} = -\\\\log P(y|x) }\" class=\"mathcode\" src=\"2026-09-03ahyp40rbsyf.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;CTC \u4e0d\u9700\u8981\u4eba\u5de5\u63d0\u4f9b\u6bcf\u4e2a\u65f6\u95f4\u6b65\u5bf9\u5e94\u54ea\u4e2a\u5b57\u7b26\u3002<\/p>\n<hr \/>\n<h2>52. VAE Loss<\/h2>\n<p>VAE&#xff1a;Variational Autoencoder<\/p>\n<p>VAE \u7684 Loss \u901a\u5e38\u7531\u4e24\u90e8\u5206\u7ec4\u6210&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{VAE} = L_{reconstruction} + \\\\beta L_{KL} }\" class=\"mathcode\" src=\"2026-09-0314dhgxlwucm.png\" \/><\/p>\n<p>\u5373&#xff1a;<\/p>\n<p>VAE Loss<br \/>\n   \u2502<br \/>\n   \u251c\u2500\u2500 Reconstruction Loss<br \/>\n   \u2502<br \/>\n   \u2514\u2500\u2500 KL Divergence<\/p>\n<hr \/>\n<h2>53. Reconstruction Loss<\/h2>\n<p>\u4f8b\u5982\u56fe\u50cf\u91cd\u6784&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{rec} = \\\\|x-\\\\hat{x}\\\\|^2\" class=\"mathcode\" src=\"2026-09-03juai4ecs45e.png\" \/><\/p>\n<p>\u5b83\u8981\u6c42&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\hat{x}\\\\approx x\" class=\"mathcode\" src=\"2026-09-03ee53pwp3e3x.png\" \/><\/p>\n<p>\u5373&#xff1a;\u7f16\u7801\u4e4b\u540e\u4ecd\u7136\u80fd\u591f\u6062\u590d\u539f\u59cb\u8f93\u5165\u3002<\/p>\n<hr \/>\n<h2>54. VAE \u4e2d\u7684 KL Loss<\/h2>\n<p>VAE \u5e0c\u671b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"q(z|x)\" class=\"mathcode\" src=\"2026-09-03ug1ve5g2s2s.png\" \/><\/p>\n<p>\u63a5\u8fd1&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p(z)\" class=\"mathcode\" src=\"2026-09-03tc533cm1c1d.png\" \/><\/p>\n<p>\u901a\u5e38&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"p(z)=N(0,I)\" class=\"mathcode\" src=\"2026-09-03jvyfru1aecs.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{KL} = D_{KL} (q(z|x)\\\\|p(z))\" class=\"mathcode\" src=\"2026-09-03lm42rlp4gwn.png\" \/><\/p>\n<p>\u5982\u679c&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"q(z|x) = N(\\\\mu,\\\\sigma^2)\" class=\"mathcode\" src=\"2026-09-03u2zsppap2oc.png\" \/><\/p>\n<p>\u5219&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{KL} = -\\\\frac12 \\\\sum_i (1+\\\\log\\\\sigma_i^2-\\\\mu_i^2-\\\\sigma_i^2) }\" class=\"mathcode\" src=\"2026-09-03cweppkjylbe.png\" \/><\/p>\n<p>\u6700\u7ec8&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= L_{rec}+\\\\beta L_{KL}\" class=\"mathcode\" src=\"2026-09-03th0bqni2ygh.png\" \/><\/p>\n<hr \/>\n<h2>55. GAN Loss<\/h2>\n<p>GAN \u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>Generator&#xff08;G&#xff09;&#xff1a;\u751f\u6210\u5047\u6837\u672c\u3002<\/li>\n<li>Discriminator (D)&#xff1a;\u5224\u65ad\u771f\u5047\u3002<\/li>\n<\/ul>\n<p>\u7ecf\u5178 GAN&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ \\\\min_G\\\\max_D V(D,G) = E_{x\\\\sim p_{data}} [\\\\log D(x)] + E_{z\\\\sim p_z} [ \\\\log(1-D(G(z))) ] }\" class=\"mathcode\" src=\"2026-09-03lj1howiuzfa.png\" \/><\/p>\n<hr \/>\n<h2>56. Generator Loss<\/h2>\n<p>\u7ecf\u5178 GAN \u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_G = E_z[ \\\\log(1-D(G(z))) ]\" class=\"mathcode\" src=\"2026-09-03fq5dejtzquy.png\" \/><\/p>\n<p>\u5b9e\u9645\u8bad\u7ec3\u4e2d\u7ecf\u5e38\u4f7f\u7528 Non-Saturating Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_G = -E_z[ \\\\log D(G(z)) ] }\" class=\"mathcode\" src=\"2026-09-03h4sdoy3sxb2.png\" \/><\/p>\n<p>\u76ee\u6807&#xff1a;\u8ba9 Discriminator \u628a\u751f\u6210\u6837\u672c\u5224\u65ad\u6210\u771f\u3002<\/p>\n<hr \/>\n<h2>57. Diffusion Model Loss<\/h2>\n<p>\u6269\u6563\u6a21\u578b\u7684\u6838\u5fc3\u662f&#xff1a;\u5411\u6570\u636e\u4e2d\u4e0d\u65ad\u52a0\u5165\u566a\u58f0&#xff0c;\u518d\u8bad\u7ec3\u6a21\u578b\u9884\u6d4b\u566a\u58f0\u3002<\/p>\n<p>\u524d\u5411\u8fc7\u7a0b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x_t = \\\\sqrt{\\\\bar{\\\\alpha}_t}x_0 + \\\\sqrt{1-\\\\bar{\\\\alpha}_t}\\\\epsilon\" class=\"mathcode\" src=\"2026-09-03mybp00ie01l.png\" \/><\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\epsilon\\\\sim N(0,I)\" class=\"mathcode\" src=\"2026-09-03l2a5k2kmcis.png\" \/><\/p>\n<p>\u6a21\u578b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\epsilon_\\\\theta(x_t,t)\" class=\"mathcode\" src=\"2026-09-03oeyispyemmi.png\" \/><\/p>\n<p>\u9884\u6d4b\u566a\u58f0\u3002\u6700\u7ecf\u5178\u7684\u8bad\u7ec3 Loss&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L= E_{x_0,\\\\epsilon,t} \\\\left[ \\\\|\\\\epsilon- \\\\epsilon_\\\\theta(x_t,t)\\\\|^2 \\\\right] }\" class=\"mathcode\" src=\"2026-09-03oyon1ifwkho.png\" \/><\/p>\n<p>\u4e5f\u5c31\u662f&#xff1a;\u8ba9\u6a21\u578b\u9884\u6d4b\u81ea\u5df1\u52a0\u8fdb\u53bb\u7684\u566a\u58f0\u3002<\/p>\n<hr \/>\n<h2>58. L1\/L2 Regularization<\/h2>\n<p>\u4e25\u683c\u6765\u8bf4&#xff0c;L1\/L2 \u4e0d\u4e00\u5b9a\u662f\u4efb\u52a1 Loss&#xff0c;\u800c\u662f&#xff1a;\u53c2\u6570\u6b63\u5219\u5316\u9879\u3002<\/p>\n<hr \/>\n<h3>L1 Regularization<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{L1} = \\\\lambda \\\\sum_i|w_i| }\" class=\"mathcode\" src=\"2026-09-03hmw5thn2kf4.png\" \/><\/p>\n<p>\u4f5c\u7528&#xff1a;\u9f13\u52b1\u53c2\u6570\u53d8\u6210 0\u3002\u56e0\u6b64\u53ef\u4ee5\u4ea7\u751f&#xff1a;\u7a00\u758f\u6a21\u578b\u3002<\/p>\n<hr \/>\n<h3>L2 Regularization<\/h3>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"boxed{ L_{L2} = \\\\lambda \\\\sum_iw_i^2 }\" class=\"mathcode\" src=\"2026-09-03um4jvhihotz.png\" \/><\/p>\n<p>\u6700\u7ec8&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= L_{task} + \\\\lambda\\\\|w\\\\|_2^2\" class=\"mathcode\" src=\"2026-09-03rca5j2cbpmw.png\" \/><\/p>\n<p>\u4f5c\u7528&#xff1a;\u6291\u5236\u6a21\u578b\u53c2\u6570\u8fc7\u5927&#xff0c;\u964d\u4f4e\u8fc7\u62df\u5408\u98ce\u9669\u3002<\/p>\n<hr \/>\n<h2>59. Elastic Net<\/h2>\n<p>Elastic Net \u540c\u65f6\u7ed3\u5408&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{Elastic} = \\\\lambda_1\\\\|w\\\\|_1 + \\\\lambda_2\\\\|w\\\\|_2^2\" class=\"mathcode\" src=\"2026-09-03wlfssl3f0ht.png\" \/><\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p>L1 \u2192 \u7a00\u758f<br \/>\nL2 \u2192 \u5e73\u6ed1<br \/>\nElastic Net \u2192 \u4e24\u8005\u7ed3\u5408<\/p>\n<hr \/>\n<h2>60. \u591a\u4efb\u52a1\u5b66\u4e60 Loss<\/h2>\n<p>\u73b0\u5b9e\u4efb\u52a1\u5f80\u5f80\u4e0d\u662f\u53ea\u6709\u4e00\u4e2a\u76ee\u6807\u3002<\/p>\n<p>\u4f8b\u5982\u533b\u5b66 AI&#xff1a;<\/p>\n<p>\u8f93\u5165 CT<br \/>\n   \u2502<br \/>\n   \u251c\u2500\u2500 \u5206\u7c7b<br \/>\n   \u251c\u2500\u2500 \u5206\u5272<br \/>\n   \u2514\u2500\u2500 \u68c0\u6d4b<\/p>\n<p>\u5206\u522b\u5f97\u5230&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{cls}\" class=\"mathcode\" src=\"2026-09-03dknm11z02fa.png\" \/>&#xff0c;<img decoding=\"async\" alt=\"L_{seg}\" class=\"mathcode\" src=\"2026-09-03zcqrsv2tknh.png\" \/>\u00a0&#xff0c;<img decoding=\"async\" alt=\"L_{det}\" class=\"mathcode\" src=\"2026-09-03ikwhpmdbrn1.png\" \/><\/p>\n<p>\u6700\u7ec8&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L= \\\\lambda_1L_{cls} + \\\\lambda_2L_{seg} + \\\\lambda_3L_{det} }\" class=\"mathcode\" src=\"2026-09-03bjd10kifmag.png\" \/><\/p>\n<hr \/>\n<h2>61. \u4e3a\u4ec0\u4e48\u9700\u8981 Loss Weight&#xff1f;<\/h2>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{cls}=0.1\" class=\"mathcode\" src=\"2026-09-03wav1ioose5f.png\" \/><\/p>\n<p>\u4f46\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L_{seg}=10\" class=\"mathcode\" src=\"2026-09-03thbxu2vyfxt.png\" \/><\/p>\n<p>\u76f4\u63a5\u76f8\u52a0&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=10.1\" class=\"mathcode\" src=\"2026-09-033fgxxwf4fmy.png\" \/><\/p>\n<p>\u8fd9\u610f\u5473\u7740&#xff1a;Segmentation Loss \u5bf9\u68af\u5ea6\u7684\u5f71\u54cd\u53ef\u80fd\u8fdc\u5927\u4e8e Classification Loss\u3002<\/p>\n<p>\u56e0\u6b64\u9700\u8981&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= \\\\lambda_{cls}L_{cls} + \\\\lambda_{seg}L_{seg}\" class=\"mathcode\" src=\"2026-09-03gronsciqzyn.png\" \/><\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\lambda_{cls}=1\" class=\"mathcode\" src=\"2026-09-03k5iw2rhyhsn.png\" \/>\u00a0&#xff0c;<img decoding=\"async\" alt=\"\\\\lambda_{seg}=0.1\" class=\"mathcode\" src=\"2026-09-03qcrufxk1mjf.png\" \/><\/p>\n<hr \/>\n<h2>62. \u5e38\u89c1 Loss \u7ec4\u5408<\/h2>\n<p>\u5b9e\u9645\u79d1\u7814\u4e2d&#xff0c;\u5355\u72ec\u4f7f\u7528\u4e00\u4e2a Loss \u5e76\u4e0d\u4e00\u5b9a\u662f\u6700\u597d\u7684\u9009\u62e9\u3002<\/p>\n<p>\u5e38\u89c1\u7ec4\u5408\u5305\u62ec&#xff1a;<\/p>\n<h4>\u5206\u7c7b<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=CE\" class=\"mathcode\" src=\"2026-09-03k1xwdwgvkaq.png\" \/><\/p>\n<hr \/>\n<h4>\u7c7b\u522b\u4e0d\u5e73\u8861\u5206\u7c7b<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=Focal\" class=\"mathcode\" src=\"2026-09-03fg0t1fle3zd.png\" \/><\/p>\n<p>\u6216\u8005&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=WeightedCE\" class=\"mathcode\" src=\"2026-09-032jc2m2cum1z.png\" \/><\/p>\n<hr \/>\n<h4>\u4e8c\u5206\u7c7b<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=BCE\" class=\"mathcode\" src=\"2026-09-03i4lce1roszs.png\" \/><\/p>\n<hr \/>\n<h4>\u533b\u5b66\u56fe\u50cf\u5206\u5272<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=Dice+BCE\" class=\"mathcode\" src=\"2026-09-030bts21seorg.png\" \/><\/p>\n<hr \/>\n<h4>\u5c0f\u76ee\u6807\u5206\u5272<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=Focal+Dice\" class=\"mathcode\" src=\"https:\/\/latex.csdn.net\/eq?L%3DFocal&amp;plus;Dice\" \/><\/p>\n<hr \/>\n<h4>\u533b\u5b66\u8fb9\u754c\u5206\u5272<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=Dice+Boundary\" class=\"mathcode\" src=\"2026-09-03ytapbreewqp.png\" \/><\/p>\n<hr \/>\n<h4>\u591a\u4efb\u52a1<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L= \\\\lambda_1L_1+ \\\\lambda_2L_2+ \\\\cdots+ \\\\lambda_nL_n\" class=\"mathcode\" src=\"2026-09-03ux5youpbtsp.png\" \/><\/p>\n<hr \/>\n<h2>63. \u533b\u5b66\u56fe\u50cf\u5206\u5272\u4e3a\u4ec0\u4e48\u7ecf\u5e38\u4f7f\u7528 Dice &#043; CE&#xff1f;<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u95ee\u9898\u3002\u5047\u8bbe\u75c5\u7076\u53ea\u53601%&#xff0c;\u80cc\u666f\u536099%<\/p>\n<p>\u5982\u679c\u4f7f\u7528 BCE&#xff1a;<\/p>\n<p>\u80cc\u666f\u50cf\u7d20\u975e\u5e38\u591a<br \/>\n        \u2193<br \/>\nBCE \u88ab\u80cc\u666f\u4e3b\u5bfc<br \/>\n        \u2193<br \/>\n\u6a21\u578b\u503e\u5411\u4e8e\u9884\u6d4b\u80cc\u666f<\/p>\n<p>\u800c Dice&#xff1a;<\/p>\n<p>\u76f4\u63a5\u5173\u6ce8\u533a\u57df\u91cd\u53e0<br \/>\n        \u2193<br \/>\n\u964d\u4f4e\u7c7b\u522b\u4e0d\u5e73\u8861\u5f71\u54cd<\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ Dice+CE }\" class=\"mathcode\" src=\"2026-09-03nevo4ybwykl.png\" \/><\/p>\n<p>\u53ef\u4ee5\u540c\u65f6&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5229\u7528 CE \u7684\u50cf\u7d20\u7ea7\u76d1\u7763<\/p>\n<\/li>\n<li>\n<p>\u5229\u7528 Dice \u7684\u533a\u57df\u7ea7\u76d1\u7763<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>64. Loss \u51fd\u6570\u5e94\u8be5\u5982\u4f55\u9009\u62e9&#xff1f;<\/h2>\n<p>\u53ef\u4ee5\u8bb0\u4f4f\u4e0b\u9762\u8fd9\u5f20\u8868\u3002<\/p>\n<table>\n<tr>\u4efb\u52a1\u9996\u9009 Loss<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u666e\u901a\u56de\u5f52<\/td>\n<td style=\"text-align:center\">MSE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5f02\u5e38\u503c\u8f83\u591a\u7684\u56de\u5f52<\/td>\n<td style=\"text-align:center\">MAE \/ Huber<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b<\/td>\n<td style=\"text-align:center\">BCEWithLogits<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u5206\u7c7b<\/td>\n<td style=\"text-align:center\">CrossEntropy<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u6807\u7b7e\u5206\u7c7b<\/td>\n<td style=\"text-align:center\">BCEWithLogits<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u7c7b\u522b\u4e25\u91cd\u4e0d\u5e73\u8861<\/td>\n<td style=\"text-align:center\">Focal \/ Weighted CE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u56fe\u50cf\u5206\u5272<\/td>\n<td style=\"text-align:center\">Dice &#043; CE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u5c0f\u76ee\u6807\u5206\u5272<\/td>\n<td style=\"text-align:center\">Focal &#043; Dice<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u533b\u5b66\u75c5\u7076\u5206\u5272<\/td>\n<td style=\"text-align:center\">Dice \/ Tversky<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u8fb9\u754c\u654f\u611f\u5206\u5272<\/td>\n<td style=\"text-align:center\">Dice &#043; Boundary<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u76ee\u6807\u68c0\u6d4b\u6846\u56de\u5f52<\/td>\n<td style=\"text-align:center\">IoU \/ GIoU \/ DIoU \/ CIoU<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u56fe\u50cf\u68c0\u7d22<\/td>\n<td style=\"text-align:center\">Contrastive \/ Triplet<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u8868\u5f81\u5b66\u4e60<\/td>\n<td style=\"text-align:center\">Contrastive<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6392\u5e8f<\/td>\n<td style=\"text-align:center\">Ranking Loss<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">OCR \/ ASR<\/td>\n<td style=\"text-align:center\">CTC<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">VAE<\/td>\n<td style=\"text-align:center\">Reconstruction &#043; KL<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">GAN<\/td>\n<td style=\"text-align:center\">Adversarial Loss<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Diffusion<\/td>\n<td style=\"text-align:center\">Noise Prediction MSE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u591a\u4efb\u52a1<\/td>\n<td style=\"text-align:center\">Weighted Sum<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>65. \u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u95ee\u9898&#xff1a;Loss \u8d8a\u5c0f&#xff0c;\u6a21\u578b\u4e00\u5b9a\u8d8a\u597d\u5417&#xff1f;<\/h2>\n<p>\u4e0d\u4e00\u5b9a\u3002<\/p>\n<p>\u4f8b\u5982\u8bad\u7ec3&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Loss\\\\downarrow\" class=\"mathcode\" src=\"2026-09-03alvqewocojx.png\" \/><\/p>\n<p>\u4f46\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Validation\\\\ Loss\\\\uparrow\" class=\"mathcode\" src=\"2026-09-033lialcbgft4.png\" \/><\/p>\n<p>\u8bf4\u660e&#xff1a;<\/p>\n<p>\u53ef\u80fd\u53d1\u751f\u8fc7\u62df\u5408\u3002<\/p>\n<p>\u751a\u81f3&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Train\\\\ Dice\\\\uparrow\" class=\"mathcode\" src=\"2026-09-03jt4q53qd1sl.png\" \/><\/p>\n<p>\u4f46&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Validation\\\\ Dice\\\\downarrow\" class=\"mathcode\" src=\"2026-09-03uty5crrpxjk.png\" \/><\/p>\n<p>\u4e5f\u53ef\u80fd\u51fa\u73b0\u3002<\/p>\n<p>\u56e0\u6b64\u4e00\u5b9a\u8981\u533a\u5206&#xff1a;<\/p>\n<p>Training Loss<br \/>\nValidation Loss<br \/>\nEvaluation Metric<\/p>\n<hr \/>\n<h2>66. \u4e3a\u4ec0\u4e48\u4e0d\u80fd\u53ea\u770b Loss&#xff1f;<\/h2>\n<p>\u56e0\u4e3a Loss \u548c\u6700\u7ec8\u4e1a\u52a1\u76ee\u6807\u53ef\u80fd\u4e0d\u540c\u3002\u4f8b\u5982\u533b\u5b66\u5206\u5272&#xff1a;<\/p>\n<p>\u8bad\u7ec3&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=DiceLoss\" class=\"mathcode\" src=\"2026-09-03f4egpe0soaa.png\" \/><\/p>\n<p>\u4f46\u662f\u8bba\u6587\u6700\u7ec8\u62a5\u544a&#xff1a;<\/p>\n<p>Dice<br \/>\nIoU<br \/>\nHD95<br \/>\nPrecision<br \/>\nRecall<br \/>\nSensitivity<br \/>\nSpecificity<\/p>\n<p>\u56e0\u4e3a&#xff1a;<\/p>\n<p>Loss \u662f\u4f18\u5316\u5de5\u5177&#xff0c;Metric \u662f\u8bc4\u4ef7\u5de5\u5177\u3002<\/p>\n<p>\u4e8c\u8005\u6ca1\u6709\u5fc5\u8981\u5b8c\u5168\u4e00\u81f4\u3002<\/p>\n<hr \/>\n<h2>67. Loss \u7684\u68af\u5ea6\u6bd4 Loss \u6570\u503c\u66f4\u52a0\u91cd\u8981<\/h2>\n<p>\u6df1\u5ea6\u5b66\u4e60\u771f\u6b63\u66f4\u65b0\u7684\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\nabla_\\\\theta L\" class=\"mathcode\" src=\"2026-09-03dqtzkiscqb0.png\" \/><\/p>\n<p>\u53c2\u6570\u66f4\u65b0&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\theta \\\\leftarrow \\\\theta - \\\\eta\\\\nabla_\\\\theta L\" class=\"mathcode\" src=\"2026-09-03g00x0pgxact.png\" \/><\/p>\n<p>\u56e0\u6b64\u8bbe\u8ba1 Loss \u65f6\u4e0d\u80fd\u53ea\u770b&#xff1a;<\/p>\n<p>Loss \u6570\u503c\u662f\u5426\u5408\u7406\u3002<\/p>\n<p>\u66f4\u91cd\u8981\u7684\u662f&#xff1a;<\/p>\n<p>\u68af\u5ea6\u662f\u5426\u80fd\u591f\u63d0\u4f9b\u6709\u6548\u7684\u4f18\u5316\u65b9\u5411\u3002<\/p>\n<hr \/>\n<h2>68. \u4e3a\u4ec0\u4e48\u5f88\u591a Loss \u4f1a\u51fa\u73b0\u68af\u5ea6\u6d88\u5931&#xff1f;<\/h2>\n<p>\u4f8b\u5982 Sigmoid&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\sigma(x)=\\\\frac1{1+e^{-x}}\" class=\"mathcode\" src=\"2026-09-03tdjlvg0e4kr.png\" \/><\/p>\n<p>\u5176\u5bfc\u6570&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\sigma&apos;(x) = \\\\sigma(x)(1-\\\\sigma(x))\" class=\"mathcode\" src=\"2026-09-03mx2lmn1so4t.png\" \/><\/p>\n<p>\u5f53&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x\\\\rightarrow+\\\\infty\" class=\"mathcode\" src=\"2026-09-03rjjuq5lpmuy.png\" \/><\/p>\n<p>\u6216\u8005&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"x\\\\rightarrow-\\\\infty\" class=\"mathcode\" src=\"2026-09-03f1jpi0pls5d.png\" \/><\/p>\n<p>\u90fd\u6709&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\sigma&apos;(x)\\\\rightarrow0\" class=\"mathcode\" src=\"2026-09-03m3g4jua5pe1.png\" \/><\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>Sigmoid \u9971\u548c\u4f1a\u5bfc\u81f4\u68af\u5ea6\u53d8\u5c0f\u3002<\/p>\n<p>\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u5b9e\u9645\u4e8c\u5206\u7c7b\u4e2d\u63a8\u8350&#xff1a;<\/p>\n<p>BCEWithLogitsLoss<\/p>\n<p>\u800c\u4e0d\u662f\u624b\u52a8&#xff1a;<\/p>\n<p>Sigmoid &#043; BCELoss<\/p>\n<hr \/>\n<h2>69. Reduction \u662f\u4ec0\u4e48\u610f\u601d&#xff1f;<\/h2>\n<p>PyTorch Loss \u7ecf\u5e38\u6709&#xff1a;<\/p>\n<p>reduction&#061;&#034;mean&#034;<\/p>\n<p>\u6216\u8005&#xff1a;<\/p>\n<p>reduction&#061;&#034;sum&#034;<\/p>\n<p>\u6216\u8005&#xff1a;<\/p>\n<p>reduction&#061;&#034;none&#034;<\/p>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p>loss &#061; [1, 2, 3, 4]<\/p>\n<h4>mean<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=2.5\" class=\"mathcode\" src=\"2026-09-03hbjy5xzguzt.png\" \/><\/p>\n<h4>sum<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=10\" class=\"mathcode\" src=\"2026-09-03b5s4zommnau.png\" \/><\/p>\n<h4>none<\/h4>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"L=[1,2,3,4]\" class=\"mathcode\" src=\"2026-09-03sveh03yantm.png\" \/><\/p>\n<hr \/>\n<h2>70. \u4e3a\u4ec0\u4e48 reduction&#061;&#034;none&#034; \u5f88\u91cd\u8981&#xff1f;<\/h2>\n<p>\u56e0\u4e3a\u5f88\u591a\u9ad8\u7ea7 Loss \u9700\u8981&#xff1a;<\/p>\n<p>\u5148\u8ba1\u7b97\u6bcf\u4e2a\u6837\u672c\u7684 Loss&#xff0c;\u518d\u8fdb\u884c\u52a0\u6743\u3002<\/p>\n<p>\u4f8b\u5982 Focal&#xff1a;<\/p>\n<p>loss &#061; criterion(<br \/>\n    logits,<br \/>\n    target,<br \/>\n    reduction&#061;&#034;none&#034;<br \/>\n)<\/p>\n<p>\u7136\u540e&#xff1a;<\/p>\n<p>loss &#061; weight * loss<\/p>\n<p>\u6700\u540e&#xff1a;<\/p>\n<p>loss &#061; loss.mean()<\/p>\n<p>\u8fd9\u4e5f\u662f\u5b9e\u73b0\u81ea\u5b9a\u4e49 Loss \u7684\u5e38\u89c1\u65b9\u5f0f\u3002<\/p>\n<hr \/>\n<h2>71. PyTorch \u5e38\u89c1 Loss API \u5bf9\u7167<\/h2>\n<p>PyTorch \u5f53\u524d torch.nn \u63d0\u4f9b\u4e86\u5927\u91cf\u6807\u51c6\u635f\u5931&#xff0c;\u5305\u62ec&#xff1a;<\/p>\n<p>L1Loss<br \/>\nMSELoss<br \/>\nSmoothL1Loss<br \/>\nHuberLoss<\/p>\n<p>BCELoss<br \/>\nBCEWithLogitsLoss<\/p>\n<p>CrossEntropyLoss<br \/>\nNLLLoss<\/p>\n<p>KLDivLoss<\/p>\n<p>MarginRankingLoss<br \/>\nHingeEmbeddingLoss<br \/>\nMultiMarginLoss<br \/>\nMultiLabelMarginLoss<\/p>\n<p>CosineEmbeddingLoss<\/p>\n<p>TripletMarginLoss<br \/>\nTripletMarginWithDistanceLoss<\/p>\n<p>CTCLoss<\/p>\n<p>PoissonNLLLoss<br \/>\nGaussianNLLLoss<\/p>\n<p>\u8fd9\u4e9b\u90fd\u53ef\u4ee5\u5728 PyTorch \u5b98\u65b9 API \u4e2d\u627e\u5230\u3002<\/p>\n<hr \/>\n<h2>72. \u4e00\u5f20\u56fe\u7406\u89e3\u6240\u6709 Loss<\/h2>\n<p>\u53ef\u4ee5\u628a Loss \u770b\u6210\u4e0b\u9762\u8fd9\u68f5\u6811&#xff1a;<\/p>\n<p>Loss Function<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Regression<br \/>\n\u2502   \u251c\u2500\u2500 MSE<br \/>\n\u2502   \u251c\u2500\u2500 MAE<br \/>\n\u2502   \u251c\u2500\u2500 Smooth L1<br \/>\n\u2502   \u2514\u2500\u2500 Huber<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Classification<br \/>\n\u2502   \u251c\u2500\u2500 BCE<br \/>\n\u2502   \u251c\u2500\u2500 Cross Entropy<br \/>\n\u2502   \u251c\u2500\u2500 NLL<br \/>\n\u2502   \u251c\u2500\u2500 Hinge<br \/>\n\u2502   \u2514\u2500\u2500 Focal<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Distribution<br \/>\n\u2502   \u2514\u2500\u2500 KL Divergence<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Segmentation<br \/>\n\u2502   \u251c\u2500\u2500 Dice<br \/>\n\u2502   \u251c\u2500\u2500 IoU<br \/>\n\u2502   \u251c\u2500\u2500 Tversky<br \/>\n\u2502   \u251c\u2500\u2500 Focal Tversky<br \/>\n\u2502   \u2514\u2500\u2500 Boundary<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Object Detection<br \/>\n\u2502   \u251c\u2500\u2500 L1<br \/>\n\u2502   \u251c\u2500\u2500 Smooth L1<br \/>\n\u2502   \u251c\u2500\u2500 IoU<br \/>\n\u2502   \u251c\u2500\u2500 GIoU<br \/>\n\u2502   \u251c\u2500\u2500 DIoU<br \/>\n\u2502   \u2514\u2500\u2500 CIoU<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Metric Learning<br \/>\n\u2502   \u251c\u2500\u2500 Contrastive<br \/>\n\u2502   \u251c\u2500\u2500 Triplet<br \/>\n\u2502   \u2514\u2500\u2500 Cosine<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Sequence<br \/>\n\u2502   \u2514\u2500\u2500 CTC<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Generative<br \/>\n\u2502   \u251c\u2500\u2500 VAE<br \/>\n\u2502   \u251c\u2500\u2500 GAN<br \/>\n\u2502   \u2514\u2500\u2500 Diffusion<br \/>\n\u2502<br \/>\n\u2514\u2500\u2500 Regularization<br \/>\n    \u251c\u2500\u2500 L1<br \/>\n    \u251c\u2500\u2500 L2<br \/>\n    \u2514\u2500\u2500 Elastic Net<\/p>\n<hr \/>\n<h2>73. \u6700\u91cd\u8981\u7684 Loss \u5bf9\u6bd4\u8868<\/h2>\n<table>\n<tr>Loss\u6838\u5fc3\u601d\u60f3\u6700\u9002\u5408<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">MSE<\/td>\n<td style=\"text-align:center\">\u60e9\u7f5a\u5e73\u65b9\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u56de\u5f52<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">MAE<\/td>\n<td style=\"text-align:center\">\u60e9\u7f5a\u7edd\u5bf9\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u9c81\u68d2\u56de\u5f52<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Huber<\/td>\n<td style=\"text-align:center\">\u5c0f\u8bef\u5dee MSE&#xff0c;\u5927\u8bef\u5dee MAE<\/td>\n<td style=\"text-align:center\">\u9c81\u68d2\u56de\u5f52<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">BCE<\/td>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b\u6982\u7387\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u4e8c\u5206\u7c7b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">CE<\/td>\n<td style=\"text-align:center\">\u591a\u7c7b\u522b\u6982\u7387\u8bef\u5dee<\/td>\n<td style=\"text-align:center\">\u591a\u5206\u7c7b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Focal<\/td>\n<td style=\"text-align:center\">\u5173\u6ce8\u56f0\u96be\u6837\u672c<\/td>\n<td style=\"text-align:center\">\u7c7b\u522b\u4e0d\u5e73\u8861<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">KL<\/td>\n<td style=\"text-align:center\">\u5206\u5e03\u4e4b\u95f4\u7684\u5dee\u5f02<\/td>\n<td style=\"text-align:center\">\u84b8\u998f\/VAE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Dice<\/td>\n<td style=\"text-align:center\">\u533a\u57df\u91cd\u53e0<\/td>\n<td style=\"text-align:center\">\u5206\u5272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">IoU<\/td>\n<td style=\"text-align:center\">\u533a\u57df\u4ea4\u5e76\u6bd4<\/td>\n<td style=\"text-align:center\">\u5206\u5272\/\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Tversky<\/td>\n<td style=\"text-align:center\">\u5206\u522b\u63a7\u5236 FP\/FN<\/td>\n<td style=\"text-align:center\">\u533b\u5b66\u5206\u5272<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">GIoU<\/td>\n<td style=\"text-align:center\">\u89e3\u51b3\u65e0\u91cd\u53e0\u6846<\/td>\n<td style=\"text-align:center\">\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">DIoU<\/td>\n<td style=\"text-align:center\">\u52a0\u5165\u4e2d\u5fc3\u8ddd\u79bb<\/td>\n<td style=\"text-align:center\">\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">CIoU<\/td>\n<td style=\"text-align:center\">\u52a0\u5165\u5bbd\u9ad8\u6bd4<\/td>\n<td style=\"text-align:center\">\u68c0\u6d4b<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Contrastive<\/td>\n<td style=\"text-align:center\">\u6b63\u6837\u672c\u8fd1\u3001\u8d1f\u6837\u672c\u8fdc<\/td>\n<td style=\"text-align:center\">\u5bf9\u6bd4\u5b66\u4e60<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Triplet<\/td>\n<td style=\"text-align:center\">\u76f8\u5bf9\u8ddd\u79bb\u6392\u5e8f<\/td>\n<td style=\"text-align:center\">\u5ea6\u91cf\u5b66\u4e60<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">CTC<\/td>\n<td style=\"text-align:center\">\u65e0\u9700\u663e\u5f0f\u5bf9\u9f50<\/td>\n<td style=\"text-align:center\">OCR\/ASR<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">VAE Loss<\/td>\n<td style=\"text-align:center\">\u91cd\u6784 &#043; \u5206\u5e03\u7ea6\u675f<\/td>\n<td style=\"text-align:center\">VAE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">GAN Loss<\/td>\n<td style=\"text-align:center\">\u5bf9\u6297\u8bad\u7ec3<\/td>\n<td style=\"text-align:center\">GAN<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Diffusion MSE<\/td>\n<td style=\"text-align:center\">\u9884\u6d4b\u566a\u58f0<\/td>\n<td style=\"text-align:center\">Diffusion<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>74. \u6700\u540e&#xff1a;\u5982\u4f55\u771f\u6b63\u7406\u89e3 Loss&#xff1f;<\/h2>\n<p>\u4e0d\u8981\u6b7b\u8bb0\u516c\u5f0f\u3002<\/p>\n<p>\u5efa\u8bae\u6309\u7167\u4e0b\u9762\u56db\u4e2a\u95ee\u9898\u7406\u89e3\u4efb\u4f55\u4e00\u4e2a Loss\u3002<\/p>\n<h3>\u7b2c\u4e00\u95ee&#xff1a;\u5b83\u5728\u6bd4\u8f83\u4ec0\u4e48&#xff1f;<\/h3>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>MSE&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"y-\\\\hat y\" class=\"mathcode\" src=\"2026-09-03vl2h13xmzy3.png\" \/><\/p>\n<p>Dice&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Prediction \\\\cap GroundTruth\" class=\"mathcode\" src=\"2026-09-030zmm2cepjqt.png\" \/><\/p>\n<p>KL&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"P\\\\ vs.\\\\ Q\" class=\"mathcode\" src=\"2026-09-03fupzgrmhs1y.png\" \/><\/p>\n<p>Triplet&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"d(a,p)\\\\ vs.\\\\ d(a,n)\" class=\"mathcode\" src=\"2026-09-03i30mwn3nu1v.png\" \/><\/p>\n<hr \/>\n<h3>\u7b2c\u4e8c\u95ee&#xff1a;\u5b83\u5728\u60e9\u7f5a\u4ec0\u4e48&#xff1f;<\/h3>\n<p>MSE&#xff1a;<\/p>\n<p>\u5927\u8bef\u5dee\u3002<\/p>\n<p>Focal&#xff1a;<\/p>\n<p>\u56f0\u96be\u6837\u672c\u3002<\/p>\n<p>Dice&#xff1a;<\/p>\n<p>\u533a\u57df\u4e0d\u91cd\u53e0\u3002<\/p>\n<p>Tversky&#xff1a;<\/p>\n<p>FP\/FN\u3002<\/p>\n<p>CIoU&#xff1a;<\/p>\n<p>\u6846\u7684\u4f4d\u7f6e\u3001\u91cd\u53e0\u548c\u5f62\u72b6\u3002<\/p>\n<hr \/>\n<h3>\u7b2c\u4e09\u95ee&#xff1a;\u5b83\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898&#xff1f;<\/h3>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>MSE<br \/>\n\u2193<br \/>\n\u57fa\u7840\u56de\u5f52<\/p>\n<p>Huber<br \/>\n\u2193<br \/>\nMSE \u5bf9\u5f02\u5e38\u503c\u654f\u611f<br \/>\n\u2193<br \/>\n\u9c81\u68d2\u56de\u5f52<\/p>\n<p>Focal<br \/>\n\u2193<br \/>\nCE \u88ab\u5927\u91cf\u7b80\u5355\u6837\u672c\u652f\u914d<br \/>\n\u2193<br \/>\n\u56f0\u96be\u6837\u672c\u5b66\u4e60<\/p>\n<p>Dice<br \/>\n\u2193<br \/>\nCE\/BCE \u88ab\u80cc\u666f\u652f\u914d<br \/>\n\u2193<br \/>\n\u7c7b\u522b\u4e0d\u5e73\u8861\u5206\u5272<\/p>\n<p>Tversky<br \/>\n\u2193<br \/>\nFP\/FN \u60e9\u7f5a\u4e0d\u5bf9\u79f0<br \/>\n\u2193<br \/>\n\u533b\u5b66\u5206\u5272<\/p>\n<p>CIoU<br \/>\n\u2193<br \/>\nIoU \u65e0\u6cd5\u63cf\u8ff0\u4e2d\u5fc3\u8ddd\u79bb\u548c\u5bbd\u9ad8\u6bd4<br \/>\n\u2193<br \/>\n\u66f4\u597d\u7684 Bounding Box Regression<\/p>\n<hr \/>\n<h2>75. \u4e00\u53e5\u8bdd\u8bb0\u4f4f\u6574\u4e2a Loss \u4f53\u7cfb<\/h2>\n<p>\u53ef\u4ee5\u628a\u6df1\u5ea6\u5b66\u4e60 Loss \u7684\u6f14\u5316\u7406\u89e3\u6210&#xff1a;<\/p>\n<p style=\"text-align:center\">\u8bef\u5dee\u2192\u6982\u7387\u2192\u7c7b\u522b\u2192\u96be\u6837\u672c\u2192\u533a\u57df\u2192\u8fb9\u754c\u2192\u8ddd\u79bb\u2192\u5206\u5e03\u2192\u591a\u4efb\u52a1<\/p>\n<p>\u6700\u57fa\u7840\u7684\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"MSE,\\\\ MAE\" class=\"mathcode\" src=\"2026-09-03hbvcotzegi3.png\" \/><\/p>\n<p>\u5206\u7c7b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"BCE,\\\\ CE\" class=\"mathcode\" src=\"2026-09-03f5lezplayij.png\" \/><\/p>\n<p>\u4e0d\u5e73\u8861&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Focal\" class=\"mathcode\" src=\"2026-09-031jgbxq1zg30.png\" \/><\/p>\n<p>\u5206\u5272&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Dice,\\\\ IoU,\\\\ Tversky\" class=\"mathcode\" src=\"2026-09-03xgjqdo0sm0b.png\" \/><\/p>\n<p>\u68c0\u6d4b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"IoU,\\\\ GIoU,\\\\ DIoU,\\\\ CIoU\" class=\"mathcode\" src=\"2026-09-03ueglmvsd0os.png\" \/><\/p>\n<p>\u8868\u5f81\u5b66\u4e60&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"Contrastive,\\\\ Triplet\" class=\"mathcode\" src=\"2026-09-034vhh42lm0lo.png\" \/><\/p>\n<p>\u5206\u5e03\u5b66\u4e60&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"KL\" class=\"mathcode\" src=\"2026-09-03rnby1xvpt2g.png\" \/><\/p>\n<p>\u751f\u6210\u6a21\u578b&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"VAE,\\\\ GAN,\\\\ Diffusion\" class=\"mathcode\" src=\"2026-09-03i3ttzucrpai.png\" \/><\/p>\n<p>\u6700\u7ec8\u590d\u6742\u6a21\u578b\u5f80\u5f80\u4e0d\u662f\u4f7f\u7528\u5355\u4e00 Loss&#xff0c;\u800c\u662f&#xff1a;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\\\\boxed{ L_{total} = \\\\sum_i \\\\lambda_iL_i }\" class=\"mathcode\" src=\"2026-09-03ny1gdhl5avz.png\" \/><\/p>\n<p>\u56e0\u6b64\u771f\u6b63\u7684 Loss \u8bbe\u8ba1&#xff0c;\u672c\u8d28\u4e0a\u662f\u5728\u56de\u7b54&#xff1a;<\/p>\n<p>\u201c\u6211\u5e0c\u671b\u6a21\u578b\u5177\u6709\u4ec0\u4e48\u6837\u7684\u884c\u4e3a&#xff1f;\u201d<\/p>\n<p>\u5982\u679c\u5e0c\u671b\u6a21\u578b\u9884\u6d4b\u6570\u503c\u51c6\u786e&#xff0c;\u5c31\u4f7f\u7528\u56de\u5f52 Loss&#xff1b;\u5982\u679c\u5e0c\u671b\u5206\u7c7b\u6982\u7387\u51c6\u786e&#xff0c;\u5c31\u4f7f\u7528 Cross Entropy&#xff1b;\u5982\u679c\u5e0c\u671b\u5173\u6ce8\u56f0\u96be\u6837\u672c&#xff0c;\u5c31\u4f7f\u7528 Focal&#xff1b;\u5982\u679c\u5e0c\u671b\u9884\u6d4b\u533a\u57df\u91cd\u53e0&#xff0c;\u5c31\u4f7f\u7528 Dice\/IoU&#xff1b;\u5982\u679c\u5e0c\u671b\u5b66\u4e60\u8868\u793a\u4e4b\u95f4\u7684\u76f8\u4f3c\u5173\u7cfb&#xff0c;\u5c31\u4f7f\u7528 Contrastive\/Triplet&#xff1b;\u5982\u679c\u540c\u65f6\u5b58\u5728\u591a\u4e2a\u76ee\u6807&#xff0c;\u5c31\u7ec4\u5408\u591a\u4e2a Loss\u3002<\/p>\n<p>\u8fd9\u4e5f\u662f\u6df1\u5ea6\u5b66\u4e60\u4e2d\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u601d\u60f3&#xff1a;<\/p>\n<p>Loss\u00a0Function \u2248 \u6211\u4eec\u5bf9\u201c\u4ec0\u4e48\u53eb\u505a\u9884\u6d4b\u5f97\u597d\u201d\u7684\u6570\u5b66\u5b9a\u4e49<\/p>\n<hr \/>\n<p>\u53c2\u8003\u8d44\u6599<\/p>\n<ul>\n<li>\n<p>PyTorch torch.nn Loss \u5b98\u65b9\u6587\u6863&#xff1a;\u5305\u542b L1\u3001MSE\u3001BCE\u3001CrossEntropy\u3001KL\u3001CTC\u3001Triplet \u7b49\u6807\u51c6\u5b9e\u73b0\u3002<\/p>\n<\/li>\n<li>\n<p>PyTorch CrossEntropyLoss&#xff1a;\u8be6\u7ec6\u8bf4\u660e logits\u3001class index\u3001class probability\u3001weight\u3001ignore_index \u548c label_smoothing \u7b49\u673a\u5236\u3002<\/p>\n<\/li>\n<li>\n<p>PyTorch BCEWithLogitsLoss&#xff1a;Sigmoid \u4e0e BCE \u7684\u6570\u503c\u7a33\u5b9a\u5b9e\u73b0&#xff0c;\u5e76\u652f\u6301 pos_weight \u5904\u7406\u6b63\u8d1f\u6837\u672c\u4e0d\u5e73\u8861\u3002<\/p>\n<\/li>\n<li>\n<p>PyTorch TripletMarginLoss&#xff1a;Anchor\u3001Positive\u3001Negative \u4e09\u5143\u7ec4\u53ca margin-based \u8ddd\u79bb\u4f18\u5316\u3002<\/p>\n<\/li>\n<li>\n<p>scikit-learn Hinge Loss \u6587\u6863&#xff1a;\u4ecb\u7ecd\u4e8c\u5206\u7c7b\u548c\u591a\u5206\u7c7b Hinge Loss\u3002<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7cfb\u7edf\u603b\u7ed3\u6df1\u5ea6\u5b66\u4e60\u4e2d\u5e38\u89c1\u7684\u635f\u5931\u51fd\u6570&#xff0c;\u4ece\u6700\u57fa\u7840\u7684 MSE\u3001MAE\u3001\u4ea4\u53c9\u71b5&#xff0c;\u5230\u5206\u7c7b\u4e2d\u7684 BCE\u3001Focal Loss&#xff0c;\u76ee\u6807\u68c0\u6d4b\u4e2d\u7684 IoU \/\u00a0GIoU \/ DIoU \/ CIoU&#xff0c;\u8bed\u4e49\u5206\u5272\u4e2d\u7684 Dice Loss\u3001Tversky Loss&#xff0c;\u518d\u5230\u5bf9\u6bd4\u5b66\u4e60\u4e2d\u7684 Contrastive Loss\u3001Triplet Loss&#xff0c;\u4ee5\u53ca KL Divergence\u3001CTC\u3001GAN\u3001\u6269\u6563\u6a21\u578b\u4e2d\u7684\u635f\u5931\u51fd\u6570\u3002\u672c\u6587\u91cd<\/p>\n","protected":false},"author":2,"featured_media":99964,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50,86],"topic":[],"class_list":["post-99984","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-50","tag-86"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/99984.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u7cfb\u7edf\u603b\u7ed3\u6df1\u5ea6\u5b66\u4e60\u4e2d\u5e38\u89c1\u7684\u635f\u5931\u51fd\u6570&#xff0c;\u4ece\u6700\u57fa\u7840\u7684 MSE\u3001MAE\u3001\u4ea4\u53c9\u71b5&#xff0c;\u5230\u5206\u7c7b\u4e2d\u7684 BCE\u3001Focal Loss&#xff0c;\u76ee\u6807\u68c0\u6d4b\u4e2d\u7684 IoU \/\u00a0GIoU \/ DIoU \/ CIoU&#xff0c;\u8bed\u4e49\u5206\u5272\u4e2d\u7684 Dice Loss\u3001Tversky Loss&#xff0c;\u518d\u5230\u5bf9\u6bd4\u5b66\u4e60\u4e2d\u7684 Contrastive Loss\u3001Triplet Loss&#xff0c;\u4ee5\u53ca KL Divergence\u3001CTC\u3001GAN\u3001\u6269\u6563\u6a21\u578b\u4e2d\u7684\u635f\u5931\u51fd\u6570\u3002\u672c\u6587\u91cd\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/99984.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-03T09:03:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f68c845.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/99984.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/99984.html\",\"name\":\"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-03T09:03:52+00:00\",\"dateModified\":\"2026-09-03T09:03:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/99984.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/99984.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/99984.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/99984.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u7cfb\u7edf\u603b\u7ed3\u6df1\u5ea6\u5b66\u4e60\u4e2d\u5e38\u89c1\u7684\u635f\u5931\u51fd\u6570&#xff0c;\u4ece\u6700\u57fa\u7840\u7684 MSE\u3001MAE\u3001\u4ea4\u53c9\u71b5&#xff0c;\u5230\u5206\u7c7b\u4e2d\u7684 BCE\u3001Focal Loss&#xff0c;\u76ee\u6807\u68c0\u6d4b\u4e2d\u7684 IoU \/\u00a0GIoU \/ DIoU \/ CIoU&#xff0c;\u8bed\u4e49\u5206\u5272\u4e2d\u7684 Dice Loss\u3001Tversky Loss&#xff0c;\u518d\u5230\u5bf9\u6bd4\u5b66\u4e60\u4e2d\u7684 Contrastive Loss\u3001Triplet Loss&#xff0c;\u4ee5\u53ca KL Divergence\u3001CTC\u3001GAN\u3001\u6269\u6563\u6a21\u578b\u4e2d\u7684\u635f\u5931\u51fd\u6570\u3002\u672c\u6587\u91cd","og_url":"https:\/\/www.wsisp.com\/helps\/99984.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-03T09:03:52+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260903090350-6a9937f68c845.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/99984.html","url":"https:\/\/www.wsisp.com\/helps\/99984.html","name":"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-03T09:03:52+00:00","dateModified":"2026-09-03T09:03:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/99984.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/99984.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/99984.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5ea6\u5b66\u4e60\u635f\u5931\u51fd\u6570\u8be6\u89e3\uff1a\u4ece MSE\u3001Cross Entropy \u5230 Dice\u3001Focal\u3001IoU\u3001Contrastive Loss\uff0c\u4e00\u6587\u638c\u63e1\u6240\u6709\u5e38\u89c1 Loss"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/99984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=99984"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/99984\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/99964"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=99984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=99984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=99984"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=99984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}