{"id":75274,"date":"2026-02-11T21:58:52","date_gmt":"2026-02-11T13:58:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/75274.html"},"modified":"2026-02-11T21:58:52","modified_gmt":"2026-02-11T13:58:52","slug":"%e3%80%90%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e6%95%99%e7%a8%8b-05_%e7%94%9f%e6%88%90%e6%a8%a1%e5%9e%8bgenerative%e3%80%9123_vae%e5%a6%82%e4%bd%95%e5%9c%a8%e6%bd%9c%e7%a9%ba","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/75274.html","title":{"rendered":"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2"},"content":{"rendered":"<h2>23_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c&#xff1f;\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2<\/h2>\n<p>\u672c\u7ae0\u76ee\u6807&#xff1a;\u89e3\u51b3 Autoencoder \u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed\u7684\u95ee\u9898\u3002\u5f15\u5165 VAE (Variational Autoencoder)&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u5b66\u4e60&#034;\u5206\u5e03&#034;\u800c\u4e0d\u662f&#034;\u70b9&#034;&#xff0c;\u4ece\u800c\u80fd\u591f\u751f\u6210\u5e73\u6ed1\u53d8\u5316\u7684\u56fe\u50cf\u3002<\/p>\n<hr \/>\n<h3>\u76ee\u5f55<\/h3>\n<li>Autoencoder \u7684\u7f3a\u9677&#xff1a;\u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed<\/li>\n<li>VAE \u7684\u6838\u5fc3\u601d\u60f3&#xff1a;\u5b66\u4e60\u5206\u5e03<\/li>\n<li>\u91cd\u53c2\u6570\u5316\u6280\u5de7 (Re-parameterization Trick)<\/li>\n<li>KL \u6563\u5ea6&#xff1a;\u9632\u6b62\u65b9\u5dee\u4e3a 0<\/li>\n<li>\u5b9e\u6218&#xff1a;PyTorch \u5b9e\u73b0 VAE \u751f\u6210\u624b\u5199\u6570\u5b57<\/li>\n<hr \/>\n<h3>1. Autoencoder \u7684\u7f3a\u9677&#xff1a;\u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed<\/h3>\n<p>\u666e\u901a\u7684 Autoencoder \u628a\u6bcf\u5f20\u56fe\u538b\u7f29\u6210\u8fd9\u91cc\u7684\u4e00\u4e2a\u70b9\u3002<\/p>\n<ul>\n<li>\u70b9 A \u662f&#034;\u6708\u4eae&#034;&#xff0c;\u70b9 B \u662f&#034;\u534a\u6708&#034;\u3002<\/li>\n<li>\u4f46\u5982\u679c\u4f60\u53d6 A \u548c B \u7684\u4e2d\u70b9 C&#xff0c;\u89e3\u7801\u51fa\u6765\u53ef\u80fd\u662f\u4e00\u56e2\u4e71\u7801\u3002\u56e0\u4e3a\u7f51\u7edc\u6ca1\u89c1\u8fc7\u4e2d\u95f4\u72b6\u6001\u3002<\/li>\n<\/ul>\n<p>\u6211\u4eec\u5e0c\u671b\u6f5c\u7a7a\u95f4\u662f\u8fde\u7eed\u7684&#xff1a;\u4ece\u4e2d\u70b9\u91c7\u6837&#xff0c;\u5e94\u8be5\u80fd\u751f\u6210\u4ecb\u4e8e\u6708\u4eae\u548c\u534a\u6708\u4e4b\u95f4\u7684\u56fe\u3002<\/p>\n<hr \/>\n<h3>2. VAE \u7684\u6838\u5fc3\u601d\u60f3&#xff1a;\u5b66\u4e60\u5206\u5e03<\/h3>\n<p>VAE \u4e0d\u518d\u8ba9 Encoder \u8f93\u51fa\u4e00\u4e2a\u56fa\u5b9a\u7684 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        z<\/p>\n<p>       z<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.044em\">z<\/span><\/span><\/span><\/span><\/span>&#xff0c;\u800c\u662f\u8f93\u51fa\u4e00\u4e2a\u9ad8\u65af\u5206\u5e03 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        N<\/p>\n<p>        (<\/p>\n<p>        \u03bc<\/p>\n<p>        ,<\/p>\n<p>         \u03c3<\/p>\n<p>         2<\/p>\n<p>        )<\/p>\n<p>       N(\\\\mu, \\\\sigma^2)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1.0641em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">\u03bc<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8141em\"><span class=\"\" style=\"top: -3.063em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002<\/p>\n<ul>\n<li><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">\n<p>         \u03bc<\/p>\n<p>        \\\\mu<\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.625em;vertical-align: -0.1944em\"><\/span><span class=\"mord mathnormal\">\u03bc<\/span><\/span><\/span><\/span><\/span>&#xff1a;\u5747\u503c&#xff08;\u5927\u6982\u5728\u54ea\u91cc&#xff09;\u3002<\/li>\n<li><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\">\n<p>         \u03c3<\/p>\n<p>        \\\\sigma<\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><\/span><\/span><\/span><\/span>&#xff1a;\u65b9\u5dee&#xff08;\u4e0d\u786e\u5b9a\u6027\u6709\u591a\u5927&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u7136\u540e\u6211\u4eec\u4ece\u8fd9\u4e2a\u5206\u5e03\u91cc\u968f\u673a\u91c7\u6837\u4e00\u4e2a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        z<\/p>\n<p>       z<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.044em\">z<\/span><\/span><\/span><\/span><\/span>&#xff0c;\u6254\u7ed9 Decoder\u3002 \u8fd9\u5c31\u8feb\u4f7f Decoder \u5fc5\u987b\u5bf9 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        \u03bc<\/p>\n<p>       \\\\mu<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.625em;vertical-align: -0.1944em\"><\/span><span class=\"mord mathnormal\">\u03bc<\/span><\/span><\/span><\/span><\/span> \u9644\u8fd1\u7684\u566a\u70b9\u5177\u6709\u9c81\u68d2\u6027&#xff0c;\u4ece\u800c\u586b\u8865\u4e86\u6f5c\u7a7a\u95f4\u7684\u7a7a\u9699\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260211135850-698c8b1a8f9ba.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h3>3. \u91cd\u53c2\u6570\u5316\u6280\u5de7 (Re-parameterization Trick)<\/h3>\n<p>\u95ee\u9898\u6765\u4e86&#xff1a;&#034;\u968f\u673a\u91c7\u6837&#034;\u8fd9\u4e2a\u64cd\u4f5c\u662f\u4e0d\u53ef\u5bfc\u7684&#xff01; \u53cd\u5411\u4f20\u64ad\u4f1a\u5728\u8fd9\u91cc\u65ad\u6389\u3002<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5&#xff1a;\u628a\u968f\u673a\u6027\u5265\u79bb\u51fa\u6765\u3002 \u6211\u4eec\u9700\u8981\u91c7\u6837 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        z<\/p>\n<p>        \u223c<\/p>\n<p>        N<\/p>\n<p>        (<\/p>\n<p>        \u03bc<\/p>\n<p>        ,<\/p>\n<p>         \u03c3<\/p>\n<p>         2<\/p>\n<p>        )<\/p>\n<p>       z \\\\sim N(\\\\mu, \\\\sigma^2)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.044em\">z<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">\u223c<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.0641em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">\u03bc<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8141em\"><span class=\"\" style=\"top: -3.063em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002 \u6211\u4eec\u53ef\u4ee5\u5148\u91c7\u6837\u4e00\u4e2a\u6807\u51c6\u6b63\u6001\u5206\u5e03 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        \u03f5<\/p>\n<p>        \u223c<\/p>\n<p>        N<\/p>\n<p>        (<\/p>\n<p>        0<\/p>\n<p>        ,<\/p>\n<p>        1<\/p>\n<p>        )<\/p>\n<p>       \\\\epsilon \\\\sim N(0, 1)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\">\u03f5<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">\u223c<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord\">0<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\">1<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002 \u7136\u540e\u4ee4&#xff1a; <span class=\"katex--display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>         z<\/p>\n<p>         &#061;<\/p>\n<p>         \u03bc<\/p>\n<p>         &#043;<\/p>\n<p>         \u03f5<\/p>\n<p>         \u22c5<\/p>\n<p>         \u03c3<\/p>\n<p>         z &#061; \\\\mu &#043; \\\\epsilon \\\\cdot \\\\sigma <\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.044em\">z<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">&#061;<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.7778em;vertical-align: -0.1944em\"><\/span><span class=\"mord mathnormal\">\u03bc<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">&#043;<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.4445em\"><\/span><span class=\"mord mathnormal\">\u03f5<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u22c5<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>\u8fd9\u6837&#xff0c;\u5bf9\u4e8e <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        \u03bc<\/p>\n<p>       \\\\mu<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.625em;vertical-align: -0.1944em\"><\/span><span class=\"mord mathnormal\">\u03bc<\/span><\/span><\/span><\/span><\/span> \u548c <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        \u03c3<\/p>\n<p>       \\\\sigma<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><\/span><\/span><\/span><\/span> \u6765\u8bf4&#xff0c;\u64cd\u4f5c\u53d8\u6210\u4e86\u52a0\u6cd5\u548c\u4e58\u6cd5&#xff0c;\u5b8c\u7f8e\u53ef\u5bfc&#xff01;<\/p>\n<hr \/>\n<h3>4. KL \u6563\u5ea6&#xff1a;\u9632\u6b62\u65b9\u5dee\u4e3a 0<\/h3>\n<p>\u5982\u679c\u53ea\u7528\u91cd\u5efa\u635f\u5931&#xff0c;\u6a21\u578b\u4f1a\u503e\u5411\u4e8e\u628a <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        \u03c3<\/p>\n<p>       \\\\sigma<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.4306em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><\/span><\/span><\/span><\/span> \u53d8\u6210 0&#xff0c;\u9000\u5316\u6210\u666e\u901a\u7684 Autoencoder\u3002 \u6211\u4eec\u9700\u8981\u52a0\u4e00\u4e2a\u6b63\u5219\u9879&#xff1a;\u8feb\u4f7f\u5b66\u5230\u7684\u5206\u5e03\u63a5\u8fd1\u6807\u51c6\u6b63\u6001\u5206\u5e03 <span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>         N<\/p>\n<p>         (<\/p>\n<p>         0<\/p>\n<p>         ,<\/p>\n<p>         1<\/p>\n<p>         )<\/p>\n<p>        N(0, 1)<\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord\">0<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\">1<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002<\/p>\n<p>\u8861\u91cf\u4e24\u4e2a\u5206\u5e03\u5dee\u5f02\u7684\u6307\u6807\u53eb KL \u6563\u5ea6 (Kullback-Leibler Divergence)\u3002 <span class=\"katex--display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>         L<\/p>\n<p>         o<\/p>\n<p>         s<\/p>\n<p>         s<\/p>\n<p>         &#061;<\/p>\n<p>         L<\/p>\n<p>         o<\/p>\n<p>         s<\/p>\n<p>          s<\/p>\n<p>           r<\/p>\n<p>           e<\/p>\n<p>           c<\/p>\n<p>           o<\/p>\n<p>           n<\/p>\n<p>         &#043;<\/p>\n<p>         \u03b2<\/p>\n<p>         \u22c5<\/p>\n<p>          D<\/p>\n<p>           K<\/p>\n<p>           L<\/p>\n<p>         (<\/p>\n<p>         N<\/p>\n<p>         (<\/p>\n<p>         \u03bc<\/p>\n<p>         ,<\/p>\n<p>          \u03c3<\/p>\n<p>          2<\/p>\n<p>         )<\/p>\n<p>         \u2223<\/p>\n<p>         \u2223<\/p>\n<p>         N<\/p>\n<p>         (<\/p>\n<p>         0<\/p>\n<p>         ,<\/p>\n<p>         1<\/p>\n<p>         )<\/p>\n<p>         )<\/p>\n<p>         Loss &#061; Loss_{recon} &#043; \\\\beta \\\\cdot D_{KL}(N(\\\\mu, \\\\sigma^2) || N(0, 1)) <\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">L<\/span><span class=\"mord mathnormal\">oss<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">&#061;<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.8333em;vertical-align: -0.15em\"><\/span><span class=\"mord mathnormal\">L<\/span><span class=\"mord mathnormal\">os<\/span><span class=\"mord\"><span class=\"mord mathnormal\">s<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.1514em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">reco<\/span><span class=\"mord mathnormal mtight\">n<\/span><\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">&#043;<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.8889em;vertical-align: -0.1944em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0528em\">\u03b2<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u22c5<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.1141em;vertical-align: -0.25em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">D<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.3283em\"><span class=\"\" style=\"top: -2.55em;margin-left: -0.0278em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right: 0.0715em\">K<\/span><span class=\"mord mathnormal mtight\">L<\/span><\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">\u03bc<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8641em\"><span class=\"\" style=\"top: -3.113em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><span class=\"mord\">\u2223\u2223<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.109em\">N<\/span><span class=\"mopen\">(<\/span><span class=\"mord\">0<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\">1<\/span><span class=\"mclose\">))<\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>\u516c\u5f0f\u5316\u7b80\u540e&#xff1a; <span class=\"katex--display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>          D<\/p>\n<p>           K<\/p>\n<p>           L<\/p>\n<p>         &#061;<\/p>\n<p>         \u2212<\/p>\n<p>         0.5<\/p>\n<p>         \u22c5<\/p>\n<p>         \u2211<\/p>\n<p>         (<\/p>\n<p>         1<\/p>\n<p>         &#043;<\/p>\n<p>         ln<\/p>\n<p>         \u2061<\/p>\n<p>         (<\/p>\n<p>          \u03c3<\/p>\n<p>          2<\/p>\n<p>         )<\/p>\n<p>         \u2212<\/p>\n<p>          \u03bc<\/p>\n<p>          2<\/p>\n<p>         \u2212<\/p>\n<p>          \u03c3<\/p>\n<p>          2<\/p>\n<p>         )<\/p>\n<p>         D_{KL} &#061; -0.5 \\\\cdot \\\\sum (1 &#043; \\\\ln(\\\\sigma^2) &#8211; \\\\mu^2 &#8211; \\\\sigma^2) <\/p>\n<p>     <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.8333em;vertical-align: -0.15em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0278em\">D<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.3283em\"><span class=\"\" style=\"top: -2.55em;margin-left: -0.0278em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right: 0.0715em\">K<\/span><span class=\"mord mathnormal mtight\">L<\/span><\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><span class=\"mrel\">&#061;<\/span><span class=\"mspace\" style=\"margin-right: 0.2778em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 0.7278em;vertical-align: -0.0833em\"><\/span><span class=\"mord\">\u2212<\/span><span class=\"mord\">0.5<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u22c5<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.6em;vertical-align: -0.55em\"><\/span><span class=\"mop op-symbol large-op\" style=\"position: relative;top: 0em\">\u2211<\/span><span class=\"mopen\">(<\/span><span class=\"mord\">1<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">&#043;<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.1141em;vertical-align: -0.25em\"><\/span><span class=\"mop\">ln<\/span><span class=\"mopen\">(<\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8641em\"><span class=\"\" style=\"top: -3.113em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u2212<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.0585em;vertical-align: -0.1944em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\">\u03bc<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8641em\"><span class=\"\" style=\"top: -3.113em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><span class=\"mbin\">\u2212<\/span><span class=\"mspace\" style=\"margin-right: 0.2222em\"><\/span><\/span><span class=\"base\"><span class=\"strut\" style=\"height: 1.1141em;vertical-align: -0.25em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right: 0.0359em\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.8641em\"><span class=\"\" style=\"top: -3.113em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<hr \/>\n<h3>5. \u5b9e\u6218&#xff1a;PyTorch \u5b9e\u73b0 VAE \u751f\u6210\u624b\u5199\u6570\u5b57<\/h3>\n<p><span class=\"token keyword\">import<\/span> torch<br \/>\n<span class=\"token keyword\">import<\/span> torch<span class=\"token punctuation\">.<\/span>nn <span class=\"token keyword\">as<\/span> nn<br \/>\n<span class=\"token keyword\">import<\/span> torch<span class=\"token punctuation\">.<\/span>nn<span class=\"token punctuation\">.<\/span>functional <span class=\"token keyword\">as<\/span> F<\/p>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">VAE<\/span><span class=\"token punctuation\">(<\/span>nn<span class=\"token punctuation\">.<\/span>Module<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">__init__<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token builtin\">super<\/span><span class=\"token punctuation\">(<\/span>VAE<span class=\"token punctuation\">,<\/span> self<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>__init__<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token comment\"># Encoder<\/span><br \/>\n        self<span class=\"token punctuation\">.<\/span>fc1 <span class=\"token operator\">&#061;<\/span> nn<span class=\"token punctuation\">.<\/span>Linear<span class=\"token punctuation\">(<\/span><span class=\"token number\">784<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">400<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        self<span class=\"token punctuation\">.<\/span>fc21 <span class=\"token operator\">&#061;<\/span> nn<span class=\"token punctuation\">.<\/span>Linear<span class=\"token punctuation\">(<\/span><span class=\"token number\">400<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">20<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># mu<\/span><br \/>\n        self<span class=\"token punctuation\">.<\/span>fc22 <span class=\"token operator\">&#061;<\/span> nn<span class=\"token punctuation\">.<\/span>Linear<span class=\"token punctuation\">(<\/span><span class=\"token number\">400<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">20<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># logvar (\u9884\u6d4blogvar\u66f4\u6570\u503c\u7a33\u5b9a)<\/span><\/p>\n<p>        <span class=\"token comment\"># Decoder<\/span><br \/>\n        self<span class=\"token punctuation\">.<\/span>fc3 <span class=\"token operator\">&#061;<\/span> nn<span class=\"token punctuation\">.<\/span>Linear<span class=\"token punctuation\">(<\/span><span class=\"token number\">20<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">400<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        self<span class=\"token punctuation\">.<\/span>fc4 <span class=\"token operator\">&#061;<\/span> nn<span class=\"token punctuation\">.<\/span>Linear<span class=\"token punctuation\">(<\/span><span class=\"token number\">400<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">784<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">def<\/span> <span class=\"token function\">encode<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> x<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        h1 <span class=\"token operator\">&#061;<\/span> F<span class=\"token punctuation\">.<\/span>relu<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">.<\/span>fc1<span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> self<span class=\"token punctuation\">.<\/span>fc21<span class=\"token punctuation\">(<\/span>h1<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> self<span class=\"token punctuation\">.<\/span>fc22<span class=\"token punctuation\">(<\/span>h1<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">def<\/span> <span class=\"token function\">reparameterize<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> mu<span class=\"token punctuation\">,<\/span> logvar<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        std <span class=\"token operator\">&#061;<\/span> torch<span class=\"token punctuation\">.<\/span>exp<span class=\"token punctuation\">(<\/span><span class=\"token number\">0.5<\/span> <span class=\"token operator\">*<\/span> logvar<span class=\"token punctuation\">)<\/span><br \/>\n        eps <span class=\"token operator\">&#061;<\/span> torch<span class=\"token punctuation\">.<\/span>randn_like<span class=\"token punctuation\">(<\/span>std<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> mu <span class=\"token operator\">&#043;<\/span> eps <span class=\"token operator\">*<\/span> std <span class=\"token comment\"># z &#061; mu &#043; eps * std<\/span><\/p>\n<p>    <span class=\"token keyword\">def<\/span> <span class=\"token function\">decode<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> z<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        h3 <span class=\"token operator\">&#061;<\/span> F<span class=\"token punctuation\">.<\/span>relu<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">.<\/span>fc3<span class=\"token punctuation\">(<\/span>z<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> torch<span class=\"token punctuation\">.<\/span>sigmoid<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">.<\/span>fc4<span class=\"token punctuation\">(<\/span>h3<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">def<\/span> <span class=\"token function\">forward<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> x<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        mu<span class=\"token punctuation\">,<\/span> logvar <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>encode<span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">.<\/span>view<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">784<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        z <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>reparameterize<span class=\"token punctuation\">(<\/span>mu<span class=\"token punctuation\">,<\/span> logvar<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> self<span class=\"token punctuation\">.<\/span>decode<span class=\"token punctuation\">(<\/span>z<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> mu<span class=\"token punctuation\">,<\/span> logvar<\/p>\n<p><span class=\"token comment\"># Loss Function<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">loss_function<\/span><span class=\"token punctuation\">(<\/span>recon_x<span class=\"token punctuation\">,<\/span> x<span class=\"token punctuation\">,<\/span> mu<span class=\"token punctuation\">,<\/span> logvar<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    BCE <span class=\"token operator\">&#061;<\/span> F<span class=\"token punctuation\">.<\/span>binary_cross_entropy<span class=\"token punctuation\">(<\/span>recon_x<span class=\"token punctuation\">,<\/span> x<span class=\"token punctuation\">.<\/span>view<span class=\"token punctuation\">(<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">784<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> reduction<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;sum&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token comment\"># KL Divergence Formula<\/span><br \/>\n    KLD <span class=\"token operator\">&#061;<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token number\">0.5<\/span> <span class=\"token operator\">*<\/span> torch<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">sum<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span> <span class=\"token operator\">&#043;<\/span> logvar <span class=\"token operator\">&#8211;<\/span> mu<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">pow<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> logvar<span class=\"token punctuation\">.<\/span>exp<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> BCE <span class=\"token operator\">&#043;<\/span> KLD<\/p>\n<hr \/>\n<p>\u4e0b\u4e00\u7ae0\u9884\u544a&#xff1a; VAE \u751f\u6210\u7684\u56fe\u7247\u603b\u662f\u6709\u70b9\u6a21\u7cca&#xff08;\u56e0\u4e3a Loss \u662f\u7b97\u50cf\u7d20\u5747\u65b9\u5dee&#xff09;\u3002\u6709\u6ca1\u6709\u529e\u6cd5\u8ba9\u751f\u6210\u7684\u56fe\u7247\u6781\u5176\u903c\u771f&#xff0c;\u8fde\u6bdb\u5b54\u90fd\u6e05\u6670\u53ef\u89c1&#xff1f; \u6211\u4eec\u9700\u8981\u4e24\u4e2a\u7f51\u7edc\u4e92\u76f8\u6253\u67b6 \u2014\u2014 GAN (\u751f\u6210\u5bf9\u6297\u7f51\u7edc)\u3002<\/p>\n<p>\u4e0b\u4e00\u7ae0&#xff1a;24_GAN\u7684\u535a\u5f08\u5982\u4f55\u8fbe\u5230\u7eb3\u4ec0\u5747\u8861&#xff1f;\u751f\u6210\u5bf9\u6297\u7f51\u7edc\u539f\u7406<\/p>\n","protected":false},"excerpt":{"rendered":"<p>23_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c&#xff1f;\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 \u672c\u7ae0\u76ee\u6807&#xff1a;\u89e3\u51b3 Autoencoder \u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed\u7684\u95ee\u9898\u3002\u5f15\u5165 VAE (Variational Autoencoder)&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u5b66\u4e60\\&#8221;\u5206\u5e03\\&#8221;\u800c\u4e0d\u662f\\&#8221;\u70b9\\&#8221;&#xff0c;\u4ece\u800c\u80fd\u591f\u751f\u6210\u5e73\u6ed1\u53d8\u5316\u7684\u56fe\u50cf\u3002 \u76ee\u5f55<br \/>\nAutoencoder \u7684\u7f3a\u9677&#xff1a;\u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eedVAE \u7684\u6838\u5fc3\u601d\u60f3&#xff1a;\u5b66\u4e60\u5206\u5e03\u91cd\u53c2\u6570\u5316\u6280\u5de7 (Re-parameterization Trick)KL <\/p>\n","protected":false},"author":2,"featured_media":75273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[50,86],"topic":[],"class_list":["post-75274","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>\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \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\/75274.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"23_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c&#xff1f;\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 \u672c\u7ae0\u76ee\u6807&#xff1a;\u89e3\u51b3 Autoencoder \u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed\u7684\u95ee\u9898\u3002\u5f15\u5165 VAE (Variational Autoencoder)&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u5b66\u4e60&quot;\u5206\u5e03&quot;\u800c\u4e0d\u662f&quot;\u70b9&quot;&#xff0c;\u4ece\u800c\u80fd\u591f\u751f\u6210\u5e73\u6ed1\u53d8\u5316\u7684\u56fe\u50cf\u3002 \u76ee\u5f55 Autoencoder \u7684\u7f3a\u9677&#xff1a;\u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eedVAE \u7684\u6838\u5fc3\u601d\u60f3&#xff1a;\u5b66\u4e60\u5206\u5e03\u91cd\u53c2\u6570\u5316\u6280\u5de7 (Re-parameterization Trick)KL\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/75274.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-11T13:58:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260211135850-698c8b1a8f9ba.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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75274.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/75274.html\",\"name\":\"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-11T13:58:52+00:00\",\"dateModified\":\"2026-02-11T13:58:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/75274.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/75274.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/75274.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2\"}]},{\"@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":"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \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\/75274.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"23_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c&#xff1f;\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 \u672c\u7ae0\u76ee\u6807&#xff1a;\u89e3\u51b3 Autoencoder \u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eed\u7684\u95ee\u9898\u3002\u5f15\u5165 VAE (Variational Autoencoder)&#xff0c;\u8ba9\u6a21\u578b\u5b66\u4f1a\u5b66\u4e60\"\u5206\u5e03\"\u800c\u4e0d\u662f\"\u70b9\"&#xff0c;\u4ece\u800c\u80fd\u591f\u751f\u6210\u5e73\u6ed1\u53d8\u5316\u7684\u56fe\u50cf\u3002 \u76ee\u5f55 Autoencoder \u7684\u7f3a\u9677&#xff1a;\u6f5c\u7a7a\u95f4\u4e0d\u8fde\u7eedVAE \u7684\u6838\u5fc3\u601d\u60f3&#xff1a;\u5b66\u4e60\u5206\u5e03\u91cd\u53c2\u6570\u5316\u6280\u5de7 (Re-parameterization Trick)KL","og_url":"https:\/\/www.wsisp.com\/helps\/75274.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-11T13:58:52+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260211135850-698c8b1a8f9ba.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/75274.html","url":"https:\/\/www.wsisp.com\/helps\/75274.html","name":"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-11T13:58:52+00:00","dateModified":"2026-02-11T13:58:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/75274.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/75274.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/75274.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u6df1\u5ea6\u5b66\u4e60\u6559\u7a0b\u2014\u201405_\u751f\u6210\u6a21\u578b(Generative)\u301123_VAE\u5982\u4f55\u5728\u6f5c\u7a7a\u95f4\u63d2\u503c\uff1f\u53d8\u5206\u63a8\u65ad\u7684\u6982\u7387\u89c6\u89d2"}]},{"@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\/75274","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=75274"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/75274\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/75273"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=75274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=75274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=75274"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=75274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}